Added missing Sphere function

This commit is contained in:
Paolo Cignoni 2005-06-17 00:49:29 +00:00
parent 0434c2512d
commit 53da9a97e1
1 changed files with 29 additions and 18 deletions

View File

@ -24,6 +24,9 @@
History History
$Log: not supported by cvs2svn $ $Log: not supported by cvs2svn $
Revision 1.2 2005/02/25 11:41:08 pietroni
Fixed bug in Square
Revision 1.1 2005/01/19 15:43:15 fiorin Revision 1.1 2005/01/19 15:43:15 fiorin
Moved from vcg/complex/trimesh to vcg/complex/trimesh/create Moved from vcg/complex/trimesh to vcg/complex/trimesh/create
@ -54,8 +57,11 @@ First working version (tetrahedron!)
#ifndef __VCGLIB_PLATONIC #ifndef __VCGLIB_PLATONIC
#define __VCGLIB_PLATONIC #define __VCGLIB_PLATONIC
#include<vcg/complex/trimesh/allocate.h>
#include<vcg/math/base.h> #include<vcg/math/base.h>
#include<vcg/complex/trimesh/allocate.h>
#include<vcg/complex/trimesh/refine.h>
#include<vcg/complex/trimesh/update/flag.h>
namespace vcg { namespace vcg {
namespace tri { namespace tri {
/** \addtogroup trimesh */ /** \addtogroup trimesh */
@ -358,23 +364,28 @@ void Square(MeshType &in)
(*fi).V(0)=ivp[0]; (*fi).V(1)=ivp[2]; (*fi).V(2)=ivp[3]; (*fi).V(0)=ivp[0]; (*fi).V(1)=ivp[2]; (*fi).V(2)=ivp[3];
} }
//template <class MESH_TYPE> // this function build a sphere starting from a possibly not empty mesh.
//void Sphere(MESH_TYPE &in, const int subdiv = 3 ) // if the mesh is not empty it is used as base for the subdivision process.
//{ // otherwise an icosahedron is used.
// Icosahedron(in); template <class MESH_TYPE>
// in.ComputeBorderFlag(); void Sphere(MESH_TYPE &in, const int subdiv = 3 )
// int lastsize = 0; {
// for(int i=0;i<subdiv;++i) if(in.vn==0 && in.fn==0) Icosahedron(in);
// { //in.ComputeBorderFlag();
// Refine<MESH_TYPE, MidPoint<MESH_TYPE> >(in,MidPoint<MESH_TYPE>(),0); tri::UpdateFlags<AMesh>::FaceBorderFromNone(in);
// MESH_TYPE::vertex_iterator vi;
// int lastsize = 0;
// for(vi = in.vert.begin()+lastsize;vi!=in.vert.end();++vi) for(int i=0;i<subdiv;++i)
// vi->P().Normalize(); {
// Refine<MESH_TYPE, MidPoint<MESH_TYPE> >(in,MidPoint<MESH_TYPE>(),0);
// lastsize = in.vert.size(); MESH_TYPE::VertexIterator vi;
// }
//} for(vi = in.vert.begin()+lastsize;vi!=in.vert.end();++vi)
vi->P().Normalize();
lastsize = in.vert.size();
}
}
/// r1 = raggio 1, r2 = raggio2, h = altezza (asse y) /// r1 = raggio 1, r2 = raggio2, h = altezza (asse y)