Subject: CGAL users discussion list
List archive
- From: Julien Demouth <>
- To:
- Subject: Re: [cgal-discuss] Intersection of segments
- Date: Fri, 18 Jul 2008 19:17:59 +0200
Hi Amit,
I'm not sure to understand the question but if you want to know whether two 2D segments intersect you can use CGAL::do_intersect (it is included with kernels). If you want to know if a point is on a segment, you can use has_on member function from the class CGAL::Segment_2.
CGAL::Exact_predicates_inexact_constructions_kernel K;
// Define four points a1, b1, a2, b2.
CGAL::Segment_2<K> s1 (a1, b1);
CGAL::Segment_2<K> s2 (a2, b2);
if (CGAL::do_intersect (s1, s2))
std::cout << "They intersect\n";
else
std::cout << "They don't\n";
if (s1.has_on (CGAL::Point_2<K> (1, 0, 0)))
std::cout << "s1 contains (1, 0, 0)\n"
I hope it answers your questions.
Best,
Julien
Amit Pendharkar a écrit :
Hi All,
I want to find if the given two segments or a segment and a point intersect or not.
I am trying to use /SegmentDelaunayGraphTraits_2::Arrangement_type /(that takes values /DISJOINT/, /IDENTICAL/, /CROSSING etc/) and the function /arrangement_type(),/ but it gives me error saying that its protected.
How do I define Arrangement_type & make use of arrangement_type() to find the intersection point if any?
I don't really want to make use of the sweep line algorithm as explained in Chapter21: 2D Intersection of Curves of cgal manual.
All i/ps are highly appreciated.
Thanks & Regards,
Amit Pendharkar
- [cgal-discuss] Intersection of segments, Amit Pendharkar, 07/18/2008
- Re: [cgal-discuss] Intersection of segments, Julien Demouth, 07/18/2008
Archive powered by MHonArc 2.6.16.