vcglib/apps/test/trimesh/main.cpp

82 lines
2.8 KiB
C++
Raw Normal View History

2004-03-05 13:10:15 +01:00
#pragma warning(disable : 4267)
#include <stdio.h>
#include <vector>
#include<vcg/math/base.h>
#include<vcg/space/point3.h>
#include<vcg/space/point4.h>
#include<vcg/space/color4.h>
#include<vcg/simplex/vertex/with/n.h>
2004-03-10 02:00:21 +01:00
#include<vcg/simplex/vertex/with/cn.h>
2004-03-05 13:10:15 +01:00
#include<vcg/simplex/face/with/fn.h>
2004-03-10 02:00:21 +01:00
#include<vcg/simplex/face/with/fafc.h>
2004-03-18 17:00:10 +01:00
#include<vcg/simplex/face/pos.h>
2004-03-05 13:10:15 +01:00
#include<vcg/complex/trimesh/base.h>
#include<vcg/complex/trimesh/platonic.h>
2004-03-10 02:00:21 +01:00
#include<vcg/complex/trimesh/update/flag.h>
2004-03-05 13:10:15 +01:00
#include<vcg/complex/trimesh/update/normal.h>
#include<vcg/complex/trimesh/update/topology.h>
#include<vcg/complex/trimesh/update/color.h>
#include<wrap/io_trimesh/export_stl.h>
#include<wrap/io_trimesh/import_ply.h>
2004-03-18 17:00:10 +01:00
#include<wrap/io_trimesh/import_stl.h>
2004-03-10 02:00:21 +01:00
#include<wrap/io_trimesh/export_ply.h>
2004-03-05 13:10:15 +01:00
using namespace vcg;
using namespace std;
//using namespace tri;
int main(int argc, char *argv[])
{
printf("Hello Library!\n");
VertexNf vnf;
VertexNd vnd;
FaceFN<VertexNf> fnf;
FaceFN<VertexNd> fnd;
2004-03-10 02:00:21 +01:00
typedef tri::TriMesh< vector<VertexCNf>, vector< FaceFAFC<VertexCNf> > > MyMeshAdj;
2004-03-05 13:10:15 +01:00
MyMeshAdj ta;
printf("Sizeof(VertexNf) = %i (%i + %i + %i)\n",sizeof(VertexNf),sizeof(Point3f),sizeof(int),sizeof(Point3f));
printf("Sizeof(VertexNd) = %i (%i + %i + %i) \n",sizeof(VertexNd),sizeof(Point3d),sizeof(int),sizeof(Point3d));
printf("Sizeof(FaceFN<VertexNf>) = %i \n",sizeof(FaceFN<VertexNf>));
2004-03-10 02:00:21 +01:00
//printf("Sizeof(FaceFA<VertexCNd>) = %i \n",sizeof(FaceFA<VertexCNd>));
2004-03-05 13:10:15 +01:00
2004-03-18 17:00:10 +01:00
typedef tri::TriMesh< vector<VertexNf>, vector< FaceFN<VertexNf> > > MyMesh;
MyMesh tm;
tri::Tetrahedron(tm);
tri::io::ExporterPLY<MyMesh>::Save(tm,"Tetrabin.ply");
tri::Octahedron(tm);
tri::io::ExporterPLY<MyMesh>::Save(tm,"Octbin.ply");
tri::Icosahedron(tm);
tri::io::ExporterPLY<MyMesh>::Save(tm,"Icobin.ply");
2004-03-10 02:00:21 +01:00
//tri::io::ExporterSTL<MyMesh>::Save(tm,"Tetra.stl",false);
//tri::io::ExporterPLY<MyMesh>::Save(tm,"Tetraascii.ply",false);
2004-03-05 13:10:15 +01:00
//tri::io::ExporterSTL<MyMesh>::Save(tm,"armawarp.stl",false);
2004-03-10 02:00:21 +01:00
//tri::UpdateNormals<MyMesh>::PerVertexNormalized(tm);
//tri::UpdateNormals<MyMesh>::PerFaceNormalized(tm);
//tri::UpdateNormals<MyMesh>::PerVertex(tm);
//tri::UpdateNormals<MyMesh>::PerFace(tm);
2004-03-05 13:10:15 +01:00
2004-03-18 17:00:10 +01:00
/*tri::io::ImporterPLY<MyMeshAdj>::Open(ta,"bigtest.ply");
2004-03-05 13:10:15 +01:00
printf("Loaded Mesh Has %i vn %i fn\n",ta.vn,ta.fn);
tri::UpdateTopology<MyMeshAdj>::FaceFace(ta);
tri::UpdateFlags<MyMeshAdj>::FaceBorderFromFF(ta);
2004-03-10 02:00:21 +01:00
tri::UpdateColor<MyMeshAdj>::FaceBF(ta);
tri::io::PlyInfo pi;
pi.mask=tri::io::PLYMask::PM_FACECOLOR;
2004-03-18 17:00:10 +01:00
tri::io::ExporterPLY<MyMeshAdj>::Save(ta,"color.ply",true, pi);*/
face::Pos<MyMeshAdj::FaceType> fp;
tri::io::ImporterSTL<MyMeshAdj>::Open(ta,"knotbin.stl");
tri::io::ExporterPLY<MyMeshAdj>::Save(ta,"knotbin.ply");
tri::io::ImporterSTL<MyMeshAdj>::Open(ta,"knotasc.stl");
tri::io::ExporterPLY<MyMeshAdj>::Save(ta,"knotasc.ply");
2004-03-05 13:10:15 +01:00
return 0;
}