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

#include <CGAL/Kernel_d/Point_d.h>

Definition

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

An instance of data type Point_d<Kernel> is a point of Euclidean space in dimension \( d\). A point \( p = (p_0,\ldots,p_{ d - 1 })\) in \( d\)-dimensional space can be represented by homogeneous coordinates \( (h_0,h_1,\ldots,h_d)\) of number type RT such that \( p_i = h_i/h_d\), which is of type FT. The homogenizing coordinate \( h_d\) is positive.

We call \( p_i\), \( 0 \leq i < d\) the \( i\)-th Cartesian coordinate and \( h_i\), \( 0 \le i \le d\), the \( i\)-th homogeneous coordinate. We call \( d\) the dimension of the point.

Downward compatibility

We provide operations of the lower dimensional interface x(), y(), z(), hx(), hy(), hz(), hw().

Implementation

Points are implemented by arrays of RT items. All operations like creation, initialization, tests, point - vector arithmetic, input and output on a point \( p\) take time \( O(p.dimension())\). dimension(), coordinate access and conversions take constant time. The space requirement for points is \( O(p.dimension())\).

Types

typedef unspecified_type LA
 the linear algebra layer. More...
 
typedef unspecified_type Cartesian_const_iterator
 a read-only iterator for the Cartesian coordinates. More...
 
typedef unspecified_type Homogeneous_const_iterator
 a read-only iterator for the homogeneous coordinates. More...
 

Creation

 Point_d ()
 introduces a variable p of type Point_d<Kernel>. More...
 
 Point_d (int d, Origin)
 introduces a variable p of type Point_d<Kernel> in \( d\)-dimensional space, initialized to the origin. More...
 
template<class InputIterator >
 Point_d (int d, InputIterator first, InputIterator last)
 introduces a variable p of type Point_d<Kernel> in dimension d. More...
 
template<class InputIterator >
 Point_d (int d, InputIterator first, InputIterator last, RT D)
 introduces a variable p of type Point_d<Kernel> in dimension d initialized to the point with homogeneous coordinates as defined by H = set [first,last) and D: \( (\pm H[0], \pm H[1], \ldots, \pm H[d-1], \pm D)\). More...
 
 Point_d (RT x, RT y, RT w=1)
 introduces a variable p of type Point_d<Kernel> in \( 2\)-dimensional space. More...
 
 Point_d (RT x, RT y, RT z, RT w)
 introduces a variable p of type Point_d<Kernel> in \( 3\)-dimensional space. More...
 

Operations

int dimension ()
 returns the dimension of p. More...
 
FT cartesian (int i)
 returns the \( i\)-th Cartesian coordinate of p. More...
 
FT operator[] (int i)
 returns the \( i\)-th Cartesian coordinate of p. More...
 
RT homogeneous (int i)
 returns the \( i\)-th homogeneous coordinate of p. More...
 
Cartesian_const_iterator cartesian_begin ()
 returns an iterator pointing to the zeroth Cartesian coordinate \( p_0\) of p. More...
 
Cartesian_const_iterator cartesian_end ()
 returns an iterator pointing beyond the last Cartesian coordinate of p. More...
 
Homogeneous_const_iterator homogeneous_begin ()
 returns an iterator pointing to the zeroth homogeneous coordinate \( h_0\) of p. More...
 
Homogeneous_const_iterator homogeneous_end ()
 returns an iterator pointing beyond the last homogeneous coordinate of p. More...
 
Point_d< Kerneltransform (const Aff_transformation_d< Kernel > &t)
 returns \( t(p)\). More...
 

Arithmetic Operators, Tests and IO

Vector_d< Kerneloperator- (const Origin &o)
 returns the vector \( p-O\). More...
 
Vector_d< Kerneloperator- (const Point_d< Kernel > &q)
 returns \( p - q\). More...
 
Point_d< Kerneloperator+ (const Vector_d< Kernel > &v)
 returns \( p + v\). More...
 
Point_d< Kerneloperator- (const Vector_d< Kernel > &v)
 returns \( p - v\). More...
 
Point_d< Kernel > & operator+= (const Vector_d< Kernel > &v)
 adds v to p. More...
 
Point_d< Kernel > & operator-= (const Vector_d< Kernel > &v)
 subtracts v from p. More...
 
bool operator== (const Origin &)
 returns true if p is the origin. More...
 
bool operator< (const Point_d< Kernel > &q)
 returns true iff p is lexicographically smaller than q with respect to Cartesian lexicographic order of points. More...
 
bool operator> (const Point_d< Kernel > &q)
 returns true iff p is lexicographically greater than q with respect to Cartesian lexicographic order of points. More...
 
bool operator<= (const Point_d< Kernel > &q)
 returns true iff p is lexicographically smaller than or equal to q with respect to Cartesian lexicographic order of points. More...
 
bool operator>= (const Point_d< Kernel > &q)
 returns true iff p is lexicographically greater than or equal to q with respect to Cartesian lexicographic order of points. More...
 

Member Typedef Documentation

◆ Cartesian_const_iterator

template<typename Kernel >
typedef unspecified_type CGAL::Point_d< Kernel >::Cartesian_const_iterator

a read-only iterator for the Cartesian coordinates.

◆ Homogeneous_const_iterator

template<typename Kernel >
typedef unspecified_type CGAL::Point_d< Kernel >::Homogeneous_const_iterator

a read-only iterator for the homogeneous coordinates.

◆ LA

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

the linear algebra layer.

Constructor & Destructor Documentation

◆ Point_d() [1/6]

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

introduces a variable p of type Point_d<Kernel>.

◆ Point_d() [2/6]

template<typename Kernel >
CGAL::Point_d< Kernel >::Point_d ( int  d,
Origin   
)

introduces a variable p of type Point_d<Kernel> in \( d\)-dimensional space, initialized to the origin.

◆ Point_d() [3/6]

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

introduces a variable p of type Point_d<Kernel> in dimension d.

If size [first,last) == d this creates a point with Cartesian coordinates set [first,last). If size [first,last) == d+1 the range specifies the homogeneous coordinates \( H = set [first,last) = (\pm h_0, \pm h_1, \ldots, \pm h_d)\) where the sign chosen is the sign of \( h_d\).

Precondition
d is nonnegative, [first,last) has d or d+1 elements where the last has to be non-zero.
Template Parameters
InputIteratorhas RT as value type.

◆ Point_d() [4/6]

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

introduces a variable p of type Point_d<Kernel> in dimension d initialized to the point with homogeneous coordinates as defined by H = set [first,last) and D: \( (\pm H[0], \pm H[1], \ldots, \pm H[d-1], \pm D)\).

The sign chosen is the sign of \( D\).

Precondition
D is non-zero, the iterator range defines a \( d\)-tuple of RT.
Template Parameters
InputIteratorhas RT as value type.

◆ Point_d() [5/6]

template<typename Kernel >
CGAL::Point_d< Kernel >::Point_d ( RT  x,
RT  y,
RT  w = 1 
)

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

Precondition
\( w \neq0\).

◆ Point_d() [6/6]

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

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

Precondition
\( w \neq0\).

Member Function Documentation

◆ cartesian()

template<typename Kernel >
FT CGAL::Point_d< Kernel >::cartesian ( int  i)

returns the \( i\)-th Cartesian coordinate of p.

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

◆ cartesian_begin()

template<typename Kernel >
Cartesian_const_iterator CGAL::Point_d< Kernel >::cartesian_begin ( )

returns an iterator pointing to the zeroth Cartesian coordinate \( p_0\) of p.

◆ cartesian_end()

template<typename Kernel >
Cartesian_const_iterator CGAL::Point_d< Kernel >::cartesian_end ( )

returns an iterator pointing beyond the last Cartesian coordinate of p.

◆ dimension()

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

returns the dimension of p.

◆ homogeneous()

template<typename Kernel >
RT CGAL::Point_d< Kernel >::homogeneous ( int  i)

returns the \( i\)-th homogeneous coordinate of p.

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

◆ homogeneous_begin()

template<typename Kernel >
Homogeneous_const_iterator CGAL::Point_d< Kernel >::homogeneous_begin ( )

returns an iterator pointing to the zeroth homogeneous coordinate \( h_0\) of p.

◆ homogeneous_end()

template<typename Kernel >
Homogeneous_const_iterator CGAL::Point_d< Kernel >::homogeneous_end ( )

returns an iterator pointing beyond the last homogeneous coordinate of p.

◆ operator+()

template<typename Kernel >
Point_d<Kernel> CGAL::Point_d< Kernel >::operator+ ( const Vector_d< Kernel > &  v)

returns \( p + v\).

Precondition
p.dimension() == v.dimension().

◆ operator+=()

template<typename Kernel >
Point_d<Kernel>& CGAL::Point_d< Kernel >::operator+= ( const Vector_d< Kernel > &  v)

adds v to p.

Precondition
p.dimension() == v.dimension().

◆ operator-() [1/3]

template<typename Kernel >
Vector_d<Kernel> CGAL::Point_d< Kernel >::operator- ( const Origin o)

returns the vector \( p-O\).

◆ operator-() [2/3]

template<typename Kernel >
Vector_d<Kernel> CGAL::Point_d< Kernel >::operator- ( const Point_d< Kernel > &  q)

returns \( p - q\).

Precondition
p.dimension() == q.dimension().

◆ operator-() [3/3]

template<typename Kernel >
Point_d<Kernel> CGAL::Point_d< Kernel >::operator- ( const Vector_d< Kernel > &  v)

returns \( p - v\).

Precondition
p.dimension() == v.dimension().

◆ operator-=()

template<typename Kernel >
Point_d<Kernel>& CGAL::Point_d< Kernel >::operator-= ( const Vector_d< Kernel > &  v)

subtracts v from p.

Precondition
p.dimension() == v.dimension().

◆ operator<()

template<typename Kernel >
bool CGAL::Point_d< Kernel >::operator< ( const Point_d< Kernel > &  q)

returns true iff p is lexicographically smaller than q with respect to Cartesian lexicographic order of points.

Precondition
p.dimension() == q.dimension().

◆ operator<=()

template<typename Kernel >
bool CGAL::Point_d< Kernel >::operator<= ( const Point_d< Kernel > &  q)

returns true iff p is lexicographically smaller than or equal to q with respect to Cartesian lexicographic order of points.

Precondition
p.dimension() == q.dimension().

◆ operator==()

template<typename Kernel >
bool CGAL::Point_d< Kernel >::operator== ( const Origin )

returns true if p is the origin.

◆ operator>()

template<typename Kernel >
bool CGAL::Point_d< Kernel >::operator> ( const Point_d< Kernel > &  q)

returns true iff p is lexicographically greater than q with respect to Cartesian lexicographic order of points.

Precondition
p.dimension() == q.dimension().

◆ operator>=()

template<typename Kernel >
bool CGAL::Point_d< Kernel >::operator>= ( const Point_d< Kernel > &  q)

returns true iff p is lexicographically greater than or equal to q with respect to Cartesian lexicographic order of points.

Precondition
p.dimension() == q.dimension().

◆ operator[]()

template<typename Kernel >
FT CGAL::Point_d< Kernel >::operator[] ( int  i)

returns the \( i\)-th Cartesian coordinate of p.

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

◆ transform()

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

returns \( t(p)\).