From ce0dfc02d21994542c481d31b2dbbce6bd313b97 Mon Sep 17 00:00:00 2001 From: cignoni Date: Tue, 23 Jul 2013 07:33:48 +0000 Subject: [PATCH] minor changes to the samples, removed harmless warnings, updated interfaces --- apps/sample/trimesh_color/trimesh_color.cpp | 2 +- apps/sample/trimesh_fitting/trimesh_fitting.cpp | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/apps/sample/trimesh_color/trimesh_color.cpp b/apps/sample/trimesh_color/trimesh_color.cpp index 4f741bfc..344ff46e 100644 --- a/apps/sample/trimesh_color/trimesh_color.cpp +++ b/apps/sample/trimesh_color/trimesh_color.cpp @@ -48,7 +48,7 @@ class MyFace : public vcg::Face < MyUsedTypes, vcg::face::VertexRef, vcg::fac class MyMesh : public vcg::tri::TriMesh< std::vector, std::vector > {}; -int main(int argc, char **argv) +int main() { MyMesh m; diff --git a/apps/sample/trimesh_fitting/trimesh_fitting.cpp b/apps/sample/trimesh_fitting/trimesh_fitting.cpp index c0d4255c..52f1f524 100644 --- a/apps/sample/trimesh_fitting/trimesh_fitting.cpp +++ b/apps/sample/trimesh_fitting/trimesh_fitting.cpp @@ -52,7 +52,7 @@ class MyFace : public vcg::Face< MyUsedTypes, vcg::face::FFAdj, vcg::face::V class MyEdge : public vcg::Edge{}; class MyMesh : public vcg::tri::TriMesh< std::vector, std::vector , std::vector > {}; -float EvalPlane(vcg::Plane3f &pl, vcg::Point3f &dir, std::vector posVec) +float EvalPlane(vcg::Plane3f &pl, std::vector posVec) { float off=0; for(size_t i=0;i p } -int main( int argc, char **argv ) +int main( ) { MyMesh m; vcg::tri::Icosahedron(m); @@ -76,6 +76,7 @@ int main( int argc, char **argv ) int cnt=0; float scaleFac = m.bbox.Diag()/10.0f; printf("ScaleFac %f\n\n",scaleFac); + vcg::math::MarsenneTwisterRNG rnd; for(int i=0;i ExactVec; @@ -87,7 +88,7 @@ int main( int argc, char **argv ) { vcg::Point3f p = vcg::tri::SurfaceSampling::RandomPointInTriangle(m.face[i]); ExactVec.push_back(p); - vcg::Point3f off=vcg::tri::SurfaceSampling::RandomPoint3fBall01(); + vcg::Point3f off = vcg::math::GeneratePointInUnitBallUniform(rnd); p+=off*scaleFac; float w = std::max(0.0, 1.0f-fabs(vcg::SignedDistancePlanePoint(pl,p))/scaleFac); PerturbVec.push_back(p); @@ -95,13 +96,13 @@ int main( int argc, char **argv ) } vcg::FitPlaneToPointSet(ExactVec,ple); - float err=EvalPlane(ple,m.face[i].N(),ExactVec); + float err=EvalPlane(ple,ExactVec); vcg::FitPlaneToPointSet(PerturbVec,plf); - float err0=EvalPlane(plf,m.face[i].N(),ExactVec); + float err0=EvalPlane(plf,ExactVec); vcg::WeightedFitPlaneToPointSet(PerturbVec,WeightVec,plw); - float err1=EvalPlane(plw,m.face[i].N(),ExactVec); + float err1=EvalPlane(plw,ExactVec); printf("Exact %5.3f Fit to Perturbed %5.3f Weighted fit to perturbed %5.3f\n",err,err0,err1); if(err0>err1) cnt++; }