0

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?
}
dodol
  • 1,073
  • 2
  • 16
  • 33

1 Answers1

2

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.

sloriot
  • 6,070
  • 18
  • 27
  • how can I find which mesh refinement edge lays on which constrained edge before refinement? Is segment_2::has_on the right way to go? Or there is some other way? – dodol Dec 20 '13 at 17:39
  • 1
    I think if you wrap your contrained Delaunay triangulation into [this class](http://doc.cgal.org/latest/Triangulation_2/classCGAL_1_1Constrained__triangulation__plus__2.html) you will have access to the information (points added on constraints define sub-constraints). – sloriot Dec 23 '13 at 09:26
  • indeed. Now I don't need to ask if an edge is constrained, since I iterate over constrained edges with Subconstraint_iterator. sorry for slow feedback – dodol Jan 02 '14 at 18:41