Subject: CGAL users discussion list
List archive
- From: "Sebastien Loriot (GeometryFactory)" <>
- To:
- Subject: Re: [cgal-discuss] polyhedron problem
- Date: Wed, 14 Apr 2010 14:14:46 +0200
zhoufang8811 wrote:
> I find that Polyhedron_3<Traits> does not consider ther coordinates of
> the points, so I insert two triangles like this:
>
> Point_3 p( 0.0, 0.0, 0.0);
> Point_3 q( 1.0, 0.0, 0.0);
> Point_3 r( 1.0, 1.0, 0.0);
> Point_3 s( 0.0, 1.0, 0.0);
>
> s _ _ _ _ r
> |\ \ |
> | \ \ |
> | \ \ |
> | \ \ |
> |_ _ _ \ \ |
> p q
>
> Polyhedron P;
> P.make_triangle(p, q, s);
> P.make_triangle(s,q ,r);
The polyhedron is a combinatoric data structure. The fact that the
embedded triangles share an edge (q,s), does not imply that in the
polyhedron the triangle share an edge.
You may need to use the Polyhedron_incremental_builder_3 documented here:
http://www.cgal.org/Manual/last/doc_html/cgal_manual/Polyhedron_ref/Class_Polyhedron_incremental_builder_3.html#Cross_link_anchor_1095
At the bottom of this page, you will find an example. Modifying this
example like this will make what you want:
B.add_vertex(p);
B.add_vertex(q);
B.add_vertex(r);
B.add_vertex(s);
B.begin_facet();// triangle pqs
B.add_vertex_to_facet( 0);
B.add_vertex_to_facet( 1);
B.add_vertex_to_facet( 3);
B.end_facet();
B.begin_facet();//triangle qrs
B.add_vertex_to_facet( 1);
B.add_vertex_to_facet( 2);
B.add_vertex_to_facet( 3);
B.end_facet();
>
> but the triangle 'pqs' and 'sqr' do not connect correctly, it has four
> halfedges along the segment 'sq'.
>
> I want to merge the different edges 'sq' in the two triangles, so the
> rectangle 'spqr' will be colsed. Is there any way?
>
> 2010-04-14
> ------------------------------------------------------------------------
> zhoufang8811
- [cgal-discuss] polyhedron problem, zhoufang8811, 04/14/2010
- Re: [cgal-discuss] polyhedron problem, Sebastien Loriot (GeometryFactory), 04/14/2010
- RE: [cgal-discuss] polyhedron problem, Mastoureshgh, Sahel, 04/14/2010
- Re: [cgal-discuss] polyhedron problem, Sebastien Loriot (GeometryFactory), 04/14/2010
Archive powered by MHonArc 2.6.16.