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

#include <CGAL/Kernel_d/Direction_d.h>

Definition

template<typename Kernel>
class CGAL::Direction_d< Kernel >

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. More...
 
typedef unspecified_type Delta_const_iterator
 a read-only iterator for the deltas of dir. More...
 
typedef unspecified_type Base_direction
 construction tag. More...
 

Creation

 Direction_d ()
 introduces a variable dir of type Direction_d<Kernel>. More...
 
 Direction_d (Vector_d< Kernel > v)
 introduces a variable dir of type Direction_d<Kernel> initialized to the direction of v. More...
 
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. More...
 
 Direction_d (RT x, RT y, RT z)
 introduces a variable dir of type Direction_d<Kernel> in \( 3\)-dimensional space. More...
 

Operations

int dimension ()
 returns the dimension of dir. More...
 
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. More...
 
Delta_const_iterator deltas_end ()
 returns an iterator pointing beyond the last delta of dir. More...
 
Vector_d< Kernelvector ()
 returns a vector pointing in direction dir. More...
 
bool is_degenerate ()
 returns true iff dir.delta(i)==0 for all \( 0\leq i < d\). More...
 
Direction_d< Kerneltransform (const Aff_transformation_d< Kernel > &t)
 returns \( t(p)\). More...
 
Direction_d< Kernelopposite ()
 returns the direction opposite to dir. More...
 
Direction_d< Kerneloperator- ()
 returns the direction opposite to dir. More...
 

Member Typedef Documentation

◆ Base_direction

template<typename Kernel >
typedef unspecified_type CGAL::Direction_d< Kernel >::Base_direction

construction tag.

◆ Delta_const_iterator

template<typename Kernel >
typedef unspecified_type CGAL::Direction_d< Kernel >::Delta_const_iterator

a read-only iterator for the deltas of dir.

◆ LA

template<typename Kernel >
typedef unspecified_type CGAL::Direction_d< Kernel >::LA

the linear algebra layer.

Constructor & Destructor Documentation

◆ Direction_d() [1/6]

template<typename Kernel >
CGAL::Direction_d< Kernel >::Direction_d ( )

introduces a variable dir of type Direction_d<Kernel>.

◆ Direction_d() [2/6]

template<typename Kernel >
CGAL::Direction_d< Kernel >::Direction_d ( Vector_d< Kernel v)

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

◆ Direction_d() [3/6]

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
InputIteratorhas RT as value type.

◆ Direction_d() [4/6]

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\).

◆ Direction_d() [5/6]

template<typename Kernel >
CGAL::Direction_d< Kernel >::Direction_d ( RT  x,
RT  y 
)

introduces a variable dir of type Direction_d<Kernel> in \( 2\)-dimensional space.

◆ Direction_d() [6/6]

template<typename Kernel >
CGAL::Direction_d< Kernel >::Direction_d ( RT  x,
RT  y,
RT  z 
)

introduces a variable dir of type Direction_d<Kernel> in \( 3\)-dimensional space.

Member Function Documentation

◆ delta()

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

returns the \( i\)-th component of dir.

Precondition
\( 0 \leq i < d\).

◆ deltas_begin()

template<typename Kernel >
Delta_const_iterator CGAL::Direction_d< Kernel >::deltas_begin ( )

returns an iterator pointing to the first delta of dir.

◆ deltas_end()

template<typename Kernel >
Delta_const_iterator CGAL::Direction_d< Kernel >::deltas_end ( )

returns an iterator pointing beyond the last delta of dir.

◆ dimension()

template<typename Kernel >
int CGAL::Direction_d< Kernel >::dimension ( )

returns the dimension of dir.

◆ is_degenerate()

template<typename Kernel >
bool CGAL::Direction_d< Kernel >::is_degenerate ( )

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

◆ operator-()

template<typename Kernel >
Direction_d<Kernel> CGAL::Direction_d< Kernel >::operator- ( )

returns the direction opposite to dir.

◆ operator[]()

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

returns the \( i\)-th delta of dir.

Precondition
\( 0 \leq i < d\).

◆ opposite()

template<typename Kernel >
Direction_d<Kernel> CGAL::Direction_d< Kernel >::opposite ( )

returns the direction opposite to dir.

◆ transform()

template<typename Kernel >
Direction_d<Kernel> CGAL::Direction_d< Kernel >::transform ( const Aff_transformation_d< Kernel > &  t)

returns \( t(p)\).

◆ vector()

template<typename Kernel >
Vector_d<Kernel> CGAL::Direction_d< Kernel >::vector ( )

returns a vector pointing in direction dir.