CGAL 5.3 - dD Geometry Kernel
CGAL::Direction_d< Kernel > Class Template Reference

#include <CGAL/Kernel_d/Direction_d.h>

## Definition

A Direction_d is a vector in the $$d$$-dimensional vector space where we forget about its length.

We represent directions in $$d$$-dimensional space as a tuple $$(h_0,\ldots,h_d)$$ of variables of type RT which we call the homogeneous coordinates of the direction. The coordinate $$h_d$$ must be positive. The Cartesian coordinates of a direction are $$c_i = h_i/h_d$$ for $$0 \le i < d$$, which are of type FT. Two directions are equal if their Cartesian coordinates are positive multiples of each other. Directions are in one-to-one correspondence to points on the unit sphere.

Downward compatibility

We provide the operations of the lower dimensional interface dx(), dy(), dz().

Implementation

Directions are implemented by arrays of integers as an item type. All operations like creation, initialization, tests, inversion, input and output on a direction $$d$$ take time $$O(d.\mathit{dimension}())$$. dimension(), coordinate access and conversion take constant time. The space requirement is $$O(d.\mathit{dimension}())$$.

## Types

typedef unspecified_type LA
the linear algebra layer.

typedef unspecified_type Delta_const_iterator
a read-only iterator for the deltas of dir.

typedef unspecified_type Base_direction
construction tag.

## Creation

Direction_d ()
introduces a variable dir of type Direction_d<Kernel>.

Direction_d (Vector_d< Kernel > v)
introduces a variable dir of type Direction_d<Kernel> initialized to the direction of v.

template<class InputIterator >
Direction_d (int d, InputIterator first, InputIterator last)
introduces a variable dir of type Direction_d<Kernel> in dimension d with representation tuple set [first,last). More...

Direction_d (int d, Base_direction, int i)
returns a variable dir of type Direction_d<Kernel> initialized to the direction of the $$i$$-th base vector of dimension $$d$$. More...

Direction_d (RT x, RT y)
introduces a variable dir of type Direction_d<Kernel> in $$2$$-dimensional space.

Direction_d (RT x, RT y, RT z)
introduces a variable dir of type Direction_d<Kernel> in $$3$$-dimensional space.

## Operations

int dimension ()
returns the dimension of dir.

RT delta (int i)
returns the $$i$$-th component of dir. More...

RT operator[] (int i)
returns the $$i$$-th delta of dir. More...

Delta_const_iterator deltas_begin ()
returns an iterator pointing to the first delta of dir.

Delta_const_iterator deltas_end ()
returns an iterator pointing beyond the last delta of dir.

Vector_d< Kernelvector ()
returns a vector pointing in direction dir.

bool is_degenerate ()
returns true iff dir.delta(i)==0 for all $$0\leq i < d$$.

Direction_d< Kerneltransform (const Aff_transformation_d< Kernel > &t)
returns $$t(p)$$.

Direction_d< Kernelopposite ()
returns the direction opposite to dir.

Direction_d< Kerneloperator- ()
returns the direction opposite to dir.

## ◆ Direction_d() [1/2]

template<typename Kernel >
template<class InputIterator >
 CGAL::Direction_d< Kernel >::Direction_d ( int d, InputIterator first, InputIterator last )

introduces a variable dir of type Direction_d<Kernel> in dimension d with representation tuple set [first,last).

Precondition
d is nonnegative, [first,last) has d elements.
Template Parameters
 InputIterator has RT as value type.

## ◆ Direction_d() [2/2]

template<typename Kernel >
 CGAL::Direction_d< Kernel >::Direction_d ( int d, Base_direction , int i )

returns a variable dir of type Direction_d<Kernel> initialized to the direction of the $$i$$-th base vector of dimension $$d$$.

Precondition
$$0 \leq i < d$$.

## ◆ delta()

template<typename Kernel >
 RT CGAL::Direction_d< Kernel >::delta ( int i )

returns the $$i$$-th component of dir.

Precondition
$$0 \leq i < d$$.

## ◆ operator[]()

template<typename Kernel >
 RT CGAL::Direction_d< Kernel >::operator[] ( int i )

returns the $$i$$-th delta of dir.

Precondition
$$0 \leq i < d$$.