#include #include #include #include #include #include #include using namespace vcg; using namespace std; class MyEdge; class MyFace; class MyVertex; struct MyUsedTypes : public UsedTypes< Use ::AsVertexType, Use ::AsEdgeType, Use ::AsFaceType >{}; class MyVertex : public Vertex{}; class MyFace : public Face {}; class MyEdge : public Edge{}; class MyMesh : public tri::TriMesh< vector, vector , vector > {}; int main() { MyMesh m; tri::Hexahedron(m); tri::UpdateBounding::Box(m); tri::UpdateTopology::FaceFace(m); //for FFAdj tri::UpdateNormal::PerVertexNormalized(m); tri::UpdateFlags::Clear(m); Point3f origin(0.8f,-0.4,0); Point3f end= origin+Point3f(0,1,0); float radius = 0.5f; MyMesh cm; tri::OrientedCylinder(cm,origin,end,radius,64,4); tri::io::ExporterPLY::Save(cm,"cyl.ply"); tri::CylinderClipping::Apply(m,origin,end,radius); tri::CylinderClipping::Apply(m,origin,end,radius/2.0f); tri::io::ExporterPLY::Save(m,"cube.ply"); return 0; }