Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Sub-segments of intersecting segments

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Sub-segments of intersecting segments


Chronological Thread 
  • From: "Amit Pendharkar" <>
  • To:
  • Cc: ,
  • Subject: Re: [cgal-discuss] Sub-segments of intersecting segments
  • Date: Fri, 10 Oct 2008 01:03:00 -0500
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version :content-type:references; b=lX7By1U9xUuPtFlF5gu9B+jOSkWuTZ0yG7huRMxTVmMcjELy3QcgKwtEZxL8MsUIxW wJQCQYI5T8cGrOvZOf5jPUwXMKV6ODT7nIs8/iV/3lEWlLJtpS6DSY7id5JlBYTpZLPx twwR3O70pNdDB3Sn0AC/horchHlUKCWgkba40=

Thanks Pierre & Efif(?),

Both ways work good but I think Arrangement_with_history_2 is what I actually want since I want to associate sub-segments with their parent segments and it invariably does it.

However, now I have a general question. How do I convert a segment from one 'Traits' to another.

E.g.
typedef CGAL :: Exact_predicates_inexact_constructions_kernel                K;
typedef CGAL :: Segment_Delaunay_graph_traits_2<K>                    SDGT2;
typedef CGAL :: Segment_Delaunay_graph_2<SDGT2>                         SDG2;

typedef CGAL::Arr_segment_traits_2<K>                    Traits_2;

SDG2::Site_2    site;

Traits_2::Segment_2 seg;


How do I convert site into seg???

Currently I am going all the way down up to the x & y coordinates of the endpoints and build the segment from there. Like,

seg = Traits_2::Curve_2(Traits_2::Point_2(site.source().hx(), site.source().hy()), Traits_2::Point_2(site.target().hx(), site.target().hy()));

But then I lose the precision, probably since the x & y coordinates get approximated and the site and seg refer to two different segments.

I face the same problem whenever I want to convert points from one kernel to another like Exact_predicates_inexact_constructions_kernel::Point_2 to Exact_circular_kernel_2::Point_2. I have to go all the way down upto the x,y coordinate level. And then you are bound to lose the precision then, isnt it?

Is there any better or rather proper way to do it? Maybe I will send this as a separate mail to the list

Thanks & Regards,
Amit Pendharkar

On Fri, Oct 3, 2008 at 3:28 AM, <> wrote:
or construct an Arrangement_with_history_2.


Quoting "Pierre Alliez" <>:

hi Amit,

try inserting all your segments as constrained edges of a 2D constrained Delaunay triangulation which accepts intersections.

you then have to collect all constrained edges when you are done.


Amit Pendharkar a écrit :
Hi All,

Of given n randomly placed segments in a plane how to find out all the sub-segments that are formed due to intersections? Two segments, if intersect, will give rise to four sub-segments.

E.g. a vector seg will contain the original segments and another vector sub_seg should contain all the sub-segments after processing.

A lame solution would be to check if every two segments intersect and if they do, replace them with four sub-segments and restart the checking.

Is there any better way? Though http://www.cgal.org/Manual/3.3/doc_html/cgal_manual/Sweep_line_2/Chapter_main.html looks useful, this is not I want.

I want to find out the sub-segments and not merely the intersection points.

Your inputs are appreciated.

Thanks & Regards,
Amit Pendharkar

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



--
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