Refactored Geodesic a bit to allow float/double independency

This commit is contained in:
Paolo Cignoni 2014-08-23 01:33:53 +00:00
parent e032901b7f
commit 305ac24a23
1 changed files with 6 additions and 6 deletions

View File

@ -92,8 +92,8 @@ struct BasicCrossFunctor
BasicCrossFunctor(MeshType &m) { tri::RequirePerVertexCurvatureDir(m); }
typedef typename MeshType::VertexType VertexType;
Point3f D1(VertexType &v) { return v.PD1(); }
Point3f D2(VertexType &v) { return v.PD1(); }
typename MeshType::CoordType D1(VertexType &v) { return v.PD1(); }
typename MeshType::CoordType D2(VertexType &v) { return v.PD2(); }
};
/**
@ -111,12 +111,12 @@ class AnisotropicDistance{
typedef typename MeshType::CoordType CoordType;
typedef typename MeshType::VertexIterator VertexIterator;
typename MeshType::template PerVertexAttributeHandle<Point3f> wxH,wyH;
typename MeshType::template PerVertexAttributeHandle<CoordType> wxH,wyH;
public:
template <class CrossFunctor > AnisotropicDistance(MeshType &m, CrossFunctor &cf)
{
wxH = tri::Allocator<MeshType>:: template GetPerVertexAttribute<Point3f> (m,"distDirX");
wyH = tri::Allocator<MeshType>:: template GetPerVertexAttribute<Point3f> (m,"distDirY");
wxH = tri::Allocator<MeshType>:: template GetPerVertexAttribute<CoordType> (m,"distDirX");
wyH = tri::Allocator<MeshType>:: template GetPerVertexAttribute<CoordType> (m,"distDirY");
for(VertexIterator vi=m.vert.begin();vi!=m.vert.end();++vi)
{
@ -127,7 +127,7 @@ public:
ScalarType operator()( VertexType * v0, VertexType * v1)
{
Point3f dd = Point3f::Construct(v0->cP()-v1->cP());
CoordType dd = v0->cP()-v1->cP();
float x = (fabs(dd * wxH[v0])+fabs(dd *wxH[v1]))/2.0f;
float y = (fabs(dd * wyH[v0])+fabs(dd *wyH[v1]))/2.0f;