int main( ) { MyMesh m; vcg::tri::Icosahedron(m); vcg::tri::UpdateNormal<MyMesh>::PerVertexNormalizedPerFaceNormalized(m); vcg::tri::UpdateBounding<MyMesh>::Box(m); // As a simple test we get a few random points on a mesh, // we rot and trans them // and we fit them std::vector<vcg::Point3f> ExactVec; std::vector<vcg::Point3f> PerturbVec; tri::MontecarloSampling(m,ExactVec,10); PerturbVec=ExactVec; Matrix44f RotM; Matrix44f TraM; Point3f dir; vcg::math::MarsenneTwisterRNG rnd; vcg::math::GeneratePointInUnitBallUniform<float>(rnd); RotM.SetRotateDeg(rand()%360,dir); TraM.SetTranslate(1,2,3); Matrix44f RigidM = RotM*TraM; for(size_t i=0;i<ExactVec.size();++i) PerturbVec[i]=RigidM*ExactVec[i]; Quaternionf q; Point3f tr; Matrix44f res; ComputeRigidMatchMatrix(PerturbVec,ExactVec,res); res.print(); RigidM.print(); return 0; }