changes to comply "plus" types

This commit is contained in:
ganovelli 2007-05-04 16:44:06 +00:00
parent 45bd389107
commit c2e2b2cd0a
3 changed files with 30 additions and 13 deletions

View File

@ -24,6 +24,9 @@
History History
$Log: not supported by cvs2svn $ $Log: not supported by cvs2svn $
Revision 1.43 2007/03/12 15:37:19 tarini
Texture coord name change! "TCoord" and "Texture" are BAD. "TexCoord" is GOOD.
Revision 1.42 2007/02/20 14:07:53 ganovelli Revision 1.42 2007/02/20 14:07:53 ganovelli
added QualityType to comply faceplus type added QualityType to comply faceplus type
@ -1245,7 +1248,15 @@ inline void Nexts( BaseFaceType *&f,int &z )
// Sezione dist e ray // Sezione dist e ray
#ifdef __VCGLIB_FACE_RT #ifdef __VCGLIB_FACE_RT
CoordType edge[3];
CoordType & Edge(const int& i){return edges[i];};
CoordType cEdge(const int& i)const{return edges[i];};
Plane3<ScalarType> & Plane(){return plane;};
Plane3<ScalarType> cPlane()const{return plane;};
CoordType edges[3];;
Plane3<ScalarType> plane; Plane3<ScalarType> plane;
#endif #endif

View File

@ -24,6 +24,9 @@
History History
$Log: not supported by cvs2svn $ $Log: not supported by cvs2svn $
Revision 1.10 2006/01/22 10:06:23 cignoni
Corrected use of Area with the unambiguous DoubleArea
Revision 1.9 2005/09/28 19:35:06 m_di_benedetto Revision 1.9 2005/09/28 19:35:06 m_di_benedetto
Added class PointDistanceFunctor. Added class PointDistanceFunctor.
@ -100,13 +103,13 @@ namespace vcg {
//const ScalarType EPSILON = 0.00000001; //const ScalarType EPSILON = 0.00000001;
ScalarType b,b0,b1,b2; ScalarType b,b0,b1,b2;
// Calcolo distanza punto piano // Calcolo distanza punto piano
ScalarType d = Distance( f.plane, q ); ScalarType d = Distance( f.cPlane(), q );
if( d>dist || d<-dist ) // Risultato peggiore: niente di fatto if( d>dist || d<-dist ) // Risultato peggiore: niente di fatto
return false; return false;
// Calcolo del punto sul piano // Calcolo del punto sul piano
// NOTA: aggiunto un '-d' in fondo Paolo C. // NOTA: aggiunto un '-d' in fondo Paolo C.
Point3<ScalarType> t = f.plane.Direction(); Point3<ScalarType> t = f.cPlane().Direction();
t[0] *= -d; t[0] *= -d;
t[1] *= -d; t[1] *= -d;
t[2] *= -d; t[2] *= -d;
@ -115,21 +118,21 @@ namespace vcg {
switch( f.Flags() & (FaceType::NORMX|FaceType::NORMY|FaceType::NORMZ) ) switch( f.Flags() & (FaceType::NORMX|FaceType::NORMY|FaceType::NORMZ) )
{ {
case FaceType::NORMX: case FaceType::NORMX:
b0 = f.edge[1][1]*(p[2] - f.cP(1)[2]) - f.edge[1][2]*(p[1] - f.cP(1)[1]); b0 = f.cEdge(1)[1]*(p[2] - f.cP(1)[2]) - f.cEdge(1)[2]*(p[1] - f.cP(1)[1]);
if(b0<=0) if(b0<=0)
{ {
b0 = PSDist(q,f.V(1)->cP(),f.V(2)->cP(),p); b0 = PSDist(q,f.V(1)->cP(),f.V(2)->cP(),p);
if(dist>b0) { dist = b0; return true; } if(dist>b0) { dist = b0; return true; }
else return false; else return false;
} }
b1 = f.edge[2][1]*(p[2] - f.cP(2)[2]) - f.edge[2][2]*(p[1] - f.cP(2)[1]); b1 = f.cEdge(2)[1]*(p[2] - f.cP(2)[2]) - f.cEdge(2)[2]*(p[1] - f.cP(2)[1]);
if(b1<=0) if(b1<=0)
{ {
b1 = PSDist(q,f.V(2)->cP(),f.V(0)->cP(),p); b1 = PSDist(q,f.V(2)->cP(),f.V(0)->cP(),p);
if(dist>b1) { dist = b1; return true; } if(dist>b1) { dist = b1; return true; }
else return false; else return false;
} }
b2 = f.edge[0][1]*(p[2] - f.cP(0)[2]) - f.edge[0][2]*(p[1] - f.cP(0)[1]); b2 = f.cEdge(0)[1]*(p[2] - f.cP(0)[2]) - f.cEdge(0)[2]*(p[1] - f.cP(0)[1]);
if(b2<=0) if(b2<=0)
{ {
b2 = PSDist(q,f.V(0)->cP(),f.V(1)->cP(),p); b2 = PSDist(q,f.V(0)->cP(),f.V(1)->cP(),p);
@ -156,21 +159,21 @@ namespace vcg {
break; break;
case FaceType::NORMY: case FaceType::NORMY:
b0 = f.edge[1][2]*(p[0] - f.cP(1)[0]) - f.edge[1][0]*(p[2] - f.cP(1)[2]); b0 = f.cEdge(1)[2]*(p[0] - f.cP(1)[0]) - f.cEdge(1)[0]*(p[2] - f.cP(1)[2]);
if(b0<=0) if(b0<=0)
{ {
b0 = PSDist(q,f.V(1)->cP(),f.V(2)->cP(),p); b0 = PSDist(q,f.V(1)->cP(),f.V(2)->cP(),p);
if(dist>b0) { dist = b0; return true; } if(dist>b0) { dist = b0; return true; }
else return false; else return false;
} }
b1 = f.edge[2][2]*(p[0] - f.cP(2)[0]) - f.edge[2][0]*(p[2] - f.cP(2)[2]); b1 = f.cEdge(2)[2]*(p[0] - f.cP(2)[0]) - f.cEdge(2)[0]*(p[2] - f.cP(2)[2]);
if(b1<=0) if(b1<=0)
{ {
b1 = PSDist(q,f.V(2)->cP(),f.V(0)->cP(),p); b1 = PSDist(q,f.V(2)->cP(),f.V(0)->cP(),p);
if(dist>b1) { dist = b1; return true; } if(dist>b1) { dist = b1; return true; }
else return false; else return false;
} }
b2 = f.edge[0][2]*(p[0] - f.cP(0)[0]) - f.edge[0][0]*(p[2] - f.cP(0)[2]); b2 = f.cEdge(0)[2]*(p[0] - f.cP(0)[0]) - f.cEdge(0)[0]*(p[2] - f.cP(0)[2]);
if(b2<=0) if(b2<=0)
{ {
b2 = PSDist(q,f.V(0)->cP(),f.V(1)->cP(),p); b2 = PSDist(q,f.V(0)->cP(),f.V(1)->cP(),p);
@ -190,21 +193,21 @@ namespace vcg {
break; break;
case FaceType::NORMZ: case FaceType::NORMZ:
b0 = f.edge[1][0]*(p[1] - f.cP(1)[1]) - f.edge[1][1]*(p[0] - f.cP(1)[0]); b0 = f.cEdge(1)[0]*(p[1] - f.cP(1)[1]) - f.cEdge(1)[1]*(p[0] - f.cP(1)[0]);
if(b0<=0) if(b0<=0)
{ {
b0 = PSDist(q,f.V(1)->cP(),f.V(2)->cP(),p); b0 = PSDist(q,f.V(1)->cP(),f.V(2)->cP(),p);
if(dist>b0) { dist = b0; return true; } if(dist>b0) { dist = b0; return true; }
else return false; else return false;
} }
b1 = f.edge[2][0]*(p[1] - f.cP(2)[1]) - f.edge[2][1]*(p[0] - f.cP(2)[0]); b1 = f.cEdge(2)[0]*(p[1] - f.cP(2)[1]) - f.cEdge(2)[1]*(p[0] - f.cP(2)[0]);
if(b1<=0) if(b1<=0)
{ {
b1 = PSDist(q,f.V(2)->cP(),f.V(0)->cP(),p); b1 = PSDist(q,f.V(2)->cP(),f.V(0)->cP(),p);
if(dist>b1) { dist = b1; return true; } if(dist>b1) { dist = b1; return true; }
else return false; else return false;
} }
b2 = f.edge[0][0]*(p[1] - f.cP(0)[1]) - f.edge[0][1]*(p[0] - f.cP(0)[0]); b2 = f.cEdge(0)[0]*(p[1] - f.cP(0)[1]) - f.cEdge(0)[1]*(p[0] - f.cP(0)[0]);
if(b2<=0) if(b2<=0)
{ {
b2 = PSDist(q,f.V(0)->cP(),f.V(1)->cP(),p); b2 = PSDist(q,f.V(0)->cP(),f.V(1)->cP(),p);

View File

@ -24,6 +24,9 @@
History History
$Log: not supported by cvs2svn $ $Log: not supported by cvs2svn $
Revision 1.11 2007/03/27 09:22:11 cignoni
Added Visited flags
Revision 1.10 2007/03/12 15:37:19 tarini Revision 1.10 2007/03/12 15:37:19 tarini
Texture coord name change! "TCoord" and "Texture" are BAD. "TexCoord" is GOOD. Texture coord name change! "TCoord" and "Texture" are BAD. "TexCoord" is GOOD.
@ -360,7 +363,7 @@ template <class BVT, class BET, class BFT, class BTT,
template <typename> class G = FaceDefaultDeriver, template <typename> class H = FaceDefaultDeriver, template <typename> class G = FaceDefaultDeriver, template <typename> class H = FaceDefaultDeriver,
template <typename> class I = FaceDefaultDeriver > template <typename> class I = FaceDefaultDeriver >
class FaceSimp3: public FaceArityMax<BVT,BET,BFT,BTT, A, B, C, D, E, F, G, H, I> {}; class FaceSimp3: public FaceArityMax<BVT,BET,BFT,BTT, A, B, C, D, E, F, G, H, I> {};
class DumTT;
template <class BVT, class BET, class BFT, template <class BVT, class BET, class BFT,
template <typename> class A = FaceDefaultDeriver, template <typename> class B = FaceDefaultDeriver, template <typename> class A = FaceDefaultDeriver, template <typename> class B = FaceDefaultDeriver,
template <typename> class C = FaceDefaultDeriver, template <typename> class D = FaceDefaultDeriver, template <typename> class C = FaceDefaultDeriver, template <typename> class D = FaceDefaultDeriver,