diff --git a/vcg/complex/trimesh/create/platonic.h b/vcg/complex/trimesh/create/platonic.h index e05763bc..18569d18 100644 --- a/vcg/complex/trimesh/create/platonic.h +++ b/vcg/complex/trimesh/create/platonic.h @@ -24,6 +24,9 @@ History $Log: not supported by cvs2svn $ +Revision 1.13 2008/02/15 14:38:32 ganovelli +added Cylinder(..). the filename platonic.h is lesser and lesser significant... + Revision 1.12 2007/10/19 22:29:36 cignoni Re-Wrote basic build function @@ -632,6 +635,7 @@ void Build( MeshType & in, const V & v, const F & f) // Build a regular grid mesh as a typical height field mesh // x y are the position on the grid scaled by wl and hl (at the end x is in the range 0..wl and y is in 0..hl) // z is taken from the array +// Once generated the vertex positions it uses the FaceGrid function to generate the faces; template void Grid(MeshType & in, int w, int h, float wl, float hl, float *data) @@ -643,7 +647,7 @@ void Grid(MeshType & in, int w, int h, float wl, float hl, float *data) in.Clear(); Allocator::AddVertices(in,w*h); - Allocator::AddFaces(in,(w-1)*(h-1)*2); + float wld=wl/float(w); float hld=hl/float(h); @@ -651,7 +655,21 @@ void Grid(MeshType & in, int w, int h, float wl, float hl, float *data) for(int i=0;i +void FaceGrid(MeshType & in, int w, int h) +{ + assert(in.vn == in.vert.size()); // require a compact vertex vector + assert(in.vn <= w*h); // the number of vertices should be large enough + + Allocator::AddFaces(in,(w-1)*(h-1)*2); + // i+0,j+0 -- i+0,j+1 // | \ | // | \ |