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 09:15:30 +0100

On 03/02/2012 09:06 AM, Mikhail Matrosov wrote:
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?
Quickly looked at the code and I would say yes.

Sebastien.


-----
Best regards, Mikhail Matrosov


2012/3/2 Sebastien Loriot (GeometryFactory)
<
<mailto:>>

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
<https://lists-sop.inria.fr/wws/info/cgal-discuss>






Archive powered by MHonArc 2.6.16.

Top of Page