CGAL 5.1 - 2D and 3D Linear Geometry Kernel
CGAL::Ray_2< Kernel > Class Template Reference

#include <CGAL/Ray_2.h>

Definition

template<typename Kernel>
class CGAL::Ray_2< Kernel >

An object r of the data type Ray_2 is a directed straight ray in the two-dimensional Euclidean plane \( \E^2\). It starts in a point called the source of r and goes to infinity.

Is Model Of:
Kernel::Ray_2

Creation

 Ray_2 (const Point_2< Kernel > &p, const Point_2< Kernel > &q)
 introduces a ray r with source p and passing through point q. More...
 
 Ray_2 (const Point_2< Kernel > &p, const Direction_2< Kernel > &d)
 introduces a ray r starting at source p with direction d. More...
 
 Ray_2 (const Point_2< Kernel > &p, const Vector_2< Kernel > &v)
 introduces a ray r starting at source p with the direction of v. More...
 
 Ray_2 (const Point_2< Kernel > &p, const Line_2< Kernel > &l)
 introduces a ray r starting at source p with the same direction as l. More...
 

Operations

bool operator== (const Ray_2< Kernel > &h) const
 Test for equality: two rays are equal, iff they have the same source and the same direction. More...
 
bool operator!= (const Ray_2< Kernel > &h) const
 Test for inequality. More...
 
Point_2< Kernelsource () const
 returns the source of r. More...
 
Point_2< Kernelpoint (const Kernel::FT i) const
 returns a point on r. More...
 
Direction_2< Kerneldirection () const
 returns the direction of r. More...
 
Vector_2< Kernelto_vector () const
 returns a vector giving the direction of r. More...
 
Line_2< Kernelsupporting_line () const
 returns the line supporting r which has the same direction. More...
 
Ray_2< Kernelopposite () const
 returns the ray with the same source and the opposite direction. More...
 

Predicates

bool is_degenerate () const
 ray r is degenerate, if the source and the second defining point fall together (that is if the direction is degenerate). More...
 
bool is_horizontal () const
 
bool is_vertical () const
 
bool has_on (const Point_2< Kernel > &p) const
 A point is on r, iff it is equal to the source of r, or if it is in the interior of r. More...
 
bool collinear_has_on (const Point_2< Kernel > &p) const
 checks if point p is on r. More...
 

Miscellaneous

Ray_2< Kerneltransform (const Aff_transformation_2< Kernel > &t) const
 returns the ray obtained by applying t on the source and on the direction of r. More...
 

Constructor & Destructor Documentation

◆ Ray_2() [1/4]

template<typename Kernel >
CGAL::Ray_2< Kernel >::Ray_2 ( const Point_2< Kernel > &  p,
const Point_2< Kernel > &  q 
)

introduces a ray r with source p and passing through point q.

◆ Ray_2() [2/4]

template<typename Kernel >
CGAL::Ray_2< Kernel >::Ray_2 ( const Point_2< Kernel > &  p,
const Direction_2< Kernel > &  d 
)

introduces a ray r starting at source p with direction d.

◆ Ray_2() [3/4]

template<typename Kernel >
CGAL::Ray_2< Kernel >::Ray_2 ( const Point_2< Kernel > &  p,
const Vector_2< Kernel > &  v 
)

introduces a ray r starting at source p with the direction of v.

◆ Ray_2() [4/4]

template<typename Kernel >
CGAL::Ray_2< Kernel >::Ray_2 ( const Point_2< Kernel > &  p,
const Line_2< Kernel > &  l 
)

introduces a ray r starting at source p with the same direction as l.

Member Function Documentation

◆ collinear_has_on()

template<typename Kernel >
bool CGAL::Ray_2< Kernel >::collinear_has_on ( const Point_2< Kernel > &  p) const

checks if point p is on r.

This function is faster than function has_on() if the precondition checking is disabled.

Precondition
p is on the supporting line of r.

◆ direction()

template<typename Kernel >
Direction_2<Kernel> CGAL::Ray_2< Kernel >::direction ( ) const

returns the direction of r.

◆ has_on()

template<typename Kernel >
bool CGAL::Ray_2< Kernel >::has_on ( const Point_2< Kernel > &  p) const

A point is on r, iff it is equal to the source of r, or if it is in the interior of r.

◆ is_degenerate()

template<typename Kernel >
bool CGAL::Ray_2< Kernel >::is_degenerate ( ) const

ray r is degenerate, if the source and the second defining point fall together (that is if the direction is degenerate).

◆ is_horizontal()

template<typename Kernel >
bool CGAL::Ray_2< Kernel >::is_horizontal ( ) const

◆ is_vertical()

template<typename Kernel >
bool CGAL::Ray_2< Kernel >::is_vertical ( ) const

◆ operator!=()

template<typename Kernel >
bool CGAL::Ray_2< Kernel >::operator!= ( const Ray_2< Kernel > &  h) const

Test for inequality.

◆ operator==()

template<typename Kernel >
bool CGAL::Ray_2< Kernel >::operator== ( const Ray_2< Kernel > &  h) const

Test for equality: two rays are equal, iff they have the same source and the same direction.

◆ opposite()

template<typename Kernel >
Ray_2<Kernel> CGAL::Ray_2< Kernel >::opposite ( ) const

returns the ray with the same source and the opposite direction.

◆ point()

template<typename Kernel >
Point_2<Kernel> CGAL::Ray_2< Kernel >::point ( const Kernel::FT  i) const

returns a point on r.

point(0) is the source, point(i), with i>0, is different from the source.

Precondition
\( i \geq0\).

◆ source()

template<typename Kernel >
Point_2<Kernel> CGAL::Ray_2< Kernel >::source ( ) const

returns the source of r.

◆ supporting_line()

template<typename Kernel >
Line_2<Kernel> CGAL::Ray_2< Kernel >::supporting_line ( ) const

returns the line supporting r which has the same direction.

◆ to_vector()

template<typename Kernel >
Vector_2<Kernel> CGAL::Ray_2< Kernel >::to_vector ( ) const

returns a vector giving the direction of r.

◆ transform()

template<typename Kernel >
Ray_2<Kernel> CGAL::Ray_2< Kernel >::transform ( const Aff_transformation_2< Kernel > &  t) const

returns the ray obtained by applying t on the source and on the direction of r.