\( \newcommand{\E}{\mathrm{E}} \) \( \newcommand{\A}{\mathrm{A}} \) \( \newcommand{\R}{\mathrm{R}} \) \( \newcommand{\N}{\mathrm{N}} \) \( \newcommand{\Q}{\mathrm{Q}} \) \( \newcommand{\Z}{\mathrm{Z}} \) \( \def\ccSum #1#2#3{ \sum_{#1}^{#2}{#3} } \def\ccProd #1#2#3{ \sum_{#1}^{#2}{#3} }\)
CGAL 4.7 - dD Geometry Kernel
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
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. 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

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

construction tag.

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

a read-only iterator for the deltas of dir.

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

the linear algebra layer.

Constructor & Destructor Documentation

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

introduces a variable dir of type Direction_d<Kernel>.

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.

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.
Requires:
The value type of InputIterator is RT.
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\).
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.

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

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

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

Precondition
\( 0 \leq i < d\).
template<typename Kernel >
Delta_const_iterator CGAL::Direction_d< Kernel >::deltas_begin ( )

returns an iterator pointing to the first delta of dir.

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

returns an iterator pointing beyond the last delta of dir.

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

returns the dimension of dir.

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

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

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

returns the direction opposite to dir.

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

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

Precondition
\( 0 \leq i < d\).
template<typename Kernel >
Direction_d<Kernel> CGAL::Direction_d< Kernel >::opposite ( )

returns the direction opposite to dir.

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

returns \( t(p)\).

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

returns a vector pointing in direction dir.