## CGAL::Ray_2<Kernel>

### Definition

An object r of the data type Ray_2<Kernel> is a directed straight ray in the two-dimensional Euclidean plane  2. It starts in a point called the source of r and goes to infinity.

### Creation

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

### Operations

 bool r.operator== ( h) Test for equality: two rays are equal, iff they have the same source and the same direction. bool r.operator!= ( h) Test for inequality. Point_2 r.source () returns the source of r. Point_2 r.point ( int i) returns a point on r. point(0) is the source, point(i), with i>0, is different from the source. Precondition: i 0. Direction_2 r.direction () returns the direction of r. Vector_2 r.to_vector () returns a vector giving the direction of r. Line_2 r.supporting_line () returns the line supporting r which has the same direction. Ray_2 r.opposite () returns the ray with the same source and the opposite direction.

### Predicates

 bool r.is_degenerate () ray r is degenerate, if the source and the second defining point fall together (that is if the direction is degenerate). bool r.is_horizontal () bool r.is_vertical () bool r.has_on ( Point_2 p) A point is on r, iff it is equal to the source of r, or if it is in the interior of r. bool r.collinear_has_on ( Point_2 p) 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.

### Miscellaneous

 Ray_2 r.transform ( Aff_transformation_2 t) returns the ray obtained by applying t on the source and on the direction of r.