34 #include<vcg/complex/complex.h>
35 #include<vcg/complex/algorithms/create/platonic.h>
36 #include<vcg/complex/algorithms/point_sampling.h>
37 #include<wrap/io_trimesh/import_off.h>
38 #include<vcg/space/point_matching.h>
46 struct MyUsedTypes :
public vcg::UsedTypes< vcg::Use<MyVertex> ::AsVertexType,
47 vcg::Use<MyEdge> ::AsEdgeType,
48 vcg::Use<MyFace> ::AsFaceType>{};
50 class MyVertex :
public vcg::Vertex<MyUsedTypes, vcg::vertex::Coord3f, vcg::vertex::Normal3f, vcg::vertex::BitFlags >{};
51 class MyFace :
public vcg::Face< MyUsedTypes, vcg::face::FFAdj, vcg::face::VertexRef, vcg::face::Normal3f, vcg::face::BitFlags > {};
52 class MyEdge :
public vcg::Edge<MyUsedTypes>{};
53 class MyMesh :
public vcg::tri::TriMesh< std::vector<MyVertex>, std::vector<MyFace> , std::vector<MyEdge> > {};
55 float EvalPlane(vcg::Plane3f &pl, std::vector<vcg::Point3f> posVec)
58 for(
size_t i=0;i<posVec.size();++i)
59 off += fabs(vcg::SignedDistancePlanePoint(pl,posVec[i]));
61 off/=float(posVec.size());
69 vcg::tri::Icosahedron(m);
77 std::vector<vcg::Point3f> ExactVec;
78 std::vector<vcg::Point3f> PerturbVec;
79 tri::MontecarloSampling(m,ExactVec,10);
85 vcg::math::MarsenneTwisterRNG rnd;
87 vcg::math::GeneratePointInUnitBallUniform<float>(rnd);
88 RotM.SetRotateDeg(rand()%360,dir);
89 TraM.SetTranslate(1,2,3);
90 Matrix44f RigidM = RotM*TraM;
92 for(
size_t i=0;i<ExactVec.size();++i)
93 PerturbVec[i]=RigidM*ExactVec[i];
98 ComputeRigidMatchMatrix(PerturbVec,ExactVec,res);