Skip to Content.
Sympa Menu

cgal-discuss - RE: [cgal-discuss] Voronoi 2D : convert Halfedge to Segment_2 or Ray_2

Subject: CGAL users discussion list

List archive

RE: [cgal-discuss] Voronoi 2D : convert Halfedge to Segment_2 or Ray_2


Chronological Thread 
  • From: "Vu, Khuong" <>
  • To: "" <>
  • Subject: RE: [cgal-discuss] Voronoi 2D : convert Halfedge to Segment_2 or Ray_2
  • Date: Mon, 12 Apr 2010 10:26:39 -0500
  • Accept-language: en-US
  • Acceptlanguage: en-US

Hi Laure,

Let me see if I understand your problem correctly. You have a set of segments
(sites), which possibly intersect with each other. You then construct the
Voronoi diagram, and test if the face of each (possible divided due to
intersections) site is close of open.

If so, you can use the function has_target or has_source to check if a
segment if infinite. Hope this helps.

Best,

Khuong
________________________________________
From: Laure Guicherd
[]
Sent: Monday, April 12, 2010 10:05 AM
To:

Subject: [cgal-discuss] Voronoi 2D : convert Halfedge to Segment_2 or Ray_2

Hi all,
I'm kind of stuck with this issue with Voronoi 2D. I know this topic has
been discussed a lot in this mailing, but I could not find a solution in
the archives.

I am getting a Voronoi diagram from successive sites insertions, then i
want to get its faces and vertices. Since i want to bound this diagram
with a convex hull, i need to get the intersection of the diagram edges
with this hull, and in this purpose i want to convert each halfedge to
Segment_2 or Ray_2 in order to test this intersection.

Here is my (simplified) code :



typedef typename CGAL::Delaunay_triangulation_2<K> DT;
typedef typename CGAL::Delaunay_triangulation_adaptation_traits_2<DT> AT;
typedef typename
CGAL::Delaunay_triangulation_caching_degeneracy_removal_policy_2<DT> AP;
typedef typename CGAL::Voronoi_diagram_2<DT,AT,AP> Voronoi;
typedef typename Voronoi::Face_iterator Face_iterator;
typedef typename Voronoi::Ccb_halfedge_circulator Ccb_halfedge_circulator;
typedef typename AT::Site_2 Site_2;


Voronoi VD;

// for each point [x,y] :
VD.insert( Site_2(x,y) );

for ( Face_iterator bf = VD.faces_begin() ; bf != VD.faces_end() ; ++bf )
{
Ccb_halfedge_circulator firstEdge = (*bf).outer_ccb();
Ccb_halfedge_circulator he = firstEdge;
do
{
CGAL::Object obj = make_object(he);

Segment_2 segment;
Ray_2 ray;
bool isSegment = ( CGAL::assign( segment, obj ) );
bool isRay = ( CGAL::assign( ray, obj ) );

// test intersection, get points, etc.
}
while ( ++he != firstEdge );
}


My problem is that isRay and isSegment always return false, even when
he->is_ray() or he->is_segment() are true.

What did i do wrong ? How can i make this conversion ?
Any hint will be greatly appreciated, thank you !

Laure

--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://lists-sop.inria.fr/wws/info/cgal-discuss




Archive powered by MHonArc 2.6.16.

Top of Page