DGtal
0.6.devel
|
#include <PointVector.h>
Public Types | |
enum | NormType { L_2, L_1, L_infty } |
typedef PointVector< dim, TEuclideanRing > | Self |
typedef TEuclideanRing | Component |
typedef Component | Coordinate |
typedef NumberTraits < Component >::UnsignedVersion | UnsignedComponent |
typedef DGtal::Dimension | Dimension |
typedef boost::array < Component, dimension > ::iterator | Iterator |
typedef boost::array < Component, dimension > ::const_iterator | ConstIterator |
typedef boost::array < Component, dimension > ::reverse_iterator | ReverseIterator |
typedef boost::array < Component, dimension > ::const_reverse_iterator | ConstReverseIterator |
Public Member Functions | |
BOOST_CONCEPT_ASSERT ((CEuclideanRing< TEuclideanRing >)) | |
PointVector () | |
PointVector (const Component *ptrValues) | |
PointVector (const Component &x, const Component &y) | |
PointVector (const Component &x, const Component &y, const Component &z) | |
PointVector (const Component &x, const Component &y, const Component &z, const Component &t) | |
template<typename Functor > | |
PointVector (const Self &apoint1, const Self &apoint2, const Functor &f) | |
~PointVector () | |
PointVector (const Self &other) | |
template<typename OtherComponent > | |
PointVector (const PointVector< dim, OtherComponent > &other) | |
Self & | operator= (const Self &pv) |
Self & | partialCopy (const Self &pv, const std::vector< Dimension > &dimensions) |
Self & | partialCopyInv (const Self &pv, const std::vector< Dimension > &dimensions) |
bool | partialEqual (const Self &pv, const std::vector< Dimension > &dimensions) const |
bool | partialEqualInv (const Self &pv, const std::vector< Dimension > &dimensions) const |
Iterator | begin () |
Iterator | end () |
ConstIterator | begin () const |
ConstIterator | end () const |
ReverseIterator | rbegin () |
ReverseIterator | rend () |
ConstReverseIterator | rbegin () const |
ConstReverseIterator | rend () const |
const Component & | at (Dimension i) const |
Component & | at (Dimension i) |
const Component & | operator[] (Dimension i) const |
Component & | operator[] (Dimension i) |
bool | operator== (const Self &pv) const |
bool | operator!= (const Self &pv) const |
bool | operator< (const Self &pv) const |
bool | operator<= (const Self &pv) const |
bool | operator> (const Self &pv) const |
bool | operator>= (const Self &pv) const |
PointVector & | operator*= (Component coeff) |
PointVector | operator* (Component coeff) const |
Component | dot (const Self &v) const |
Self & | operator+= (const Self &v) |
Self | operator+ (const Self &v) const |
Self & | operator-= (const Self &v) |
Self | operator- (const Self &v) const |
Self & | operator/= (const Self &v) |
Self | operator/ (const Self &v) const |
Self | operator/ (const Component coeff) |
Self & | operator/= (const Component coeff) |
template<typename AnotherComponent > | |
Self & | operator= (const PointVector< dim, AnotherComponent > &v) |
void | reset () |
Self | inf (const Self &apoint) const |
Self | sup (const Self &apoint) const |
bool | isLower (const Self &p) const |
bool | isUpper (const Self &p) const |
Component | max () const |
Component | min () const |
Iterator | maxElement () |
Iterator | minElement () |
void | negate () |
double | norm (const NormType type=L_2) const |
UnsignedComponent | norm1 () const |
UnsignedComponent | normInfinity () const |
PointVector< dim, double > | getNormalized () const |
std::string | className () const |
void | selfDisplay (std::ostream &out) const |
bool | isValid () const |
template<typename Component2 > | |
DGtal::PointVector< dim, TComponent > & | operator= (const DGtal::PointVector< dim, Component2 > &v) |
Static Public Member Functions | |
static Dimension | size () |
static Self | diagonal (Component val=1) |
static Self | base (Dimension k, Component val=1) |
Data Fields | |
boost::array< Component, dimension > | myArray |
Static Public Attributes | |
static const Dimension | dimension = dim |
static Self | zero |
Aim: Implements basic operations that will be used in Point and Vector classes.
Description of class 'PointVector'
A PointVector may represent either a symbolic point or a symbolic vector depending on the context. The coordinates of the point or the components of the vector should be part of a ring. For performance reasons, these two types are just aliases. The user should take care how to use it depending on the context. For instance, adding two points has no meaning, but will be authorized by the compiler.
dim | static constant of type DGtal::Dimension that specifies the static dimension of the space and thus the number of elements of the Point or Vector. |
TEuclideanRing | speficies the number type assoicated to an Euclidean domain (or Euclidean ring) algebraic structure (commutative unitary ring with no zero divisors and with a division operator but not necessarily an inverse for the multiplication operator). This type is used to represent PointVector elements (Coordinate for Point and Component for Vector) and define operations on Point or Vectors. |
If TEuclideanRing is a Integer type (built-in integers, BigIntegers, ...), the "/" operator on Points corresponds to component by component Euclidean division.
If TEuclideanRing is a double, the "/" operator on Points correspond to the classical division on real numbers (x*1/x = 1).
The default less than operator is the one of the lexicographic ordering, starting from dimension 0 to N-1.
PointVector also realizes the concept CLattice with an infimum (meet, greatest lower bound) and a supremum (join, least upper bound) operation.
Usage example:
PointVector is a model of CBidirectionalRange.
Definition at line 153 of file PointVector.h.
typedef TEuclideanRing DGtal::PointVector< dim, TEuclideanRing >::Component |
Type for Vector elements.
Definition at line 164 of file PointVector.h.
typedef boost::array<Component, dimension>::const_iterator DGtal::PointVector< dim, TEuclideanRing >::ConstIterator |
Definition at line 189 of file PointVector.h.
typedef boost::array<Component, dimension>::const_reverse_iterator DGtal::PointVector< dim, TEuclideanRing >::ConstReverseIterator |
Definition at line 191 of file PointVector.h.
typedef Component DGtal::PointVector< dim, TEuclideanRing >::Coordinate |
Type for Point elements.
Definition at line 167 of file PointVector.h.
typedef DGtal::Dimension DGtal::PointVector< dim, TEuclideanRing >::Dimension |
Copy of the dimension type.
Definition at line 173 of file PointVector.h.
typedef boost::array<Component, dimension>::iterator DGtal::PointVector< dim, TEuclideanRing >::Iterator |
Copy of the Boost::array iterator type
Definition at line 188 of file PointVector.h.
typedef boost::array<Component, dimension>::reverse_iterator DGtal::PointVector< dim, TEuclideanRing >::ReverseIterator |
Definition at line 190 of file PointVector.h.
typedef PointVector<dim, TEuclideanRing> DGtal::PointVector< dim, TEuclideanRing >::Self |
Self type.
Definition at line 161 of file PointVector.h.
typedef NumberTraits<Component>::UnsignedVersion DGtal::PointVector< dim, TEuclideanRing >::UnsignedComponent |
Unsigned version of the components.
Definition at line 170 of file PointVector.h.
enum DGtal::PointVector::NormType |
Specify the set of norm types
Definition at line 695 of file PointVector.h.
|
inline |
Constructor.
Definition at line 70 of file PointVector.ih.
|
inlineexplicit |
Constructor from array of values.
ptrValues | the array of values. |
Definition at line 94 of file PointVector.ih.
|
inline |
Constructor from two values (the Dimension of the vector should be at least 2). Other components are set to 0.
x | the first value. |
y | the second value. |
Definition at line 103 of file PointVector.ih.
|
inline |
Constructor from three values (the Dimension of the vector should be at least 3). Other components are set to 0.
x | the first value. |
y | the second value. |
z | the third value. |
Definition at line 114 of file PointVector.ih.
|
inline |
Constructor from four values (the Dimension of the vector should be at least 4). Other components are set to 0.
x | the first value. |
y | the second value. |
z | the third value. |
t | the fourth value. |
Definition at line 128 of file PointVector.ih.
|
inline |
Constructor taking apoint and a functor as parameters. The new point is initialized by the result of functor f for each coordinate of apoint1 and apoint2
Definition at line 79 of file PointVector.ih.
|
inline |
|
inline |
Copy constructor.
other | the object to clone. |
Definition at line 157 of file PointVector.ih.
|
inline |
Copy constructor from another component PointVector. A static cast is used to cast the values during the copy.
other | the object to clone. |
Definition at line 164 of file PointVector.ih.
|
inline |
Returns the i-th coefficient of the vector.
i | is the index of the retrieved coefficient. |
Definition at line 245 of file PointVector.ih.
Referenced by DGtal::FreemanChain< TInteger >::cleanOuterSpikes(), DGtal::FreemanChain< TInteger >::computeBoundingBox(), DGtal::FreemanChain< TInteger >::ConstIterator::ConstIterator(), DGtal::deprecated::Point3dTo2dXY< Coordinate >::get(), DGtal::deprecated::Point3dTo2dXZ< Coordinate >::get(), DGtal::deprecated::Point3dTo2dYZ< Coordinate >::get(), DGtal::CombinatorialDSS< TConstIterator, TInteger >::getArithmeticalDescription(), DGtal::ContourHelper::getMeanPoint(), DGtal::FreemanChain< TInteger >::movePointFromFC(), DGtal::FreemanChain< TInteger >::operator+(), DGtal::FreemanChain< TInteger >::operator+=(), and DGtal::FreemanChain< TInteger >::subChain().
|
inline |
Returns a non-const reference to the i-th element of the vector.
i | is the index of the retrieved coefficient. |
Definition at line 254 of file PointVector.ih.
|
inlinestatic |
k | any number between 0 and Dimension-1. |
val | any value. |
Definition at line 720 of file PointVector.ih.
References DGtal::PointVector< dim, TEuclideanRing >::myArray.
|
inline |
PointVector begin() iterator.
Definition at line 173 of file PointVector.ih.
References DGtal::PointVector< dim, TEuclideanRing >::begin().
Referenced by DGtal::PointVector< dim, TEuclideanRing >::begin(), and DGtal::HyperRectDomain< TSpace >::size().
|
inline |
PointVector begin() const iterator.
Definition at line 189 of file PointVector.ih.
References DGtal::PointVector< dim, TEuclideanRing >::begin().
DGtal::PointVector< dim, TEuclideanRing >::BOOST_CONCEPT_ASSERT | ( | (CEuclideanRing< TEuclideanRing >) | ) |
|
inline |
Default drawing style object.
Definition at line 742 of file PointVector.ih.
Referenced by DGtal::Display3DFactory::draw(), and DGtal::Display2DFactory::draw().
|
inlinestatic |
val | any value. |
Definition at line 709 of file PointVector.ih.
References DGtal::PointVector< dim, TEuclideanRing >::myArray.
|
inline |
dot product with a PointVector
v | a vector that is dot-producted to *this. |
Definition at line 526 of file PointVector.ih.
|
inline |
PointVector end() iterator.
Definition at line 181 of file PointVector.ih.
References DGtal::PointVector< dim, TEuclideanRing >::end().
Referenced by DGtal::PointVector< dim, TEuclideanRing >::end(), and DGtal::HyperRectDomain< TSpace >::size().
|
inline |
PointVector end() const iterator.
Definition at line 197 of file PointVector.ih.
References DGtal::PointVector< dim, TEuclideanRing >::end().
|
inline |
Compute the normalization of a given vector (*this) and return a unitary vector on double.
Definition at line 699 of file PointVector.ih.
References DGtal::PointVector< dim, TEuclideanRing >::norm().
|
inline |
Implements the infimum (or greatest lower bound). It means the point whose coordinates are exactly the minimum of the two points coordinate by coordinate.
apoint | any point. |
Definition at line 554 of file PointVector.ih.
|
inline |
p | any point. |
Definition at line 570 of file PointVector.ih.
|
inline |
p | any point. |
Definition at line 581 of file PointVector.ih.
|
inline |
Checks the validity/consistency of the object.
Definition at line 761 of file PointVector.ih.
|
inline |
Return the maximum component value of a point/vector.
Definition at line 592 of file PointVector.ih.
|
inline |
Return the iterator on the component with maximim value of a point/vector.
Definition at line 608 of file PointVector.ih.
|
inline |
Return the minimum component value of a point/vector.
Definition at line 600 of file PointVector.ih.
|
inline |
Return the iterator on the component with minimum value of a point/vector.
Definition at line 616 of file PointVector.ih.
|
inline |
Negates this vector.
Definition at line 625 of file PointVector.ih.
Referenced by DGtal::COBANaivePlane< TSpace, TInternalInteger >::doubleCut().
|
inline |
Computes the norm of a point/vector.
type | specifies the type of norm to consider (see NormType). |
Definition at line 634 of file PointVector.ih.
References DGtal::NumberTraits< T >::castToDouble().
Referenced by DGtal::FPLengthEstimator< TConstIterator >::eval(), DGtal::MLPLengthEstimator< TConstIterator >::eval(), DGtal::DigitalSurface< TDigitalSurfaceContainer >::exportEmbeddedIteratedSurfaceAs3DNOFF(), DGtal::PointVector< dim, TEuclideanRing >::getNormalized(), and DGtal::ArithmeticalDSS< TIterator, TInteger, connectivity >::projectedSegmentLength().
|
inline |
Computes the 1-norm of a vector.
Definition at line 666 of file PointVector.ih.
|
inline |
Computes the infinity-norm of a vector.
Definition at line 681 of file PointVector.ih.
|
inline |
Difference operator on Points/Vectors.
pv | the Point/Vector to compare to this. |
Definition at line 419 of file PointVector.ih.
References DGtal::PointVector< dim, TEuclideanRing >::myArray.
DGtal::PointVector< dim, TComponent > DGtal::PointVector< dim, TComponent >::operator* | ( | Component | coeff | ) | const |
Multiplication operator with a scalar number
coeff | is the factor 'this' is multiplied by. |
Definition at line 289 of file PointVector.ih.
DGtal::PointVector< dim, TComponent > & DGtal::PointVector< dim, TComponent >::operator*= | ( | Component | coeff | ) |
Multiplies *this by the coeff scalar number.
coeff | is the factor *this get multiplied by. |
Definition at line 280 of file PointVector.ih.
|
inline |
Addition operator.
v | is the Point that gets added to *this. |
Definition at line 469 of file PointVector.ih.
|
inline |
Addition operator with assignement.
v | is the Point that gets added to *this. |
Definition at line 459 of file PointVector.ih.
|
inline |
Substraction operator. Point - Vector => Point
v | is the Point that gets added to *this. |
Definition at line 537 of file PointVector.ih.
|
inline |
Substraction operator with assignement.
v | is the Point that gets substracted to *this. |
Definition at line 477 of file PointVector.ih.
|
inline |
Division operator.
v | is the Point that gets divided to *this. |
Definition at line 497 of file PointVector.ih.
|
inline |
|
inline |
Division operator with assignement.
v | is the Point that gets divided to *this. |
Definition at line 487 of file PointVector.ih.
|
inline |
Divides *this by the coeff scalar number.
coeff | is the factor *this get divided by. |
Definition at line 505 of file PointVector.ih.
|
inline |
Comparison operator on Points/Vectors (LesserThan).
pv | the Point/Vector to compare to this. |
Definition at line 427 of file PointVector.ih.
References DGtal::PointVector< dim, TEuclideanRing >::myArray.
|
inline |
Comparison operator on Points/Vectors (LesserOrEqualThan).
pv | the Point/Vector to compare to this. |
Definition at line 435 of file PointVector.ih.
References DGtal::PointVector< dim, TEuclideanRing >::myArray.
|
inline |
Assignement Operator
other | the object to copy. |
Definition at line 299 of file PointVector.ih.
References DGtal::PointVector< dim, TEuclideanRing >::myArray.
|
inline |
Self& DGtal::PointVector< dim, TEuclideanRing >::operator= | ( | const PointVector< dim, AnotherComponent > & | v | ) |
Assignment operator from PointVector with different component type. A static cast is used to cast the values during the copy.
v | is the Point that gets divided to *this. |
|
inline |
Equality operator.
pv | Point/Vector to compare to this. |
Definition at line 411 of file PointVector.ih.
References DGtal::PointVector< dim, TEuclideanRing >::myArray.
|
inline |
Comparison operator on Points/Vectors (GreaterThan).
pv | the Point/Vector to compare to this. |
Definition at line 443 of file PointVector.ih.
References DGtal::PointVector< dim, TEuclideanRing >::myArray.
|
inline |
Comparison operator on Points/Vectors (GreaterOrEqualThan).
pv | the Point/Vector to compare to this. |
Definition at line 451 of file PointVector.ih.
References DGtal::PointVector< dim, TEuclideanRing >::myArray.
|
inline |
Returns the i-th coefficient of the vector.
i | is the index of the retrieved coefficient. |
Definition at line 263 of file PointVector.ih.
|
inline |
Returns a non-const reference to the i-th element of the vector.
i | is the index of the retrieved coefficient. |
Definition at line 272 of file PointVector.ih.
|
inline |
Partial copy of a given PointVector. Only coordinates in dimensions are copied.
other | the object to copy. |
dim | the dimensions of v to copy (Size between 0 and N, all differents). |
Definition at line 352 of file PointVector.ih.
References DGtal::PointVector< dim, TEuclideanRing >::myArray.
|
inline |
Partial copy of a given PointVector. Only coordinates not in dimensions are copied.
other | the object to copy. |
dim | the dimensions of v to copy (Size between 0 and N, all differents). |
Definition at line 367 of file PointVector.ih.
References DGtal::PointVector< dim, TEuclideanRing >::myArray.
Referenced by DGtal::HyperRectDomain< TSpace >::ConstSubRange::ConstSubRange().
|
inline |
Partial equality.
pv | Point/Vector to compare to this. |
Definition at line 382 of file PointVector.ih.
References DGtal::PointVector< dim, TEuclideanRing >::myArray.
|
inline |
Partial inverse equality.
pv | Point/Vector to compare to this. |
Definition at line 397 of file PointVector.ih.
References DGtal::PointVector< dim, TEuclideanRing >::myArray.
Referenced by DGtal::HyperRectDomain< TSpace >::ConstSubRange::begin().
|
inline |
PointVector rbegin() reverse iterator.
Definition at line 205 of file PointVector.ih.
References DGtal::PointVector< dim, TEuclideanRing >::rbegin().
Referenced by DGtal::PointVector< dim, TEuclideanRing >::rbegin().
|
inline |
PointVector rbegin() const reverse iterator.
Definition at line 221 of file PointVector.ih.
References DGtal::PointVector< dim, TEuclideanRing >::rbegin().
|
inline |
PointVector rend() reverse iterator.
Definition at line 213 of file PointVector.ih.
References DGtal::PointVector< dim, TEuclideanRing >::rend().
Referenced by DGtal::PointVector< dim, TEuclideanRing >::rend().
|
inline |
PointVector rend() const reverse iterator.
Definition at line 229 of file PointVector.ih.
References DGtal::PointVector< dim, TEuclideanRing >::rend().
|
inline |
Resets all the values to zero.
Definition at line 545 of file PointVector.ih.
|
inline |
Writes/Displays the object on an output stream.
out | the output stream where the object is written. |
Definition at line 730 of file PointVector.ih.
|
inlinestatic |
Returns the size of the vector (i.e. the number of its coefficients). Same as getDimension
Definition at line 237 of file PointVector.ih.
Referenced by DGtal::ContourHelper::getMeanPoint().
|
inline |
Implements the supremum (or least upper bound). It means the point whose coordinates are exactly the maximum of the two points coordinate by coordinate.
apoint | any point. |
Definition at line 562 of file PointVector.ih.
|
static |
Copy of the static dimension of the Point/Vector.
Definition at line 176 of file PointVector.h.
boost::array<Component, dimension> DGtal::PointVector< dim, TEuclideanRing >::myArray |
Internal data-structure: boost/array with constant size.
Definition at line 796 of file PointVector.h.
Referenced by DGtal::PointVector< dim, TEuclideanRing >::base(), DGtal::PointVector< dim, TEuclideanRing >::diagonal(), DGtal::Display3DFactory::draw(), DGtal::Display2DFactory::draw(), DGtal::Display3DFactory::drawAsGrid(), DGtal::Display2DFactory::drawAsGrid(), DGtal::Display3DFactory::drawAsPaving(), DGtal::Display2DFactory::drawAsPaving(), DGtal::Display3DFactory::drawAsPavingWired(), DGtal::PointVector< dim, TEuclideanRing >::operator!=(), DGtal::PointVector< dim, TEuclideanRing >::operator<(), DGtal::PointVector< dim, TEuclideanRing >::operator<=(), DGtal::PointVector< dim, TEuclideanRing >::operator=(), DGtal::PointVector< dim, TEuclideanRing >::operator==(), DGtal::PointVector< dim, TEuclideanRing >::operator>(), DGtal::PointVector< dim, TEuclideanRing >::operator>=(), DGtal::PointVector< dim, TEuclideanRing >::partialCopy(), DGtal::PointVector< dim, TEuclideanRing >::partialCopyInv(), DGtal::PointVector< dim, TEuclideanRing >::partialEqual(), and DGtal::PointVector< dim, TEuclideanRing >::partialEqualInv().
|
static |
Static const for zero PointVector.
Definition at line 787 of file PointVector.h.