Skip to Content.
Sympa Menu

cgal-discuss - [Polyhedron, Mesh ] Need a help to access vertex, halfedge, and faces after building polygons

Subject: CGAL users discussion list

List archive

[Polyhedron, Mesh ] Need a help to access vertex, halfedge, and faces after building polygons


Chronological Thread 
  • From: "samuel kim" <>
  • To: <>
  • Subject: [Polyhedron, Mesh ] Need a help to access vertex, halfedge, and faces after building polygons
  • Date: Tue, 22 Apr 2008 17:15:04 +0200
  • Organization: Purdue

Hello,

 

I am struggling in building 3D meshes from a set of points of 3D model (object file). I modified the example source code “Polyhedron_prog_incr_builder.cpp” as follows. After making all triangles from a set of points, I want to travel the meshes with the index and want to get vertex position. And I also need to find neighbor triangles sharing halfedges. How should I do this? I need your help. . I would really appreciate that you can send me a good example. Thank you in advance

 

Samuel

 

 

 

template <class HDS>

class Build_triangle : public CGAL::Modifier_base<HDS> {

public:

    Build_triangle() {}

    void operator()( HDS& hds) {

        // Postcondition: `hds' is a valid polyhedral surface.

        CGAL::Polyhedron_incremental_builder_3<HDS> B( hds, true);

      

                int numofvertices = 1000; // Just define the number of surface points of 3D model

                int numoffaces = 70;

 

       B.begin_surface(numofvertex, numoffaces, 2* numofvertices);

       typedef typename HDS::Vertex   Vertex;

 

       for(int i=0;i< numofvertices; i=+3 )

      {                       

                  B.add_vertex( Points[i]));

B.add_vertex( Points[i+1]));

B.add_vertex( Points[i+2]));

  B.begin_facet();

   B.add_vertex_to_facet( i);

   B.add_vertex_to_facet( i+1);

   B.add_vertex_to_facet( i+2);

   B.end_facet();

        }

               

       B.end_surface();

 

};

typedef CGAL::Simple_cartesian<double>     Kernel;

typedef CGAL::Polyhedron_3<Kernel>         Polyhedron;

typedef Polyhedron::HalfedgeDS             HalfedgeDS;

 

int main() {

    Polyhedron P;

    Build_triangle<HalfedgeDS> triangle;

    P.delegate( triangle);

    CGAL_assertion( P.is_triangle( P.halfedges_begin()));

 

 /// I want to access vertex, half edges , and faces here ////

 

}

 

 

    return 0;




Archive powered by MHonArc 2.6.16.

Top of Page