Subject: CGAL users discussion list
List archive
Re: [cgal-discuss] Can Someone Explain the Output of the code(Intersection of two line segments)
Chronological Thread
- From: "Sebastien Loriot (GeometryFactory)" <>
- To:
- Subject: Re: [cgal-discuss] Can Someone Explain the Output of the code(Intersection of two line segments)
- Date: Mon, 05 Mar 2012 08:30:27 +0100
I think it's the third time in a week that I recommend to read
this FAQ entry:
http://www.cgal.org/FAQ.html#inexact_NT
Replace Exact_predicates_inexact_constructions_kernel
by Exact_predicates_exact_constructions_kernel.
You could expect that since endpoints are equal they are correctly
detected but the implementation is using the intersection point
of supporting line which leads to the wrong result you observe.
Sebastien.
On 03/04/2012 01:24 PM, pgiitu wrote:
#include<CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include<CGAL/Polygon_2.h>
#include<CGAL/Boolean_set_operations_2.h>
#include<CGAL/Object.h>
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef K::Point_2 Point;
typedef CGAL::Polygon_2<K> Polygon;
typedef CGAL::Object Object;
typedef CGAL::Segment_2<K> Segment;
using namespace std;
int main(int argc, char ** argv)
{
//initialising the segment1
Point p11(-3.8,2);
Point p12(-3,0);
Segment halfedge(p11,p12);
// initialising a segment1
Point source(-5,5);
Point target(-3,0);
Segment s(source,target);
//intersection of two segments
Object obj=CGAL::intersection(halfedge,s);
Point intPoint;
Segment intSegment;
if(CGAL::assign(intPoint,obj))
{
cout<<" Intersection point:-"<<intPoint<<"\n\n";
}
else if(CGAL::assign(intSegment,obj))
{
cout<<" Intersection edge"<<intSegment<<"\n\n";
}
}
- [cgal-discuss] Can Someone Explain the Output of the code(Intersection of two line segments), pgiitu, 03/04/2012
- [cgal-discuss] Re: Can Someone Explain the Output of the code(Intersection of two line segments), pgiitu, 03/04/2012
- Re: [cgal-discuss] Can Someone Explain the Output of the code(Intersection of two line segments), Sebastien Loriot (GeometryFactory), 03/05/2012
Archive powered by MHonArc 2.6.16.