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: Mikhail Matrosov <>
  • To:
  • Subject: Re: [cgal-discuss] Intersection of Iso_rectangle_2 and Ray_2
  • Date: Fri, 2 Mar 2012 12:06:43 +0400
  • Authentication-results: mr.google.com; spf=pass (google.com: domain of designates 10.236.77.166 as permitted sender) ; dkim=pass

Thank you! And what if I want to consider iso_rectangle as thin, have starting point of ray inside it and want to find intersection as a point in this case (see picture)? Should I just take target() of segment found as an intersection?

-----
Best regards, Mikhail Matrosov


2012/3/2 Sebastien Loriot (GeometryFactory) <>
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


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


Attachment: ray_intersects_rectangle_one.png
Description: PNG image




Archive powered by MHonArc 2.6.16.

Top of Page