Navigation: Up, Table of Contents, Bibliography, Index, Title Page

2D Direction (Direction_2)

Definition

An object of the class Direction_2 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().

#include <CGAL/Direction_2.h>

Creation

Direction_2<R> d ( Vector_2<R> v);
introduces the direction d of vector v.


Direction_2<R> d ( R::RT x, R::RT y);
introduces a direction d passing through the origin and the point with Cartesian coordinates (x, y).

Operations

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

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

R::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 == e Test for equality.

bool d != e Test for inequality.

bool d < e

bool d > e

bool d <= e

bool d >= e

Furthermore, we have

bool d.counterclockwise_in_between ( d1, d2)
returns true, iff, while rotating counterclockwise starting at d1, d is reached strictly before d2 is reached.

Direction_2<R> - d The direction opposite to d.

Miscellaneous

Vector_2<R> d.vector () returns a vector that has the same direction as d.

Direction_2<R> d.transform ( Aff_transformation_2<R> t)
returns the direction obtained by applying t on d.


Navigation: Up, Table of Contents, Bibliography, Index, Title Page
The GALIA project. Jan 18, 2000.