Skip to Content.
Sympa Menu

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

Subject: CGAL users discussion list

List archive

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


Chronological Thread 
  • From: "samuel kim" <>
  • To: <>
  • Subject: RE: [cgal-discuss] [Polyhedron, Mesh ] Need a help to access vertex, halfedge, and faces after building polygons
  • Date: Tue, 22 Apr 2008 20:59:14 +0200
  • Organization: Purdue

Hi Mani,

 

Thank you very much, the below example at the link you sent is really wonderful.  Could you let me know how to find neighbor triangles from halfedge list by traveling facets? If the following data structure is used,,, Thank you again.

 

Facet_iterator pFacet    =             facets_begin();

Halfedge_around_facet_circulator pHalfedge = pFacet->facet_begin();

 

Samuel

 

 

From: Subramani Sellamani [mailto:]
Sent: Tuesday, April 22, 2008 6:04 PM
To:
Subject: Re: [cgal-discuss] [Polyhedron, Mesh ] Need a help to access vertex, halfedge, and faces after building polygons

 

Please visit following page for an example application created by Pierre Alliez.

 

 

Regards,

Mani

On Tue, Apr 22, 2008 at 11:15 AM, samuel kim <> wrote:

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;




--
Regards,
Mani
------------------------




Archive powered by MHonArc 2.6.16.

Top of Page