CGAL 4.12 - dD Geometry Kernel
|
#include <CGAL/Kernel_d/Point_d.h>
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. | |
typedef unspecified_type | Cartesian_const_iterator |
a read-only iterator for the Cartesian coordinates. | |
typedef unspecified_type | Homogeneous_const_iterator |
a read-only iterator for the homogeneous coordinates. | |
Creation | |
Point_d () | |
introduces a variable p of type 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. | |
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 . | |
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 . | |
Cartesian_const_iterator | cartesian_end () |
returns an iterator pointing beyond the last Cartesian coordinate of p . | |
Homogeneous_const_iterator | homogeneous_begin () |
returns an iterator pointing to the zeroth homogeneous coordinate \( h_0\) of p . | |
Homogeneous_const_iterator | homogeneous_end () |
returns an iterator pointing beyond the last homogeneous coordinate of p . | |
Point_d< Kernel > | transform (const Aff_transformation_d< Kernel > &t) |
returns \( t(p)\). | |
Arithmetic Operators, Tests and IO | |
Vector_d< Kernel > | operator- (const Origin &o) |
returns the vector \( p-O\). | |
Vector_d< Kernel > | operator- (const Point_d< Kernel > &q) |
returns \( p - q\). More... | |
Point_d< Kernel > | operator+ (const Vector_d< Kernel > &v) |
returns \( p + v\). More... | |
Point_d< Kernel > | operator- (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. | |
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... | |
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\).
d
is nonnegative, [first,last)
has d
or d+1
elements where the last has to be non-zero. InputIterator | has RT as value type. |
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\).
D
is non-zero, the iterator range defines a \( d\)-tuple of RT
. InputIterator | has RT as value type. |
CGAL::Point_d< Kernel >::Point_d | ( | RT | x, |
RT | y, | ||
RT | w = 1 |
||
) |
CGAL::Point_d< Kernel >::Point_d | ( | RT | x, |
RT | y, | ||
RT | z, | ||
RT | w | ||
) |
FT CGAL::Point_d< Kernel >::cartesian | ( | int | i | ) |
returns the \( i\)-th Cartesian coordinate of p
.
RT CGAL::Point_d< Kernel >::homogeneous | ( | int | i | ) |
returns the \( i\)-th homogeneous coordinate of p
.
Point_d<Kernel> CGAL::Point_d< Kernel >::operator+ | ( | const Vector_d< Kernel > & | v | ) |
returns \( p + v\).
p.dimension() == v.dimension()
. Point_d<Kernel>& CGAL::Point_d< Kernel >::operator+= | ( | const Vector_d< Kernel > & | v | ) |
adds v
to p
.
p.dimension() == v.dimension()
. Vector_d<Kernel> CGAL::Point_d< Kernel >::operator- | ( | const Point_d< Kernel > & | q | ) |
returns \( p - q\).
p.dimension() == q.dimension()
. Point_d<Kernel> CGAL::Point_d< Kernel >::operator- | ( | const Vector_d< Kernel > & | v | ) |
returns \( p - v\).
p.dimension() == v.dimension()
. Point_d<Kernel>& CGAL::Point_d< Kernel >::operator-= | ( | const Vector_d< Kernel > & | v | ) |
subtracts v
from p
.
p.dimension() == v.dimension()
. 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.
p.dimension() == q.dimension()
. 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.
p.dimension() == q.dimension()
. 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.
p.dimension() == q.dimension()
. 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.
p.dimension() == q.dimension()
. FT CGAL::Point_d< Kernel >::operator[] | ( | int | i | ) |
returns the \( i\)-th Cartesian coordinate of p
.