diff --git a/vcg/complex/algorithms/symmetry.h b/vcg/complex/algorithms/symmetry.h index 20bd2289..548f5a0a 100644 --- a/vcg/complex/algorithms/symmetry.h +++ b/vcg/complex/algorithms/symmetry.h @@ -10,6 +10,24 @@ namespace vcg { namespace tri { +//class SphereEdge; +class SphereFace; +class SphereVertex; + +struct SphereUsedTypes : public vcg::UsedTypes< vcg::Use::AsVertexType, + vcg::Use::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, std::vector > {}; + template class ExtrinsicPlaneSymmetry { @@ -28,8 +46,11 @@ class ExtrinsicPlaneSymmetry std::vector Votes; - TriMeshType *sphere; - typename vcg::GridStaticPtr GridSph; + + + SphereMesh *sphere; + + typename vcg::GridStaticPtr GridSph; ScalarType RadiusInterval; ScalarType MaxRadius; @@ -50,7 +71,7 @@ class ExtrinsicPlaneSymmetry ScalarType MaxD=sphere->bbox.Diag(); ScalarType MinD; CoordType ClosePt; - FaceType *choosen=NULL; + SphereFace *choosen=NULL; choosen=vcg::tri::GetClosestFaceBase(*sphere,GridSph,Direction,MaxD,MinD,ClosePt); assert(choosen!=NULL); int IndexF=choosen-&(sphere->face[0]); @@ -175,11 +196,11 @@ public: if (sphere!=NULL) sphere->Clear(); else - sphere=new TriMeshType(); + sphere=new SphereMesh(); //create the sphere - vcg::tri::Sphere(*sphere,SubDirections); - sphere->UpdateAttributes(); + vcg::tri::Sphere(*sphere,SubDirections); + vcg::tri::UpdateBounding::Box(*sphere); ///initialize grid GridSph.Set(sphere->face.begin(),sphere->face.end());