Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Intersection - voronoi and polygon

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Intersection - voronoi and polygon


Chronological Thread 
  • From: Paul Neugebauer <>
  • To:
  • Subject: Re: [cgal-discuss] Intersection - voronoi and polygon
  • Date: Tue, 29 Apr 2008 17:47:55 +0200

I tried this:

typedef CGAL::Voronoi_diagram_2<SDG2,SDG2_AT2,SDG2_AP2> VD;

typedef CGAL::Polygon_2<Alg_kernel> Alg_polygon_2;
typedef Alg_polygon_2::Point_2 Alg_point_2;
typedef Alg_polygon_2::Segment_2 Alg_segment_2;

VD vd;
Alg_segment_2 seg(Alg_point_2(7,20), Alg_point_2(50,44));

Edge_iterator edit = vd.edges_begin();
for ( ; edit != vd.edges_end(); ++edit)
{
bool intersect ;
intersect = do_intersect(seg, *edit);
...
}

But get an error, because *edit is not a possible value for the intersect routine. The problem is similar to my other one here: https://lists-sop.inria.fr/wws/arc/cgal-discuss/2008-04/msg00239.html

I don't know how to extract the Segment from the voronoi edge iterator. This is a comprehension problem for me.
Maybe there is someone who can explaine me this.

Thank you.
Paul

Ashwin Nanjappa schrieb:

wrote:
@~ash
Thank you for the reply. Which is the right routine for computing the intersection? This one:

CGAL::intersection ( Type1<Kernel> obj1, Type2<Kernel> obj2)

is just for the types: Line_2, Segment_2,...

Which routine can I use for the voronoi edges ?

See:
<http://www.cgal.org/Manual/3.3.1/doc_html/cgal_manual/Kernel_23_ref/Function_intersection.html>

You can intersect a Iso_rectangle_2 with a Segment_2. A Voronoi edge is a Segment_2. You could form a Iso_rectangle_2 around your polygon and intersect it with Segment_2 to get the intersection point. Then check if this point lies on the polygon by using its bounded_side() function.

~ash




Archive powered by MHonArc 2.6.16.

Top of Page