## CGAL::Direction_2<Kernel>

### Definition

An object of the class Direction_2<Kernel> is a vector in the two-dimensional vector space 2 where we forget about its length. They can be viewed as unit vectors, although there is no normalization internally, since this is error prone. Directions are used whenever the length of a vector does not matter. They also characterize a set of parallel oriented lines that have the same orientations. For example, you can ask for the direction orthogonal to an oriented plane, or the direction of an oriented line. Further, they can be used to indicate angles. The slope of a direction is dy()/dx().

### Creation

 Direction_2 d ( Vector_2 v); introduces the direction d of vector v. Direction_2 d ( Line_2 l); introduces the direction d of line l. Direction_2 d ( Ray_2 r); introduces the direction d of ray r. Direction_2 d ( Segment_2 s); introduces the direction d of segment s. Direction_2 d ( Kernel::RT x, Kernel::RT y); introduces a direction d passing through the origin and the point with Cartesian coordinates (x, y).

### Operations

Kernel::RT d.delta ( int i) returns values, such that d== Direction_2<Kernel>(delta(0),delta(1)).
 Precondition: : 0 ≤ i ≤ 1.

Kernel::RT d.dx () returns delta(0).

Kernel::RT d.dy () returns delta(1).

There is a total order on directions. We compare the angles between the positive x-axis and the directions in counterclockwise order.

 bool d.operator== ( e) bool d.operator!= ( e) bool d.operator< ( e) bool d.operator> ( e) bool d.operator<= ( e) bool d.operator>= ( e)

Furthermore, we have

 bool d.counterclockwise_in_between ( d1, d2) returns true, iff d is not equal to d1, and while rotating counterclockwise starting at d1, d is reached strictly before d2 is reached. Note that true is returned if d1 == d2, unless also d == d1. Direction_2 d.operator- () The direction opposite to d.

### Miscellaneous

 Vector_2 d.vector () returns a vector that has the same direction as d. Direction_2 d.transform ( Aff_transformation_2 t) returns the direction obtained by applying t on d.