Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Intersection of Iso_rectangle_2 and Ray_2

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Intersection of Iso_rectangle_2 and Ray_2


Chronological Thread 
  • From: "Sebastien Loriot (GeometryFactory)" <>
  • To:
  • Subject: Re: [cgal-discuss] Intersection of Iso_rectangle_2 and Ray_2
  • Date: Fri, 02 Mar 2012 08:58:58 +0100

The iso_rectangle is considered as full so that what you call
the two point case is the segment one.


#include <CGAL/Exact_predicates_exact_constructions_kernel.h>

int main(){

typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel;
typedef Kernel::Point_2 Point_2;
typedef Kernel::Ray_2 Ray_2;
typedef Kernel::Iso_rectangle_2 Iso_rectangle_2;


Ray_2 r(Point_2(0,0),Point_2(1,1));
Iso_rectangle_2 rect(Point_2(0,0),Point_2(1,1));

CGAL::Object obj=CGAL::intersection(r,rect);
const Kernel::Segment_2* s=CGAL::object_cast<Kernel::Segment_2> (&obj);

CGAL_assertion(s!=NULL);

std::cout << *s << std::endl;
}



On 03/02/2012 08:55 AM, Mikhail Matrosov wrote:
There is a function Object intersection(Type1<Kernel> obj1,
Type2<Kernel> obj2) in CGAL which will return an object, representing
intersection of two given objects of different possible types. It is
said, that intersection of Iso_rectangle_2 and Ray_2 is either Point_2
or Segment_2.

And what about the case when ray intersects rectangle in two points (see
attached picture)? Cannot see anything about it in the manual.

-----
Best regards, Mikhail Matrosov




Archive powered by MHonArc 2.6.16.

Top of Page