improved documentation. Added new allocator methods and clarified a bit how to delete elements

This commit is contained in:
Paolo Cignoni 2013-12-04 17:26:38 +00:00
parent d63fba2214
commit ce859f666e
2 changed files with 11 additions and 1 deletions

View File

@ -49,7 +49,7 @@ int main()
MyMesh::VertexIterator vi = vcg::tri::Allocator<MyMesh>::AddVertices(m,3);
MyMesh::FaceIterator fi = vcg::tri::Allocator<MyMesh>::AddFaces(m,1);
MyMesh::VertexPointer ivp[3];
MyMesh::VertexPointer ivp[4];
ivp[0]=&*vi; vi->P()=MyMesh::CoordType ( 0.0, 0.0, 0.0); ++vi;
ivp[1]=&*vi; vi->P()=MyMesh::CoordType ( 1.0, 0.0, 0.0); ++vi;
ivp[2]=&*vi; vi->P()=MyMesh::CoordType ( 0.0, 1.0, 0.0); ++vi;
@ -58,6 +58,12 @@ int main()
fi->V(1)=ivp[1];
fi->V(2)=ivp[2];
// Alternative, more compact, method for adding a single vertex
ivp[3]=vcg::tri::Allocator<MyMesh>::AddVertex(m,MyMesh::CoordType ( 1.0, 1.0, 0.0));
// Alternative, more compact, method for adding a single face (once you have the vertex pointers)
vcg::tri::Allocator<MyMesh>::AddFace(m, ivp[1],ivp[0],ivp[3]);
// a potentially dangerous pointer to a mesh element
MyMesh::FacePointer fp = &m.face[0];
vcg::tri::Allocator<MyMesh>::PointerUpdater<MyMesh::FacePointer> pu;
@ -96,6 +102,9 @@ int main()
vcg::tri::Allocator<MyMesh>::CompactFaceVector(m);
vcg::tri::Allocator<MyMesh>::CompactVertexVector(m);
// To clean all the containers from deleted elements
vcg::tri::Allocator<MyMesh>::CompactEveryVector(m);
// finally lets copy this mesh onto another one.
MyMesh m2;
vcg::tri::Append<MyMesh,MyMesh>::MeshCopy(m2,m);

View File

@ -68,6 +68,7 @@ int main( int argc, char **argv )
exit(0);
}
vcg::tri::RequirePerVertexNormal(m);
vcg::tri::UpdateNormal<MyMesh>::PerVertexNormalized(m);
printf("Input mesh vn:%i fn:%i\n",m.VN(),m.FN());
printf( "Mesh has %i vert and %i faces\n", m.VN(), m.FN() );