updated samples to the vertexplus faceplus style
This commit is contained in:
parent
425a82938f
commit
7f3c65238c
|
@ -5,8 +5,12 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
// vcg headers
|
// vcg headers
|
||||||
#include<vcg/simplex/vertex/vertex.h>
|
//#include<vcg/simplex/vertex/vertex.h>
|
||||||
#include<vcg/simplex/face/with/rtfmfn.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/simplex/face/distance.h>
|
||||||
#include<vcg/complex/trimesh/base.h>
|
#include<vcg/complex/trimesh/base.h>
|
||||||
#include <vcg/complex/trimesh/create/platonic.h>
|
#include <vcg/complex/trimesh/create/platonic.h>
|
||||||
|
@ -19,10 +23,16 @@
|
||||||
|
|
||||||
typedef float AScalarType;
|
typedef float AScalarType;
|
||||||
|
|
||||||
|
using namespace vcg;
|
||||||
|
|
||||||
class AEdge;
|
class AEdge;
|
||||||
class AFace;
|
class AFace;
|
||||||
class AVertex : public vcg::Vertex< AScalarType, AEdge, AFace > { };
|
class AVertex : public VertexSimp2< AVertex, AEdge, AFace, vert::Normal3f, vert::Coord3f >{};
|
||||||
class AFace : public vcg::FaceRTFMFN< AVertex, AEdge, AFace > { };
|
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> > { };
|
class AMesh : public vcg::tri::TriMesh< std::vector<AVertex>, std::vector<AFace> > { };
|
||||||
|
|
||||||
typedef vcg::AABBBinaryTreeIndex<AFace, AScalarType, vcg::EmptyClass> AIndex;
|
typedef vcg::AABBBinaryTreeIndex<AFace, AScalarType, vcg::EmptyClass> AIndex;
|
||||||
|
|
|
@ -10,8 +10,8 @@
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace vcg;
|
using namespace vcg;
|
||||||
|
|
||||||
#include <vcg/simplex/vertex/vertex.h>
|
#include <vcg/simplex/vertexplus/base.h>
|
||||||
#include <vcg/simplex/face/face.h>
|
#include <vcg/simplex/faceplus/base.h>
|
||||||
#include <vcg/complex/trimesh/base.h>
|
#include <vcg/complex/trimesh/base.h>
|
||||||
#include <vcg/complex/trimesh/allocate.h>
|
#include <vcg/complex/trimesh/allocate.h>
|
||||||
|
|
||||||
|
@ -19,8 +19,13 @@ typedef float ScalarType;
|
||||||
|
|
||||||
class MyEdge;
|
class MyEdge;
|
||||||
class MyFace;
|
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 > > {};
|
class MyMesh : public vcg::tri::TriMesh< std::vector< MyVertex>, std::vector< MyFace > > {};
|
||||||
|
|
||||||
template <class VOX_TYPE>
|
template <class VOX_TYPE>
|
||||||
|
@ -118,7 +123,7 @@ public:
|
||||||
|
|
||||||
typedef Volume<SimpleVoxel> MyVolume;
|
typedef Volume<SimpleVoxel> MyVolume;
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int /*argc*/ , char /**argv[]*/)
|
||||||
{
|
{
|
||||||
MyVolume volume;
|
MyVolume volume;
|
||||||
|
|
||||||
|
@ -132,7 +137,7 @@ int main(int argc, char *argv[])
|
||||||
for(int i=0;i<64;i++)
|
for(int i=0;i<64;i++)
|
||||||
for(int j=0;j<64;j++)
|
for(int j=0;j<64;j++)
|
||||||
for(int k=0;k<64;k++)
|
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
|
// MARCHING CUBES
|
||||||
|
|
|
@ -59,8 +59,8 @@ int main(int argc,char **argv )
|
||||||
printf("Error in parsing bbox option");
|
printf("Error in parsing bbox option");
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
ClipBB.min[0]=atof(argv[i+1]); ClipBB.min[1]=atof(argv[i+2]); ClipBB.min[2]=atof(argv[i+3]);
|
ClipBB.min=Point3f::Construct(atof(argv[i+1]),atof(argv[i+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.max=Point3f::Construct(atof(argv[i+4]),atof(argv[i+5]),atof(argv[i+6]));
|
||||||
i+=6;
|
i+=6;
|
||||||
printf("Clipping incoming meshes with box:\n (%7.4f %7.4f %7.4f) - (%7.4f %7.4f %7.4f)\n",
|
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],
|
ClipBB.min[0],ClipBB.min[1],ClipBB.min[2],
|
||||||
|
|
|
@ -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 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 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)
|
int main(int argc,char ** argv)
|
||||||
{
|
{
|
||||||
if(argc<3)
|
if(argc<4)
|
||||||
{
|
{
|
||||||
printf("Usage: trimesh_smooth <filename> <steps> <sigma> <fitstep>\n");
|
printf("Usage: trimesh_smooth <filename> <steps> <sigma> <fitstep>\n");
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -48,17 +41,18 @@ if(argc<3)
|
||||||
|
|
||||||
//open a mesh
|
//open a mesh
|
||||||
int err = tri::io::Importer<MyMesh>::Open(m,argv[1]);
|
int err = tri::io::Importer<MyMesh>::Open(m,argv[1]);
|
||||||
if(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));
|
printf("Error in reading %s: '%s'\n",argv[1], tri::io::Importer<MyMesh>::ErrorMsg(err));
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// some cleaning to get rid of bad file formats like stl that duplicate vertexes..
|
// some cleaning to get rid of bad file formats like stl that duplicate vertexes..
|
||||||
int dup = tri::Clean<MyMesh>::RemoveDuplicateVertex(m);
|
int dup = tri::Clean<MyMesh>::RemoveDuplicateVertex(m);
|
||||||
int unref = tri::Clean<MyMesh>::RemoveUnreferencedVertex(m);
|
int unref = tri::Clean<MyMesh>::RemoveUnreferencedVertex(m);
|
||||||
printf("Removed %i duplicate and %i unreferenced vertices from mesh %s\n",dup,unref,argv[1]);
|
printf("Removed %i duplicate and %i unreferenced vertices from mesh %s\n",dup,unref,argv[1]);
|
||||||
int Step= atoi(argv[2]);
|
int Step= atoi(argv[2]);
|
||||||
|
|
||||||
tri::UpdateTopology<MyMesh>::VertexFace(m);
|
tri::UpdateTopology<MyMesh>::VertexFace(m);
|
||||||
tri::UpdateNormals<MyMesh>::PerFaceNormalized(m);
|
|
||||||
|
|
||||||
for(int i=0;i<Step;++i)
|
for(int i=0;i<Step;++i)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include<vcg/simplex/vertex/vertex.h>
|
#include<vcg/simplex/vertexplus/base.h>
|
||||||
#include<vcg/simplex/face/with/affm.h>
|
#include<vcg/simplex/faceplus/base.h>
|
||||||
#include<vcg/simplex/face/topology.h>
|
#include<vcg/simplex/face/topology.h>
|
||||||
#include<vcg/complex/trimesh/base.h>
|
#include<vcg/complex/trimesh/base.h>
|
||||||
#include<vcg/complex/trimesh/create/platonic.h>
|
#include<vcg/complex/trimesh/create/platonic.h>
|
||||||
|
@ -16,10 +16,17 @@
|
||||||
|
|
||||||
using namespace vcg;
|
using namespace vcg;
|
||||||
|
|
||||||
|
class MyEdge; // dummy prototype never used
|
||||||
class MyFace;
|
class MyFace;
|
||||||
class MyEdge;
|
class MyVertex;
|
||||||
class MyVertex:public Vertex<float,MyEdge,MyFace>{};
|
|
||||||
class MyFace : public FaceAFFM<MyVertex,MyEdge,MyFace>{};
|
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 > >{};
|
class MyMesh : public tri::TriMesh< std::vector<MyVertex>, std::vector<MyFace > >{};
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue