changed functions used to compute the aspect ratio

This commit is contained in:
Nico Pietroni 2004-07-08 08:43:22 +00:00
parent d4af2821e3
commit e5a126d378
1 changed files with 38 additions and 12 deletions

View File

@ -24,6 +24,9 @@
History History
$Log: not supported by cvs2svn $ $Log: not supported by cvs2svn $
Revision 1.8 2004/05/20 13:04:23 pietroni
modified setBorderV function
Revision 1.7 2004/05/14 11:48:43 pietroni Revision 1.7 2004/05/14 11:48:43 pietroni
templated with also tetratype... templated with also tetratype...
@ -276,6 +279,11 @@ public:
_zv[0]=_zv[1]=_zv[2]=_zv[3]=-1; _zv[0]=_zv[1]=_zv[2]=_zv[3]=-1;
_tv[0]=_tv[1]=_tv[2]=_tv[3]=NULL; _tv[0]=_tv[1]=_tv[2]=_tv[3]=NULL;
#endif #endif
#ifdef __VCGLIB_TETRA_TQ
ComputeAspectRatio();
#endif
} }
///set border vertices using TT-topology ///set border vertices using TT-topology
#ifdef __VCGLIB_TETRA_AT #ifdef __VCGLIB_TETRA_AT
@ -301,19 +309,20 @@ private:
CoordType _n[4]; CoordType _n[4];
public: public:
#endif #endif
///return the normal of a face of the tetrahedron ///return the normal of a face of the tetrahedron
const CoordType & N(const int &i){ const CoordType & N(const int &i){
assert((i>=0)&&(i<4)); assert((i>=0)&&(i<4));
#ifdef __VCGLIB_TETRA_TN #ifdef __VCGLIB_TETRA_TN
return _n[i]; return _n[i];
#else #else
Tetra3<ScalarType> T=Tetra3<ScalarType>(); Tetra3<ScalarType> T=Tetra3<ScalarType>();
T.P0(0)=V(0)->P(); T.P0(0)=V(0)->P();
T.P1(0)=V(1)->P(); T.P1(0)=V(1)->P();
T.P2(0)=V(2)->P(); T.P2(0)=V(2)->P();
T.P3(0)=V(3)->P(); T.P3(0)=V(3)->P();
return (Normal<Tetra3<ScalarType> >(T,i)); return (Normal<Tetra3<ScalarType> >(T,i));
#endif #endif
} }
/// Calculate the normal to all the faces of a tetrahedron, the value is store in a position of vecton _n for each face /// Calculate the normal to all the faces of a tetrahedron, the value is store in a position of vecton _n for each face
@ -359,7 +368,7 @@ void ComputeNormal()
} }
///return the volume of the tetrahedron ///return the volume of the tetrahedron
const double & Volume(){ const ScalarType & Volume(){
#ifdef __VCGLIB_TETRA_TQ #ifdef __VCGLIB_TETRA_TQ
return _volume; return _volume;
#else #else
@ -367,13 +376,30 @@ void ComputeNormal()
#endif #endif
} }
///return aspect ratio of the tetrahedron ///return aspect ratio of the tetrahedron
double AspectRatio(){ ScalarType AspectRatio(){
#ifdef __VCGLIB_TETRA_TQ #ifdef __VCGLIB_TETRA_TQ
return _aspect_ratio; return _aspect_ratio;
#else #else
return ComputeAspectRatio(); return ComputeAspectRatio();
#endif #endif
} }
///set if exist local value of aspect ratio
ScalarType ComputeAspectRatio(){
Tetra3<ScalarType> T=Tetra3<ScalarType>();
T.P0(0)=V(0)->cP();
T.P1(0)=V(1)->cP();
T.P2(0)=V(2)->cP();
T.P3(0)=V(3)->cP();
#ifdef __VCGLIB_TETRA_TQ
_aspect_ratio= T.ComputeAspectRatio();
return(_aspect_ratio);
#else
return (T.ComputeAspectRatio());
#endif
}
//@} //@}