Small changes in the long long way to making meshlab and the vcglib really float/double independent

TexCoordScalarType can be different from the mesh scalar type
This commit is contained in:
Paolo Cignoni 2014-06-18 10:52:24 +00:00
parent f9fbb89854
commit 0970bd18ca
1 changed files with 216 additions and 215 deletions

View File

@ -35,6 +35,7 @@ namespace vcg {
typedef typename MeshType::VertexType VertexType;
typedef typename MeshType::CoordType CoordType;
typedef typename MeshType::ScalarType ScalarType;
typedef typename MeshType::FaceType::TexCoordType::ScalarType TexScalarType;
static ScalarType Area3D(const FaceType *f)
{
@ -43,7 +44,7 @@ namespace vcg {
static ScalarType AreaUV(const FaceType *f)
{
Point2<ScalarType> uv0,uv1,uv2;
Point2<TexScalarType> uv0,uv1,uv2;
if(PerWedgeFlag) {
uv0=f->cWT(0).P();
uv1=f->cWT(1).P();
@ -67,7 +68,7 @@ namespace vcg {
static ScalarType EdgeLenghtUV(const FaceType *f,int e)
{
assert((e>=0)&&(e<3));
Point2<ScalarType> uv0,uv1;
Point2<TexScalarType> uv0,uv1;
if(PerWedgeFlag) {
uv0=f->cWT(e+0).P();
uv1=f->cWT((e+1)%3).P();
@ -128,7 +129,7 @@ namespace vcg {
static ScalarType AngleRadUV(const FaceType *f,int e)
{
Point2<ScalarType> uv0,uv1,uv2;
Point2<TexScalarType> uv0,uv1,uv2;
if(PerWedgeFlag) {
uv0=f->cWT((e+2)%3).P();
uv1=f->cWT((e+0)%3).P();
@ -138,8 +139,8 @@ namespace vcg {
uv1=f->cV0(e)->T().P();
uv2=f->cV1(e)->T().P();
}
vcg::Point2<ScalarType> dir0=uv2-uv1;
vcg::Point2<ScalarType> dir1=uv0-uv1;
vcg::Point2<TexScalarType> dir0=uv2-uv1;
vcg::Point2<TexScalarType> dir1=uv0-uv1;
dir0.Normalize();
dir1.Normalize();
ScalarType t=dir0*dir1;