23 #include <vcg/complex/complex.h>
24 #include <vcg/math/perlin_noise.h>
25 #include <vcg/complex/algorithms/create/platonic.h>
26 #include <vcg/complex/algorithms/create/resampler.h>
27 #include <wrap/io_trimesh/export_ply.h>
32 typedef float ScalarType;
37 struct MyUsedTypes :
public UsedTypes< Use<MyVertex>::AsVertexType,
38 Use<MyFace> ::AsFaceType>{};
40 class MyVertex :
public Vertex< MyUsedTypes, vertex::Coord3f, vertex::Normal3f, vertex::BitFlags>{};
41 class MyFace :
public Face< MyUsedTypes, face::VertexRef, face::Normal3f, face::BitFlags> {};
43 class MyMesh :
public tri::TriMesh< std::vector< MyVertex>, std::vector< MyFace > > {};
45 int main(
int ,
char **)
47 MyMesh base_mesh,resampled_mesh;
48 tri::Torus(base_mesh,10,3);
50 Box3f bb = base_mesh.bbox;
51 float cell_side = bb.Diag()/30.0;
53 Point3i box_size(bb.DimX()/cell_side,bb.DimY()/cell_side,bb.DimZ()/cell_side);
55 tri::Resampler<MyMesh,MyMesh>::Resample(base_mesh,resampled_mesh,bb,box_size,cell_side*5);
57 vcg::tri::io::ExporterPLY<MyMesh>::Save( resampled_mesh,
"resampled_torus.ply");