Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] How to find faces of a (sub)constrained in Constrained_triangulation_plus_2

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] How to find faces of a (sub)constrained in Constrained_triangulation_plus_2


Chronological Thread 
  • From: "Sebastien Loriot (GeometryFactory)" <>
  • To:
  • Subject: Re: [cgal-discuss] How to find faces of a (sub)constrained in Constrained_triangulation_plus_2
  • Date: Thu, 18 Oct 2012 23:05:03 +0200
  • Organization: GeometryFactory

Constrained_triangulation_plus_2<Tr> inherits from Tr which in the end
inherits from Triangulation_2 [1] and Constrained_triangulation_2 [2] .

You can thus iterator over all edges, check if it is constrained and
get the incident faces.

for( Finite_edges_iterator eit=cdt.finite_edges_begin(),
eit_end=cdt.finite_edges_end();
eit!=eit_end;
++eit)
{
if ( cdt.is_constrained(*eit) )
{
Face face1 = eit->first;
Face face2 = eit->first->neighbor( eit->second);
}
}

Sebastien.

[1] http://www.cgal.org/Manual/latest/doc_html/cgal_manual/Triangulation_2_ref/Class_Constrained_triangulation_2.html

[2] http://www.cgal.org/Manual/latest/doc_html/cgal_manual/Triangulation_2_ref/Class_Triangulation_2.html

On 10/18/2012 06:00 PM, gzp wrote:
Hi,

In one of my project I have a Constrained_triangulation_plus_2. I can
extract all kind of information. Add and fill the user defined triangle
information as required, I jut simple cannot find a way to find the (2)
neighboring faces of a (sub)constraint.
I can iterate over the subdivided edges using the Subconstraint_iterator,
but how can I find the associated faces? In theory there can be at most 2
such faces (or infinite_faces), but how to find them ?

I mean something like this:

std::vector<MYEdges> E;

for( Subconstraint_iterator scit = cdt.subconstraints_begin(); scit !=
cdt.subconstraints_end(); ++scit) {
Vertex_handle v1 = scit->first.first;
Vertex_handle v2 = scit->first.second;
Face_handle left = cdt.find_face(v1,v2);
Face_handle right = cdt.find_face(v2,v1);

E.push_back( MyEdge( v1,v2, left->info().data, right->info().data ) );
}


Thanks, gzp




--
View this message in context:
http://cgal-discuss.949826.n4.nabble.com/How-to-find-faces-of-a-sub-constrained-in-Constrained-triangulation-plus-2-tp4656050.html
Sent from the cgal-discuss mailing list archive at Nabble.com.





Archive powered by MHonArc 2.6.18.

Top of Page