From b717573d47569d7cf1cf5e2eb055cecdd14a2772 Mon Sep 17 00:00:00 2001 From: cignoni Date: Thu, 13 May 2004 21:08:00 +0000 Subject: [PATCH] Conformed C++ syntax to GCC requirements --- vcg/complex/trimesh/platonic.h | 545 +++++++++++++++------------------ 1 file changed, 248 insertions(+), 297 deletions(-) diff --git a/vcg/complex/trimesh/platonic.h b/vcg/complex/trimesh/platonic.h index c9219615..6a2c60e3 100644 --- a/vcg/complex/trimesh/platonic.h +++ b/vcg/complex/trimesh/platonic.h @@ -24,6 +24,9 @@ History $Log: not supported by cvs2svn $ +Revision 1.5 2004/03/18 15:29:07 cignoni +Completed Octahedron and Icosahedron + Revision 1.4 2004/03/11 18:14:19 tarini prova @@ -44,72 +47,91 @@ namespace tri { template void Tetrahedron(TetraMeshType &in) { - in.Clear(); - Allocator::AddVertices(in,4); - Allocator::AddFaces(in,4); + typedef TetraMeshType MeshType; + typedef typename MeshType::CoordType CoordType; + typedef typename MeshType::VertexPointer VertexPointer; + typedef typename MeshType::VertexIterator VertexIterator; + typedef typename MeshType::FaceIterator FaceIterator; - TetraMeshType::VertexPointer ivp[4]; + in.Clear(); + Allocator::AddVertices(in,4); + Allocator::AddFaces(in,4); - TetraMeshType::VertexIterator vi=in.vert.begin(); - ivp[0]=&*vi;(*vi).P()=TetraMeshType::CoordType ( 1, 1, 1); ++vi; - ivp[1]=&*vi;(*vi).P()=TetraMeshType::CoordType (-1, 1,-1); ++vi; - ivp[2]=&*vi;(*vi).P()=TetraMeshType::CoordType (-1,-1, 1); ++vi; - ivp[3]=&*vi;(*vi).P()=TetraMeshType::CoordType ( 1,-1,-1); - - TetraMeshType::FaceIterator fi=in.face.begin(); - (*fi).V(0)=ivp[0]; (*fi).V(1)=ivp[1]; (*fi).V(2)=ivp[2]; ++fi; - (*fi).V(0)=ivp[0]; (*fi).V(1)=ivp[2]; (*fi).V(2)=ivp[3]; ++fi; - (*fi).V(0)=ivp[0]; (*fi).V(1)=ivp[3]; (*fi).V(2)=ivp[1]; ++fi; - (*fi).V(0)=ivp[3]; (*fi).V(1)=ivp[2]; (*fi).V(2)=ivp[1]; + VertexPointer ivp[4]; + + VertexIterator vi=in.vert.begin(); + ivp[0]=&*vi;(*vi).P()=TetraMeshType::CoordType ( 1, 1, 1); ++vi; + ivp[1]=&*vi;(*vi).P()=TetraMeshType::CoordType (-1, 1,-1); ++vi; + ivp[2]=&*vi;(*vi).P()=TetraMeshType::CoordType (-1,-1, 1); ++vi; + ivp[3]=&*vi;(*vi).P()=TetraMeshType::CoordType ( 1,-1,-1); + + FaceIterator fi=in.face.begin(); + (*fi).V(0)=ivp[0]; (*fi).V(1)=ivp[1]; (*fi).V(2)=ivp[2]; ++fi; + (*fi).V(0)=ivp[0]; (*fi).V(1)=ivp[2]; (*fi).V(2)=ivp[3]; ++fi; + (*fi).V(0)=ivp[0]; (*fi).V(1)=ivp[3]; (*fi).V(2)=ivp[1]; ++fi; + (*fi).V(0)=ivp[3]; (*fi).V(1)=ivp[2]; (*fi).V(2)=ivp[1]; } template void Octahedron(OctMeshType &in) { - in.Clear(); - Allocator::AddVertices(in,6); - Allocator::AddFaces(in,8); + typedef OctMeshType MeshType; + typedef typename MeshType::CoordType CoordType; + typedef typename MeshType::VertexPointer VertexPointer; + typedef typename MeshType::VertexIterator VertexIterator; + typedef typename MeshType::FaceIterator FaceIterator; - OctMeshType::VertexPointer ivp[6]; + in.Clear(); + Allocator::AddVertices(in,6); + Allocator::AddFaces(in,8); - OctMeshType::VertexIterator vi=in.vert.begin(); - ivp[0]=&*vi;(*vi).P()=OctMeshType::CoordType ( 1, 0, 0); ++vi; - ivp[1]=&*vi;(*vi).P()=OctMeshType::CoordType ( 0, 1, 0); ++vi; - ivp[2]=&*vi;(*vi).P()=OctMeshType::CoordType ( 0, 0, 1); ++vi; - ivp[3]=&*vi;(*vi).P()=OctMeshType::CoordType (-1, 0, 0); ++vi; - ivp[4]=&*vi;(*vi).P()=OctMeshType::CoordType ( 0,-1, 0); ++vi; - ivp[5]=&*vi;(*vi).P()=OctMeshType::CoordType ( 0, 0,-1); - - OctMeshType::FaceIterator fi=in.face.begin(); - (*fi).V(0)=ivp[0]; (*fi).V(1)=ivp[1]; (*fi).V(2)=ivp[2]; ++fi; - (*fi).V(0)=ivp[0]; (*fi).V(1)=ivp[2]; (*fi).V(2)=ivp[4]; ++fi; - (*fi).V(0)=ivp[0]; (*fi).V(1)=ivp[4]; (*fi).V(2)=ivp[5]; ++fi; - (*fi).V(0)=ivp[0]; (*fi).V(1)=ivp[5]; (*fi).V(2)=ivp[1]; ++fi; - (*fi).V(0)=ivp[3]; (*fi).V(1)=ivp[1]; (*fi).V(2)=ivp[5]; ++fi; - (*fi).V(0)=ivp[3]; (*fi).V(1)=ivp[5]; (*fi).V(2)=ivp[4]; ++fi; - (*fi).V(0)=ivp[3]; (*fi).V(1)=ivp[4]; (*fi).V(2)=ivp[2]; ++fi; - (*fi).V(0)=ivp[3]; (*fi).V(1)=ivp[2]; (*fi).V(2)=ivp[1]; + VertexPointer ivp[6]; + + VertexIterator vi=in.vert.begin(); + ivp[0]=&*vi;(*vi).P()=CoordType ( 1, 0, 0); ++vi; + ivp[1]=&*vi;(*vi).P()=CoordType ( 0, 1, 0); ++vi; + ivp[2]=&*vi;(*vi).P()=CoordType ( 0, 0, 1); ++vi; + ivp[3]=&*vi;(*vi).P()=CoordType (-1, 0, 0); ++vi; + ivp[4]=&*vi;(*vi).P()=CoordType ( 0,-1, 0); ++vi; + ivp[5]=&*vi;(*vi).P()=CoordType ( 0, 0,-1); + + FaceIterator fi=in.face.begin(); + (*fi).V(0)=ivp[0]; (*fi).V(1)=ivp[1]; (*fi).V(2)=ivp[2]; ++fi; + (*fi).V(0)=ivp[0]; (*fi).V(1)=ivp[2]; (*fi).V(2)=ivp[4]; ++fi; + (*fi).V(0)=ivp[0]; (*fi).V(1)=ivp[4]; (*fi).V(2)=ivp[5]; ++fi; + (*fi).V(0)=ivp[0]; (*fi).V(1)=ivp[5]; (*fi).V(2)=ivp[1]; ++fi; + (*fi).V(0)=ivp[3]; (*fi).V(1)=ivp[1]; (*fi).V(2)=ivp[5]; ++fi; + (*fi).V(0)=ivp[3]; (*fi).V(1)=ivp[5]; (*fi).V(2)=ivp[4]; ++fi; + (*fi).V(0)=ivp[3]; (*fi).V(1)=ivp[4]; (*fi).V(2)=ivp[2]; ++fi; + (*fi).V(0)=ivp[3]; (*fi).V(1)=ivp[2]; (*fi).V(2)=ivp[1]; } template void Icosahedron(IcoMeshType &in) { - IcoMeshType::ScalarType L=IcoMeshType::ScalarType((math::Sqrt(5.0)+1.0)/2.0); - IcoMeshType::CoordType vv[12]={ - IcoMeshType::CoordType ( 0, L, 1), - IcoMeshType::CoordType ( 0, L,-1), - IcoMeshType::CoordType ( 0,-L, 1), - IcoMeshType::CoordType ( 0,-L,-1), + typedef IcoMeshType MeshType; + typedef typename MeshType::ScalarType ScalarType; + typedef typename MeshType::CoordType CoordType; + typedef typename MeshType::VertexPointer VertexPointer; + typedef typename MeshType::VertexIterator VertexIterator; + typedef typename MeshType::FaceIterator FaceIterator; - IcoMeshType::CoordType ( L, 1, 0), - IcoMeshType::CoordType ( L,-1, 0), - IcoMeshType::CoordType (-L, 1, 0), - IcoMeshType::CoordType (-L,-1, 0), + ScalarType L=ScalarType((math::Sqrt(5.0)+1.0)/2.0); + CoordType vv[12]={ + CoordType ( 0, L, 1), + CoordType ( 0, L,-1), + CoordType ( 0,-L, 1), + CoordType ( 0,-L,-1), - IcoMeshType::CoordType ( 1, 0, L), - IcoMeshType::CoordType (-1, 0, L), - IcoMeshType::CoordType ( 1, 0,-L), - IcoMeshType::CoordType (-1, 0,-L) + CoordType ( L, 1, 0), + CoordType ( L,-1, 0), + CoordType (-L, 1, 0), + CoordType (-L,-1, 0), + + CoordType ( 1, 0, L), + CoordType (-1, 0, L), + CoordType ( 1, 0,-L), + CoordType (-1, 0,-L) }; int ff[20][3]={ @@ -124,16 +146,16 @@ void Icosahedron(IcoMeshType &in) in.Clear(); Allocator::AddVertices(in,12); Allocator::AddFaces(in,20); - IcoMeshType::VertexPointer ivp[12]; + VertexPointer ivp[12]; - IcoMeshType::VertexIterator vi; + VertexIterator vi; int i; for(i=0,vi=in.vert.begin();vi!=in.vert.end();++i,++vi){ (*vi).P()=vv[i]; ivp[i]=&*vi; } - IcoMeshType::FaceIterator fi; + FaceIterator fi; for(i=0,fi=in.face.begin();fi!=in.face.end();++i,++fi){ (*fi).V(0)=ivp[ff[i][0]]; (*fi).V(1)=ivp[ff[i][1]]; @@ -141,165 +163,126 @@ void Icosahedron(IcoMeshType &in) } } -template -void Hexahedron(MESH_TYPE &in) +template +void Hexahedron(MeshType &in) { - in.vn=8; - in.fn=12; - in.vert.clear(); - in.face.clear(); - MESH_TYPE::VertexType tv;tv.Supervisor_Flags()=0; - MESH_TYPE::CoordType tp; - tp=MESH_TYPE::CoordType (-1,-1,-1); tv.P()=tp; in.vert.push_back(tv); - tp=MESH_TYPE::CoordType ( 1,-1,-1); tv.P()=tp; in.vert.push_back(tv); - tp=MESH_TYPE::CoordType (-1, 1,-1); tv.P()=tp; in.vert.push_back(tv); - tp=MESH_TYPE::CoordType ( 1, 1,-1); tv.P()=tp; in.vert.push_back(tv); - tp=MESH_TYPE::CoordType (-1,-1, 1); tv.P()=tp; in.vert.push_back(tv); - tp=MESH_TYPE::CoordType ( 1,-1, 1); tv.P()=tp; in.vert.push_back(tv); - tp=MESH_TYPE::CoordType (-1, 1, 1); tv.P()=tp; in.vert.push_back(tv); - tp=MESH_TYPE::CoordType ( 1, 1, 1); tv.P()=tp; in.vert.push_back(tv); - - vector index(in.vn); - - MESH_TYPE::face_type f;f.Supervisor_Flags()=0; - - MESH_TYPE::vertex_iterator vi; - int j; - for(j=0,vi=in.vert.begin();j::AddVertices(in,8); + Allocator::AddFaces(in,12); - f.V(0)=index[7]; f.V(1)=index[5];f.V(2)=index[6]; in.face.push_back(f); - f.V(0)=index[4]; f.V(1)=index[6];f.V(2)=index[5]; in.face.push_back(f); + VertexPointer ivp[8]; - f.V(0)=index[7]; f.V(1)=index[6];f.V(2)=index[3]; in.face.push_back(f); - f.V(0)=index[2]; f.V(1)=index[3];f.V(2)=index[6]; in.face.push_back(f); + VertexIterator vi=in.vert.begin(); + ivp[0]=&*vi;(*vi).P()=CoordType (-1,-1,-1); ++vi; + ivp[1]=&*vi;(*vi).P()=CoordType ( 1,-1,-1); ++vi; + ivp[2]=&*vi;(*vi).P()=CoordType (-1, 1,-1); ++vi; + ivp[3]=&*vi;(*vi).P()=CoordType ( 1, 1,-1); ++vi; + ivp[3]=&*vi;(*vi).P()=CoordType (-1,-1, 1); ++vi; + ivp[3]=&*vi;(*vi).P()=CoordType ( 1,-1, 1); ++vi; + ivp[4]=&*vi;(*vi).P()=CoordType (-1, 1, 1); ++vi; + ivp[5]=&*vi;(*vi).P()=CoordType ( 1, 1, 1); - f.V(0)=index[7]; f.V(1)=index[3];f.V(2)=index[5]; in.face.push_back(f); - f.V(0)=index[1]; f.V(1)=index[5];f.V(2)=index[3]; in.face.push_back(f); + FaceIterator fi=in.face.begin(); + (*fi).V(0)=ivp[0]; (*fi).V(1)=ivp[1]; (*fi).V(2)=ivp[2]; ++fi; + (*fi).V(0)=ivp[3]; (*fi).V(1)=ivp[2]; (*fi).V(2)=ivp[1]; ++fi; + (*fi).V(0)=ivp[0]; (*fi).V(1)=ivp[2]; (*fi).V(2)=ivp[4]; ++fi; + (*fi).V(0)=ivp[6]; (*fi).V(1)=ivp[4]; (*fi).V(2)=ivp[2]; ++fi; + (*fi).V(0)=ivp[0]; (*fi).V(1)=ivp[4]; (*fi).V(2)=ivp[1]; ++fi; + (*fi).V(0)=ivp[5]; (*fi).V(1)=ivp[1]; (*fi).V(2)=ivp[4]; ++fi; + (*fi).V(0)=ivp[7]; (*fi).V(1)=ivp[5]; (*fi).V(2)=ivp[6]; ++fi; + (*fi).V(0)=ivp[4]; (*fi).V(1)=ivp[6]; (*fi).V(2)=ivp[5]; ++fi; + (*fi).V(0)=ivp[7]; (*fi).V(1)=ivp[6]; (*fi).V(2)=ivp[3]; ++fi; + (*fi).V(0)=ivp[2]; (*fi).V(1)=ivp[3]; (*fi).V(2)=ivp[6]; ++fi; + (*fi).V(0)=ivp[7]; (*fi).V(1)=ivp[3]; (*fi).V(2)=ivp[5]; ++fi; + (*fi).V(0)=ivp[1]; (*fi).V(1)=ivp[5]; (*fi).V(2)=ivp[3]; } -template -void HalfOctahedron(MESH_TYPE &in) +template +void Square(MeshType &in) { - in.vn=5; - in.fn=4; - in.vert.clear(); - in.face.clear(); - MESH_TYPE::VertexType tv;tv.Supervisor_Flags()=0; - MESH_TYPE::CoordType tp; - tp=MESH_TYPE::CoordType ( 1, 0, 0); tv.P()=tp; in.vert.push_back(tv); - tp=MESH_TYPE::CoordType ( 0, 1, 0); tv.P()=tp; in.vert.push_back(tv); - tp=MESH_TYPE::CoordType ( 0, 0, 1); tv.P()=tp; in.vert.push_back(tv); - tp=MESH_TYPE::CoordType (-1, 0, 0); tv.P()=tp; in.vert.push_back(tv); - tp=MESH_TYPE::CoordType ( 0,-1, 0); tv.P()=tp; in.vert.push_back(tv); + typedef typename MeshType::ScalarType ScalarType; + typedef typename MeshType::CoordType CoordType; + typedef typename MeshType::VertexPointer VertexPointer; + typedef typename MeshType::VertexIterator VertexIterator; + typedef typename MeshType::FaceIterator FaceIterator; - vector index(in.vn); - - MESH_TYPE::face_type f;f.Supervisor_Flags()=0; - - MESH_TYPE::vertex_iterator vi; - int j; - for(j=0,vi=in.vert.begin();j::AddVertices(in,4); + Allocator::AddFaces(in,2); - f.V(0)=index[0]; f.V(1)=index[1];f.V(2)=index[2]; in.face.push_back(f); - f.V(0)=index[0]; f.V(1)=index[2];f.V(2)=index[4]; in.face.push_back(f); - //f.V(0)=index[0]; f.V(1)=index[4];f.V(2)=index[5]; in.face.push_back(f); - //f.V(0)=index[0]; f.V(1)=index[5];f.V(2)=index[1]; in.face.push_back(f); - //f.V(0)=index[3]; f.V(1)=index[1];f.V(2)=index[5]; in.face.push_back(f); - //f.V(0)=index[3]; f.V(1)=index[5];f.V(2)=index[4]; in.face.push_back(f); - f.V(0)=index[3]; f.V(1)=index[4];f.V(2)=index[2]; in.face.push_back(f); - f.V(0)=index[3]; f.V(1)=index[2];f.V(2)=index[1]; in.face.push_back(f); + VertexPointer ivp[4]; + + VertexIterator vi=in.vert.begin(); + ivp[0]=&*vi;(*vi).P()=CoordType ( 1, 0, 0); ++vi; + ivp[1]=&*vi;(*vi).P()=CoordType ( 0, 1, 0); ++vi; + ivp[2]=&*vi;(*vi).P()=CoordType (-1, 0, 0); ++vi; + ivp[5]=&*vi;(*vi).P()=CoordType ( 0,-1, 0); + + FaceIterator fi=in.face.begin(); + (*fi).V(0)=ivp[0]; (*fi).V(1)=ivp[1]; (*fi).V(2)=ivp[2]; ++fi; + (*fi).V(0)=ivp[0]; (*fi).V(1)=ivp[2]; (*fi).V(2)=ivp[3]; } -template -void Square(MESH_TYPE &in) -{ - in.vn=4; - in.fn=2; - in.vert.clear(); - in.face.clear(); - MESH_TYPE::VertexType tv;tv.Supervisor_Flags()=0; - MESH_TYPE::CoordType tp; - tp=MESH_TYPE::CoordType ( 1, 0, 0); tv.P()=tp; in.vert.push_back(tv); - tp=MESH_TYPE::CoordType ( 0, 1, 0); tv.P()=tp; in.vert.push_back(tv); - tp=MESH_TYPE::CoordType (-1, 0, 0); tv.P()=tp; in.vert.push_back(tv); - tp=MESH_TYPE::CoordType ( 0,-1, 0); tv.P()=tp; in.vert.push_back(tv); - - vector index(in.vn); - - MESH_TYPE::face_type f;f.Supervisor_Flags()=0; - - MESH_TYPE::vertex_iterator vi; - int j; - for(j=0,vi=in.vert.begin();j -void Sphere(MESH_TYPE &in, const int subdiv = 3 ) -{ - Icosahedron(in); - in.ComputeBorderFlag(); - int lastsize = 0; - for(int i=0;i >(in,MidPoint(),0); - MESH_TYPE::vertex_iterator vi; - - for(vi = in.vert.begin()+lastsize;vi!=in.vert.end();++vi) - vi->P().Normalize(); - - lastsize = in.vert.size(); - } -} +//template +//void Sphere(MESH_TYPE &in, const int subdiv = 3 ) +//{ +// Icosahedron(in); +// in.ComputeBorderFlag(); +// int lastsize = 0; +// for(int i=0;i >(in,MidPoint(),0); +// MESH_TYPE::vertex_iterator 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) -template -void Cone( MESH_TYPE & in, - const typename MESH_TYPE::ScalarType r1, - const typename MESH_TYPE::ScalarType r2, - const typename MESH_TYPE::ScalarType h ) +template +void Cone( MeshType& in, + const typename MeshType::ScalarType r1, + const typename MeshType::ScalarType r2, + const typename MeshType::ScalarType h ) { - const int D = 24; + typedef typename MeshType::ScalarType ScalarType; + typedef typename MeshType::CoordType CoordType; + typedef typename MeshType::VertexPointer VertexPointer; + typedef typename MeshType::VertexIterator VertexIterator; + typedef typename MeshType::FaceIterator FaceIterator; + + const int D = 24; int i,b1,b2; - - if(r1==0 || r2==0) - { - in.vn=D+2; - in.fn=D*2; - } - else - { - in.vn=D*2+2; - in.fn=D*4; + in.Clear(); + int VN,FN; + if(r1==0 || r2==0) { + VN=D+2; + FN=D*2; + } else { + VN=D*2+2; + FN=D*4; } - in.vert.clear(); - in.face.clear(); - - MESH_TYPE::VertexType tv;tv.Supervisor_Flags()=0; - MESH_TYPE::CoordType tp; - - tp=MESH_TYPE::CoordType ( 0,-h/2,0 ); - tv.P()=tp; - in.vert.push_back(tv); - - tp=MESH_TYPE::CoordType ( 0, h/2,0 ); - tv.P()=tp; - in.vert.push_back(tv); + Allocator::AddVertices(in,VN); + Allocator::AddFaces(in,FN); + VertexPointer ivp[VN]; + VertexIterator vi=in.vert.begin(); + ivp[0]=&*vi;(*vi).P()=CoordType ( 0,-h/2,0 ); ++vi; + ivp[1]=&*vi;(*vi).P()=CoordType ( 0, h/2,0 ); ++vi; + b1 = b2 = 2; - + int cnt=2; if(r1!=0) { for(i=0;i index(in.vn); - MESH_TYPE::face_type f; - f.Supervisor_Flags()=0; + FaceIterator fi=in.face.begin(); + + if(r1!=0) for(i=0;i -void Box(MESH_TYPE &in, const typename MESH_TYPE::BoxType & bb ) +template +void Box(MeshType &in, const typename MeshType::BoxType & bb ) { - in.vn=8; - in.fn=12; - in.vert.clear(); - in.face.clear(); - MESH_TYPE::VertexType tv;tv.Supervisor_Flags()=0; - MESH_TYPE::CoordType tp; - tp=MESH_TYPE::CoordType (bb.min[0],bb.min[1],bb.min[2]); tv.P()=tp; in.vert.push_back(tv); - tp=MESH_TYPE::CoordType (bb.max[0],bb.min[1],bb.min[2]); tv.P()=tp; in.vert.push_back(tv); - tp=MESH_TYPE::CoordType (bb.min[0],bb.max[1],bb.min[2]); tv.P()=tp; in.vert.push_back(tv); - tp=MESH_TYPE::CoordType (bb.max[0],bb.max[1],bb.min[2]); tv.P()=tp; in.vert.push_back(tv); - tp=MESH_TYPE::CoordType (bb.min[0],bb.min[1],bb.max[2]); tv.P()=tp; in.vert.push_back(tv); - tp=MESH_TYPE::CoordType (bb.max[0],bb.min[1],bb.max[2]); tv.P()=tp; in.vert.push_back(tv); - tp=MESH_TYPE::CoordType (bb.min[0],bb.max[1],bb.max[2]); tv.P()=tp; in.vert.push_back(tv); - tp=MESH_TYPE::CoordType (bb.max[0],bb.max[1],bb.max[2]); tv.P()=tp; in.vert.push_back(tv); - - vector index(in.vn); - - MESH_TYPE::face_type f;f.Supervisor_Flags()=0; - - MESH_TYPE::vertex_iterator vi; - int j; - for(j=0,vi=in.vert.begin();j::AddVertices(in,8); + Allocator::AddFaces(in,12); - f.V(0)=index[7]; f.V(1)=index[5];f.V(2)=index[6]; in.face.push_back(f); - f.V(0)=index[4]; f.V(1)=index[6];f.V(2)=index[5]; in.face.push_back(f); + VertexPointer ivp[8]; - f.V(0)=index[7]; f.V(1)=index[6];f.V(2)=index[3]; in.face.push_back(f); - f.V(0)=index[2]; f.V(1)=index[3];f.V(2)=index[6]; in.face.push_back(f); + VertexIterator vi=in.vert.begin(); + ivp[0]=&*vi;(*vi).P()=CoordType (bb.min[0],bb.min[1],bb.min[2]); ++vi; + ivp[1]=&*vi;(*vi).P()=CoordType (bb.max[0],bb.min[1],bb.min[2]); ++vi; + ivp[2]=&*vi;(*vi).P()=CoordType (bb.min[0],bb.max[1],bb.min[2]); ++vi; + ivp[3]=&*vi;(*vi).P()=CoordType (bb.max[0],bb.max[1],bb.min[2]); ++vi; + ivp[3]=&*vi;(*vi).P()=CoordType (bb.min[0],bb.min[1],bb.max[2]); ++vi; + ivp[3]=&*vi;(*vi).P()=CoordType (bb.max[0],bb.min[1],bb.max[2]); ++vi; + ivp[4]=&*vi;(*vi).P()=CoordType (bb.min[0],bb.max[1],bb.max[2]); ++vi; + ivp[5]=&*vi;(*vi).P()=CoordType (bb.max[0],bb.max[1],bb.max[2]); - f.V(0)=index[7]; f.V(1)=index[3];f.V(2)=index[5]; in.face.push_back(f); - f.V(0)=index[1]; f.V(1)=index[5];f.V(2)=index[3]; in.face.push_back(f); + FaceIterator fi=in.face.begin(); + (*fi).V(0)=ivp[0]; (*fi).V(1)=ivp[1]; (*fi).V(2)=ivp[2]; ++fi; + (*fi).V(0)=ivp[3]; (*fi).V(1)=ivp[2]; (*fi).V(2)=ivp[1]; ++fi; + (*fi).V(0)=ivp[0]; (*fi).V(1)=ivp[2]; (*fi).V(2)=ivp[4]; ++fi; + (*fi).V(0)=ivp[6]; (*fi).V(1)=ivp[4]; (*fi).V(2)=ivp[2]; ++fi; + (*fi).V(0)=ivp[0]; (*fi).V(1)=ivp[4]; (*fi).V(2)=ivp[1]; ++fi; + (*fi).V(0)=ivp[5]; (*fi).V(1)=ivp[1]; (*fi).V(2)=ivp[4]; ++fi; + (*fi).V(0)=ivp[7]; (*fi).V(1)=ivp[5]; (*fi).V(2)=ivp[6]; ++fi; + (*fi).V(0)=ivp[4]; (*fi).V(1)=ivp[6]; (*fi).V(2)=ivp[5]; ++fi; + (*fi).V(0)=ivp[7]; (*fi).V(1)=ivp[6]; (*fi).V(2)=ivp[3]; ++fi; + (*fi).V(0)=ivp[2]; (*fi).V(1)=ivp[3]; (*fi).V(2)=ivp[6]; ++fi; + (*fi).V(0)=ivp[7]; (*fi).V(1)=ivp[3]; (*fi).V(2)=ivp[5]; ++fi; + (*fi).V(0)=ivp[1]; (*fi).V(1)=ivp[5]; (*fi).V(2)=ivp[3]; } + /// Questa funzione costruisce una mesh a partire da un insieme di coordiante /// ed un insieme di terne di indici di vertici