Question

I'd like to be able to extract vertices of each edge on the triangulation boundary. The thing is that I first define constrained triangulation by defining constraints and holes in domain if necessary. Then I need to refine mesh via mesh refinement algorithm. It all works nice and dandy, except for one glitch. I have to tell which edge lies on which boundary. Let me give you an example: Given 4 polylines that define the domain, and are constraints in triangulation, (say top, bottom, left and right polyline), I have to tell wich edge lies on which polyline. I had defined each polyline as std::vector, which can be easily probed for point on segment. Like this: CDT::Point pt1; CDT::Point pt2;

for(const auto& seg : segments)
{
  if(seg.has_on(pt1))
  { num++; }
  if(seg.has_on(pt2))
  { num++; }
  if(num==2){/*success? -> return true*/}              
}

I'm aware of CGAL::bounded_side_2 function, which sadly operates on polygons. How can I solve this problem?

for(CDT::Finite_edges_iterator it = cdt.finite_edges_begin();
            it != cdt.finite_edges_end(); ++it)
{
        CDT::Edge e=*it;
        // how can I tell if an edge is on boundary?
}
Was it helpful?

Solution

You can use the is_contrained method from the constrained triangulation.

if (cdt.is_constrained(e)) ...

If you can have dandling edges, you must first mark the domain like in the following example and check that the edge is incident to two faces that have different nesting_level.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top