updated samples to the vertexplus faceplus style

This commit is contained in:
Paolo Cignoni 2006-10-13 13:17:23 +00:00
parent 425a82938f
commit 7f3c65238c
5 changed files with 45 additions and 29 deletions

View File

@ -5,8 +5,12 @@
#include <vector>
// vcg headers
#include<vcg/simplex/vertex/vertex.h>
#include<vcg/simplex/face/with/rtfmfn.h>
//#include<vcg/simplex/vertex/vertex.h>
//#include<vcg/simplex/face/with/rtfmfn.h>
#include<vcg/simplex/vertexplus/base.h>
#include<vcg/simplex/faceplus/base.h>
#include<vcg/simplex/faceplus/component_rt.h>
#include<vcg/simplex/face/distance.h>
#include<vcg/complex/trimesh/base.h>
#include <vcg/complex/trimesh/create/platonic.h>
@ -19,10 +23,16 @@
typedef float AScalarType;
using namespace vcg;
class AEdge;
class AFace;
class AVertex : public vcg::Vertex< AScalarType, AEdge, AFace > { };
class AFace : public vcg::FaceRTFMFN< AVertex, AEdge, AFace > { };
class AVertex : public VertexSimp2< AVertex, AEdge, AFace, vert::Normal3f, vert::Coord3f >{};
class AFace : public FaceSimp2< AVertex, AEdge, AFace, face::VertexRef, face::Normal3f, face::RTInfo, face::BitFlags> {};
//class AVertex : public vcg::Vertex< AScalarType, AEdge, AFace > { };
//class AFace : public vcg::FaceRTFMFN< AVertex, AEdge, AFace > { };
class AMesh : public vcg::tri::TriMesh< std::vector<AVertex>, std::vector<AFace> > { };
typedef vcg::AABBBinaryTreeIndex<AFace, AScalarType, vcg::EmptyClass> AIndex;

View File

@ -10,8 +10,8 @@
using namespace std;
using namespace vcg;
#include <vcg/simplex/vertex/vertex.h>
#include <vcg/simplex/face/face.h>
#include <vcg/simplex/vertexplus/base.h>
#include <vcg/simplex/faceplus/base.h>
#include <vcg/complex/trimesh/base.h>
#include <vcg/complex/trimesh/allocate.h>
@ -19,8 +19,13 @@ typedef float ScalarType;
class MyEdge;
class MyFace;
class MyVertex : public vcg::Vertex< ScalarType, MyEdge, MyFace > {};
class MyFace : public vcg::Face< MyVertex, MyEdge, MyFace> {};
class MyVertex : public VertexSimp2< MyVertex, MyEdge, MyFace, vert::Coord3f>{};
class MyFace : public FaceSimp2< MyVertex, MyEdge, MyFace, face::VertexRef, face::BitFlags> {};
//class MyVertex : public vcg::Vertex< ScalarType, MyEdge, MyFace > {};
//class MyFace : public vcg::Face< MyVertex, MyEdge, MyFace> {};
class MyMesh : public vcg::tri::TriMesh< std::vector< MyVertex>, std::vector< MyFace > > {};
template <class VOX_TYPE>
@ -118,7 +123,7 @@ public:
typedef Volume<SimpleVoxel> MyVolume;
int main(int argc, char *argv[])
int main(int /*argc*/ , char /**argv[]*/)
{
MyVolume volume;
@ -132,7 +137,7 @@ int main(int argc, char *argv[])
for(int i=0;i<64;i++)
for(int j=0;j<64;j++)
for(int k=0;k<64;k++)
volume.Val(i,j,k)=(j-32)*(j-32)+(k-32)*(k-32) + i*10*math::Perlin::Noise(i*.2,j*.2,k*.2);
volume.Val(i,j,k)=(j-32)*(j-32)+(k-32)*(k-32) + i*10*(float)math::Perlin::Noise(i*.2,j*.2,k*.2);
// MARCHING CUBES

View File

@ -59,8 +59,8 @@ int main(int argc,char **argv )
printf("Error in parsing bbox option");
exit(0);
}
ClipBB.min[0]=atof(argv[i+1]); ClipBB.min[1]=atof(argv[i+2]); ClipBB.min[2]=atof(argv[i+3]);
ClipBB.max[0]=atof(argv[i+4]); ClipBB.max[1]=atof(argv[i+5]); ClipBB.max[2]=atof(argv[i+6]);
ClipBB.min=Point3f::Construct(atof(argv[i+1]),atof(argv[i+2]),atof(argv[i+3]));
ClipBB.max=Point3f::Construct(atof(argv[i+4]),atof(argv[i+5]),atof(argv[i+6]));
i+=6;
printf("Clipping incoming meshes with box:\n (%7.4f %7.4f %7.4f) - (%7.4f %7.4f %7.4f)\n",
ClipBB.min[0],ClipBB.min[1],ClipBB.min[2],

View File

@ -29,16 +29,9 @@ class MyVertex : public VertexSimp2< MyVertex, MyEdge, MyFace, vert::VFAdj, ver
class MyFace : public FaceSimp2 < MyVertex, MyEdge, MyFace, face::VFAdj, face::Normal3f, face::VertexRef, face::BitFlags > {};
class MyMesh : public vcg::tri::TriMesh<vector<MyVertex>, vector<MyFace> > {};
//class MyFace;
//class MyEdge;
//class MyVertex:public Vertex<float,MyEdge,MyFace>{};
//class MyFace :public FaceFN<MyVertex,MyEdge,MyFace>{};
//class MyMesh: public tri::TriMesh< std::vector<MyVertex>, std::vector<MyFace > >{};
//
int main(int argc,char ** argv)
{
if(argc<3)
if(argc<4)
{
printf("Usage: trimesh_smooth <filename> <steps> <sigma> <fitstep>\n");
return 0;
@ -48,18 +41,19 @@ if(argc<3)
//open a mesh
int err = tri::io::Importer<MyMesh>::Open(m,argv[1]);
if(err) {
printf("Error in reading %s: '%s'\n",argv[1],tri::io::Importer<MyMesh>::ErrorMsg(err));
if(err) { // all the importers return 0 in case of success
printf("Error in reading %s: '%s'\n",argv[1], tri::io::Importer<MyMesh>::ErrorMsg(err));
exit(-1);
}
// some cleaning to get rid of bad file formats like stl that duplicate vertexes..
int dup = tri::Clean<MyMesh>::RemoveDuplicateVertex(m);
int unref = tri::Clean<MyMesh>::RemoveUnreferencedVertex(m);
printf("Removed %i duplicate and %i unreferenced vertices from mesh %s\n",dup,unref,argv[1]);
int Step= atoi(argv[2]);
tri::UpdateTopology<MyMesh>::VertexFace(m);
tri::UpdateNormals<MyMesh>::PerFaceNormalized(m);
for(int i=0;i<Step;++i)
{
tri::UpdateNormals<MyMesh>::PerFaceNormalized(m);

View File

@ -1,7 +1,7 @@
#include <vector>
#include<vcg/simplex/vertex/vertex.h>
#include<vcg/simplex/face/with/affm.h>
#include<vcg/simplex/vertexplus/base.h>
#include<vcg/simplex/faceplus/base.h>
#include<vcg/simplex/face/topology.h>
#include<vcg/complex/trimesh/base.h>
#include<vcg/complex/trimesh/create/platonic.h>
@ -16,10 +16,17 @@
using namespace vcg;
class MyEdge; // dummy prototype never used
class MyFace;
class MyEdge;
class MyVertex:public Vertex<float,MyEdge,MyFace>{};
class MyFace : public FaceAFFM<MyVertex,MyEdge,MyFace>{};
class MyVertex;
class MyVertex : public VertexSimp2< MyVertex, MyEdge, MyFace, vert::Coord3f, vert::BitFlags >{};
class MyFace : public FaceSimp2 < MyVertex, MyEdge, MyFace, face::VertexRef,face::FFAdj, face::Mark, face::BitFlags > {};
//class MyVertex:public Vertex<float,MyEdge,MyFace>{};
//class MyFace : public FaceAFFM<MyVertex,MyEdge,MyFace>{};
class MyMesh : public tri::TriMesh< std::vector<MyVertex>, std::vector<MyFace > >{};