solved minor error with templated scalar type
This commit is contained in:
parent
ae18d9b445
commit
feff81dd01
|
|
@ -11,22 +11,8 @@ namespace vcg {
|
||||||
namespace tri {
|
namespace tri {
|
||||||
|
|
||||||
//class SphereEdge;
|
//class SphereEdge;
|
||||||
class SphereFace;
|
//class SphereFace;
|
||||||
class SphereVertex;
|
//class SphereVertex;
|
||||||
|
|
||||||
struct SphereUsedTypes : public vcg::UsedTypes< vcg::Use<SphereVertex>::AsVertexType,
|
|
||||||
vcg::Use<SphereFace>::AsFaceType>{};
|
|
||||||
|
|
||||||
class SphereVertex : public vcg::Vertex< SphereUsedTypes,
|
|
||||||
vcg::vertex::Coord3f,
|
|
||||||
vcg::vertex::Normal3f,
|
|
||||||
vcg::vertex::BitFlags>{};
|
|
||||||
|
|
||||||
class SphereFace : public vcg::Face< SphereUsedTypes, vcg::face::VertexRef,
|
|
||||||
vcg::face::Normal3f,vcg::face::Mark,
|
|
||||||
vcg::face::BitFlags,vcg::face::FFAdj> {};
|
|
||||||
|
|
||||||
class SphereMesh : public vcg::tri::TriMesh< std::vector<SphereVertex>, std::vector<SphereFace> > {};
|
|
||||||
|
|
||||||
template <class TriMeshType>
|
template <class TriMeshType>
|
||||||
class ExtrinsicPlaneSymmetry
|
class ExtrinsicPlaneSymmetry
|
||||||
|
|
@ -36,6 +22,23 @@ class ExtrinsicPlaneSymmetry
|
||||||
typedef typename TriMeshType::CoordType CoordType;
|
typedef typename TriMeshType::CoordType CoordType;
|
||||||
typedef typename TriMeshType::ScalarType ScalarType;
|
typedef typename TriMeshType::ScalarType ScalarType;
|
||||||
|
|
||||||
|
// struct SphereUsedTypes : public vcg::UsedTypes< vcg::Use<SphereVertex>::AsVertexType,
|
||||||
|
// vcg::Use<SphereFace>::AsFaceType>{};
|
||||||
|
|
||||||
|
// class SphereVertex : public vcg::Vertex< SphereUsedTypes,
|
||||||
|
// vcg::vertex::Coord<CoordType,ScalarType>,
|
||||||
|
// vcg::vertex::Normal<CoordType,ScalarType>,
|
||||||
|
// vcg::vertex::BitFlags>{};
|
||||||
|
|
||||||
|
// class SphereFace : public vcg::Face< SphereUsedTypes, vcg::face::VertexRef,
|
||||||
|
// vcg::vertex::Normal<vcg::Point3<ScalarType>,ScalarType>,
|
||||||
|
// vcg::face::Mark,
|
||||||
|
// vcg::face::BitFlags,vcg::face::FFAdj> {};
|
||||||
|
|
||||||
|
// class SphereMesh : public vcg::tri::TriMesh< std::vector<SphereVertex>, std::vector<SphereFace> > {};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
TriMeshType &tri_mesh;
|
TriMeshType &tri_mesh;
|
||||||
|
|
||||||
CoordType AlignZeroTr;
|
CoordType AlignZeroTr;
|
||||||
|
|
@ -48,9 +51,9 @@ class ExtrinsicPlaneSymmetry
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
SphereMesh *sphere;
|
TriMeshType *sphere;
|
||||||
|
|
||||||
typename vcg::GridStaticPtr<SphereFace> GridSph;
|
typename vcg::GridStaticPtr<FaceType,ScalarType> GridSph;
|
||||||
|
|
||||||
ScalarType RadiusInterval;
|
ScalarType RadiusInterval;
|
||||||
ScalarType MaxRadius;
|
ScalarType MaxRadius;
|
||||||
|
|
@ -71,7 +74,7 @@ class ExtrinsicPlaneSymmetry
|
||||||
ScalarType MaxD=sphere->bbox.Diag();
|
ScalarType MaxD=sphere->bbox.Diag();
|
||||||
ScalarType MinD;
|
ScalarType MinD;
|
||||||
CoordType ClosePt;
|
CoordType ClosePt;
|
||||||
SphereFace *choosen=NULL;
|
FaceType *choosen=NULL;
|
||||||
choosen=vcg::tri::GetClosestFaceBase(*sphere,GridSph,Direction,MaxD,MinD,ClosePt);
|
choosen=vcg::tri::GetClosestFaceBase(*sphere,GridSph,Direction,MaxD,MinD,ClosePt);
|
||||||
assert(choosen!=NULL);
|
assert(choosen!=NULL);
|
||||||
int IndexF=choosen-&(sphere->face[0]);
|
int IndexF=choosen-&(sphere->face[0]);
|
||||||
|
|
@ -196,11 +199,11 @@ public:
|
||||||
if (sphere!=NULL)
|
if (sphere!=NULL)
|
||||||
sphere->Clear();
|
sphere->Clear();
|
||||||
else
|
else
|
||||||
sphere=new SphereMesh();
|
sphere=new TriMeshType();
|
||||||
|
|
||||||
//create the sphere
|
//create the sphere
|
||||||
vcg::tri::Sphere<SphereMesh>(*sphere,SubDirections);
|
vcg::tri::Sphere<TriMeshType>(*sphere,SubDirections);
|
||||||
vcg::tri::UpdateBounding<SphereMesh>::Box(*sphere);
|
vcg::tri::UpdateBounding<TriMeshType>::Box(*sphere);
|
||||||
|
|
||||||
///initialize grid
|
///initialize grid
|
||||||
GridSph.Set(sphere->face.begin(),sphere->face.end());
|
GridSph.Set(sphere->face.begin(),sphere->face.end());
|
||||||
|
|
|
||||||
|
|
@ -121,7 +121,7 @@ public:
|
||||||
///find distance to each segment and take minimum
|
///find distance to each segment and take minimum
|
||||||
for (int i=0;i<3;i++)
|
for (int i=0;i<3;i++)
|
||||||
{
|
{
|
||||||
vcg::Segment2<float> s=vcg::Segment2<float>(P(i),P((i+1)%3));
|
vcg::Segment2<ScalarType> s=vcg::Segment2<ScalarType>(P(i),P((i+1)%3));
|
||||||
CoordType clos=ClosestPoint<ScalarType>(s,q);
|
CoordType clos=ClosestPoint<ScalarType>(s,q);
|
||||||
ScalarType dis_test=(clos-q).Norm();
|
ScalarType dis_test=(clos-q).Norm();
|
||||||
if (dis_test<dist)
|
if (dis_test<dist)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue