 ## CGAL::Ray_d<Kernel>

### Definition

An instance of data type Ray_d is a ray in d-dimensional Euclidean space. It starts in a point called the source of r and it goes to infinity.

### Types

 Ray_d::R the representation type. Ray_d::RT the ring type. Ray_d::FT the field type. Ray_d::LA the linear algebra layer.

### Creation

 Ray_d r; introduces some ray in d-dimensional space. Ray_d r ( Point_d p, Point_d q); introduces a ray through p and q and starting at p. Precondition: p and q are distinct and have the same dimension. Precondition: p.dimension()==q.dimension(). Ray_d r ( Point_d p, Direction_d dir); introduces a ray starting in p with direction dir. Precondition: p and dir have the same dimension and dir is not degenerate. Precondition: p.dimension()==dir.dimension(). Ray_d r ( Segment_d s); introduces a ray through s.source() and s.target() and starting at s.source(). Precondition: s is not degenerate.

### Operations

 int r.dimension () returns the dimension of the ambient space. Point_d r.source () returns the source point of r. Point_d 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_d r.direction () returns the direction of r. Line_d r.supporting_line () returns the supporting line of r. Ray_d r.opposite () returns the ray with direction opposite to r and starting in source. Ray_d r.transform ( Aff_transformation_d t) returns t(r). Precondition: r.dimension()==t.dimension(). Ray_d r + Vector_d v returns r+v, i.e., r translated by vector v. Precondition: r.dimension()==v.dimension(). bool r.has_on ( Point_d p) A point is on r, iff it is equal to the source of r, or if it is in the interior of r. Precondition: r.dimension()==p.dimension().

### Non-Member Functions

 bool parallel ( r1, r2) returns true if the unoriented supporting lines of r1 and r2 are parallel and false otherwise. Precondition: r1.dimension()==r2.dimension().

### Implementation

Rays are implemented by a pair of points as an item type. All operations like creation, initialization, tests, direction calculation, input and output on a ray r take time O(r.dimension()). dimension(), coordinate and point access, and identity test take constant time. The space requirement is O(r.dimension()).