23 #ifndef __VCG_TRI_UPDATE_EDGES
24 #define __VCG_TRI_UPDATE_EDGES
26 #include <vcg/space/plane3.h>
34 template <
class ComputeMeshType>
39 typedef ComputeMeshType MeshType;
40 typedef typename MeshType::VertexType VertexType;
41 typedef typename MeshType::VertexPointer VertexPointer;
42 typedef typename MeshType::VertexIterator VertexIterator;
43 typedef typename MeshType::FaceType FaceType;
44 typedef typename MeshType::FacePointer FacePointer;
45 typedef typename MeshType::FaceIterator FaceIterator;
46 typedef typename MeshType::FaceType::CoordType::ScalarType ScalarType;
48 static void ComputeEdgePlane(FaceType &f)
50 f.Flags() = f.Flags() & (~(FaceType::NORMX|FaceType::NORMY|FaceType::NORMZ));
53 f.Edge(0) = f.V(1)->P(); f.Edge(0) -= f.V(0)->P();
54 f.Edge(1) = f.V(2)->P(); f.Edge(1) -= f.V(1)->P();
55 f.Edge(2) = f.V(0)->P(); f.Edge(2) -= f.V(2)->P();
57 f.Plane().SetDirection(f.Edge(0)^f.Edge(1));
58 f.Plane().SetOffset(f.Plane().Direction().dot(f.V(0)->P()));
59 f.Plane().Normalize();
61 ScalarType nx = math::Abs(f.Plane().Direction()[0]);
62 ScalarType ny = math::Abs(f.Plane().Direction()[1]);
63 ScalarType nz = math::Abs(f.Plane().Direction()[2]);
65 if(nx>ny && nx>nz) { f.Flags() |= FaceType::NORMX; d = 1/f.Plane().Direction()[0]; }
66 else if(ny>nz) { f.Flags() |= FaceType::NORMY; d = 1/f.Plane().Direction()[1]; }
67 else { f.Flags() |= FaceType::NORMZ; d = 1/f.Plane().Direction()[2]; }
75 static void Set(ComputeMeshType &m)
77 if(!FaceType::HasEdgePlane())
throw vcg::MissingComponentException(
"PerFaceEdgePlane");
78 for(FaceIterator f = m.face.begin(); f!=m.face.end(); ++f)
This class is used to compute or update the precomputed data used to efficiently compute point-face d...
Definition: component_ep.h:36
Definition: namespaces.dox:6