DGtal  0.9.4beta
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Attributes
DGtal::PointVector< dim, TEuclideanRing, TContainer > Class Template Reference

#include <DGtal/kernel/PointVector.h>

Inheritance diagram for DGtal::PointVector< dim, TEuclideanRing, TContainer >:
[legend]
Collaboration diagram for DGtal::PointVector< dim, TEuclideanRing, TContainer >:
[legend]

Public Types

enum  NormType { L_2, L_1, L_infty }
 
typedef PointVector< dim, TEuclideanRing, TContainer > Self
 
typedef TEuclideanRing Component
 
typedef Component Coordinate
 
typedef NumberTraits< Component >::UnsignedVersion UnsignedComponent
 
typedef DGtal::Dimension Dimension
 
typedef Component Scalar
 
typedef Dimension Index
 
typedef TContainer Container
 
typedef Container::iterator Iterator
 
typedef Container::const_iterator ConstIterator
 
typedef Container::reverse_iterator ReverseIterator
 
typedef Container::const_reverse_iterator ConstReverseIterator
 

Public Member Functions

 BOOST_CONCEPT_ASSERT ((concepts::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)
 
 PointVector (std::initializer_list< Component > init)
 
template<typename BinaryFunctor >
 PointVector (const Self &apoint1, const Self &apoint2, const BinaryFunctor &f)
 
template<typename UnaryFunctor >
 PointVector (const Self &apoint1, const UnaryFunctor &f)
 
 ~PointVector ()
 
 PointVector (const Self &other)
 
template<typename OtherComponent , typename OtherCont >
 PointVector (const PointVector< dim, OtherComponent, OtherCont > &other)
 
Selfoperator= (const Self &pv)
 
SelfpartialCopy (const Self &pv, std::initializer_list< Dimension > dimensions)
 
SelfpartialCopyInv (const Self &pv, std::initializer_list< Dimension > dimensions)
 
SelfpartialCopy (const Self &pv, const std::vector< Dimension > &dimensions)
 
SelfpartialCopyInv (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
 
Dimension rows () const
 
const Componentoperator[] (Dimension i) const
 
const Componentoperator() (Dimension i) const
 
Componentoperator[] (Dimension i)
 
Componentoperator() (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
 
PointVectoroperator*= (Component coeff)
 
PointVector operator* (Component coeff) const
 
Component dot (const Self &v) const
 
Self crossProduct (const Self &v) const
 
double cosineSimilarity (const Self &v) const
 
Selfoperator+= (const Self &v)
 
Self operator+ (const Self &v) const
 
Selfoperator-= (const Self &v)
 
Self operator- (const Self &v) const
 
Self operator- () const
 
Selfoperator/= (const Self &v)
 
Self operator/ (const Self &v) const
 
Self operator/ (const Component coeff) const
 
Selfoperator/= (const Component coeff)
 
template<typename AnotherComponent >
Selfoperator= (const PointVector< dim, AnotherComponent, Container > &v)
 
void reset ()
 
void clear ()
 
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, std::array< double, dim > > getNormalized () const
 
std::string className () const
 
void selfDisplay (std::ostream &out) const
 
bool isValid () const
 

Static Public Member Functions

static Dimension size ()
 
static Self diagonal (Component val=1)
 
static Self base (Dimension k, Component val=1)
 

Static Public Attributes

static const Dimension dimension = dim
 
static Self zero
 

Protected Attributes

Container myArray
 

Detailed Description

template<DGtal::Dimension dim, typename TEuclideanRing, typename TContainer = std::array<TEuclideanRing,dim>>
class DGtal::PointVector< dim, TEuclideanRing, TContainer >

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.

Template Parameters
dimstatic constant of type DGtal::Dimension that specifies the static dimension of the space and thus the number of elements of the Point or Vector.
TEuclideanRingspeficies 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.
TContainerspecifies the container to be used to store the point coordinates. At this point, such container must be a random access bidirectionnal a-la STL containers (e.g. vector, boost/array). If TContainer implements comparison operators == != < <= > <=, then PointVector will also implements it and with the exact same behaviour.

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:

...
typedef PointVector<5, int> VectorD5;
VectorD5 p, q, r;
p[1] = 2; // p = {0, 2, 0, 0, 0}
q[3] = -5 // q = {0, 0, 0, -5, 0}
r = p + q ; // r = {0, 2, 0, -5, 0}
...

PointVector is a model of CBidirectionalRange.

See also
testPointVector.cpp
Examples:
dec/exampleDiscreteExteriorCalculusSolve.cpp, doc-examples/exampleCatch.cpp, geometry/curves/estimation/exampleCurvature.cpp, geometry/curves/exampleArithDSS3d.cpp, geometry/surfaces/dvcm-3d.cpp, geometry/tools/determinant/exampleInHalfPlane.cpp, geometry/volumes/dvcm-2d.cpp, images/extract2DImagesFrom3D.cpp, images/extract2DImagesFrom3DandVisu.cpp, io/boards/exampleBezierCurve.cpp, io/viewDualSurface.cpp, io/viewers/viewer3D-8bis-2Dimages.cpp, shapes/exampleEuclideanShapesDecorator.cpp, topology/cubical-complex-collapse.cpp, topology/frontierAndBoundary.cpp, topology/trackImplicitPolynomialSurfaceToOFF.cpp, tutorial-examples/AreaSurfaceEstimation-final.cpp, and tutorial-examples/volDTGranulo.cpp.

Definition at line 141 of file PointVector.h.

Member Typedef Documentation

template<DGtal::Dimension dim, typename TEuclideanRing, typename TContainer = std::array<TEuclideanRing,dim>>
typedef TEuclideanRing DGtal::PointVector< dim, TEuclideanRing, TContainer >::Component

Type for Vector elements.

Definition at line 155 of file PointVector.h.

template<DGtal::Dimension dim, typename TEuclideanRing, typename TContainer = std::array<TEuclideanRing,dim>>
typedef Container::const_iterator DGtal::PointVector< dim, TEuclideanRing, TContainer >::ConstIterator

Definition at line 182 of file PointVector.h.

template<DGtal::Dimension dim, typename TEuclideanRing, typename TContainer = std::array<TEuclideanRing,dim>>
typedef Container::const_reverse_iterator DGtal::PointVector< dim, TEuclideanRing, TContainer >::ConstReverseIterator

Definition at line 184 of file PointVector.h.

template<DGtal::Dimension dim, typename TEuclideanRing, typename TContainer = std::array<TEuclideanRing,dim>>
typedef TContainer DGtal::PointVector< dim, TEuclideanRing, TContainer >::Container

Copy of the container type.

Definition at line 174 of file PointVector.h.

template<DGtal::Dimension dim, typename TEuclideanRing, typename TContainer = std::array<TEuclideanRing,dim>>
typedef Component DGtal::PointVector< dim, TEuclideanRing, TContainer >::Coordinate

Type for Point elements.

Definition at line 158 of file PointVector.h.

template<DGtal::Dimension dim, typename TEuclideanRing, typename TContainer = std::array<TEuclideanRing,dim>>
typedef DGtal::Dimension DGtal::PointVector< dim, TEuclideanRing, TContainer >::Dimension

Copy of the dimension type.

Definition at line 164 of file PointVector.h.

template<DGtal::Dimension dim, typename TEuclideanRing, typename TContainer = std::array<TEuclideanRing,dim>>
typedef Dimension DGtal::PointVector< dim, TEuclideanRing, TContainer >::Index

Definition at line 171 of file PointVector.h.

template<DGtal::Dimension dim, typename TEuclideanRing, typename TContainer = std::array<TEuclideanRing,dim>>
typedef Container::iterator DGtal::PointVector< dim, TEuclideanRing, TContainer >::Iterator

Copy of the Container iterator types

Definition at line 181 of file PointVector.h.

template<DGtal::Dimension dim, typename TEuclideanRing, typename TContainer = std::array<TEuclideanRing,dim>>
typedef Container::reverse_iterator DGtal::PointVector< dim, TEuclideanRing, TContainer >::ReverseIterator

Definition at line 183 of file PointVector.h.

template<DGtal::Dimension dim, typename TEuclideanRing, typename TContainer = std::array<TEuclideanRing,dim>>
typedef Component DGtal::PointVector< dim, TEuclideanRing, TContainer >::Scalar

Types needed by CLinearAlgebraContainer.

Definition at line 170 of file PointVector.h.

template<DGtal::Dimension dim, typename TEuclideanRing, typename TContainer = std::array<TEuclideanRing,dim>>
typedef PointVector<dim, TEuclideanRing, TContainer> DGtal::PointVector< dim, TEuclideanRing, TContainer >::Self

Self type.

We cannot check the TContainer since boost::array is not a model of boost::RandomAccessContainer

Definition at line 152 of file PointVector.h.

template<DGtal::Dimension dim, typename TEuclideanRing, typename TContainer = std::array<TEuclideanRing,dim>>
typedef NumberTraits<Component>::UnsignedVersion DGtal::PointVector< dim, TEuclideanRing, TContainer >::UnsignedComponent

Unsigned version of the components.

Definition at line 161 of file PointVector.h.

Member Enumeration Documentation

template<DGtal::Dimension dim, typename TEuclideanRing, typename TContainer = std::array<TEuclideanRing,dim>>
enum DGtal::PointVector::NormType

Specify the set of norm types

Enumerator
L_2 
L_1 
L_infty 

Definition at line 718 of file PointVector.h.

Constructor & Destructor Documentation

template<DGtal::Dimension dim, typename TEuclideanRing, typename TContainer = std::array<TEuclideanRing,dim>>
DGtal::PointVector< dim, TEuclideanRing, TContainer >::PointVector ( )

Constructor.

template<DGtal::Dimension dim, typename TEuclideanRing, typename TContainer = std::array<TEuclideanRing,dim>>
DGtal::PointVector< dim, TEuclideanRing, TContainer >::PointVector ( const Component ptrValues)
explicit

Constructor from array of values.

Parameters
ptrValuesthe array of values.
template<DGtal::Dimension dim, typename TEuclideanRing, typename TContainer = std::array<TEuclideanRing,dim>>
DGtal::PointVector< dim, TEuclideanRing, TContainer >::PointVector ( const Component x,
const Component y 
)

Constructor from two values (the Dimension of the vector should be at least 2). Other components are set to 0.

Parameters
xthe first value.
ythe second value.
template<DGtal::Dimension dim, typename TEuclideanRing, typename TContainer = std::array<TEuclideanRing,dim>>
DGtal::PointVector< dim, TEuclideanRing, TContainer >::PointVector ( const Component x,
const Component y,
const Component z 
)

Constructor from three values (the Dimension of the vector should be at least 3). Other components are set to 0.

Parameters
xthe first value.
ythe second value.
zthe third value.
template<DGtal::Dimension dim, typename TEuclideanRing, typename TContainer = std::array<TEuclideanRing,dim>>
DGtal::PointVector< dim, TEuclideanRing, TContainer >::PointVector ( const Component x,
const Component y,
const Component z,
const Component t 
)

Constructor from four values (the Dimension of the vector should be at least 4). Other components are set to 0.

Parameters
xthe first value.
ythe second value.
zthe third value.
tthe fourth value.
template<DGtal::Dimension dim, typename TEuclideanRing, typename TContainer = std::array<TEuclideanRing,dim>>
DGtal::PointVector< dim, TEuclideanRing, TContainer >::PointVector ( std::initializer_list< Component init)

Constructor from initializer list.

Parameters
initthe initializer list.
template<DGtal::Dimension dim, typename TEuclideanRing, typename TContainer = std::array<TEuclideanRing,dim>>
template<typename BinaryFunctor >
DGtal::PointVector< dim, TEuclideanRing, TContainer >::PointVector ( const Self apoint1,
const Self apoint2,
const BinaryFunctor &  f 
)

Constructor taking two points and a functor as parameters. The new point is initialized by the result of functor f applied for each pair of coordinates of apoint1 and apoint2

template<DGtal::Dimension dim, typename TEuclideanRing, typename TContainer = std::array<TEuclideanRing,dim>>
template<typename UnaryFunctor >
DGtal::PointVector< dim, TEuclideanRing, TContainer >::PointVector ( const Self apoint1,
const UnaryFunctor &  f 
)

Constructor taking a point and a unary functor as parameters. The new point is initialized by the result of functor f for each coordinate of apoint1

template<DGtal::Dimension dim, typename TEuclideanRing, typename TContainer = std::array<TEuclideanRing,dim>>
DGtal::PointVector< dim, TEuclideanRing, TContainer >::~PointVector ( )

Destructor.

template<DGtal::Dimension dim, typename TEuclideanRing, typename TContainer = std::array<TEuclideanRing,dim>>
DGtal::PointVector< dim, TEuclideanRing, TContainer >::PointVector ( const Self other)

Copy constructor.

Parameters
otherthe object to clone.
template<DGtal::Dimension dim, typename TEuclideanRing, typename TContainer = std::array<TEuclideanRing,dim>>
template<typename OtherComponent , typename OtherCont >
DGtal::PointVector< dim, TEuclideanRing, TContainer >::PointVector ( const PointVector< dim, OtherComponent, OtherCont > &  other)

Copy constructor from another component PointVector. A static cast is used to cast the values during the copy.

Parameters
otherthe object to clone.

Member Function Documentation

template<DGtal::Dimension dim, typename TEuclideanRing, typename TContainer = std::array<TEuclideanRing,dim>>
static Self DGtal::PointVector< dim, TEuclideanRing, TContainer >::base ( Dimension  k,
Component  val = 1 
)
static
Parameters
kany number between 0 and Dimension-1.
valany value.
Returns
the [k]-th base vector (0,0, ..., 0, val, 0, ..., 0).
template<DGtal::Dimension dim, typename TEuclideanRing, typename TContainer = std::array<TEuclideanRing,dim>>
Iterator DGtal::PointVector< dim, TEuclideanRing, TContainer >::begin ( )

PointVector begin() iterator.

Returns
an Iterator on the first element of a Point/Vector.

Referenced by std::hash< DGtal::PointVector< dim, EuclideanRing, Container > >::operator()(), and DGtal::HyperRectDomain< Space >::size().

template<DGtal::Dimension dim, typename TEuclideanRing, typename TContainer = std::array<TEuclideanRing,dim>>
ConstIterator DGtal::PointVector< dim, TEuclideanRing, TContainer >::begin ( ) const

PointVector begin() const iterator.

Returns
an ConstIterator on the first element of a Point/Vector.
template<DGtal::Dimension dim, typename TEuclideanRing, typename TContainer = std::array<TEuclideanRing,dim>>
DGtal::PointVector< dim, TEuclideanRing, TContainer >::BOOST_CONCEPT_ASSERT ( (concepts::CEuclideanRing< TEuclideanRing >)  )
template<DGtal::Dimension dim, typename TEuclideanRing, typename TContainer = std::array<TEuclideanRing,dim>>
std::string DGtal::PointVector< dim, TEuclideanRing, TContainer >::className ( ) const
Returns
the style name used for drawing this object.
template<DGtal::Dimension dim, typename TEuclideanRing, typename TContainer = std::array<TEuclideanRing,dim>>
void DGtal::PointVector< dim, TEuclideanRing, TContainer >::clear ( )
inline

Resets all the values to zero. Needed by CLinearAlgebraContainer.

Definition at line 641 of file PointVector.h.

641 { reset(); }
template<DGtal::Dimension dim, typename TEuclideanRing, typename TContainer = std::array<TEuclideanRing,dim>>
double DGtal::PointVector< dim, TEuclideanRing, TContainer >::cosineSimilarity ( const Self v) const

Positive angle between two vectors, deduced from their scalar product.

Parameters
vany vector
Returns
the angle between *this and v in [0,pi].
template<DGtal::Dimension dim, typename TEuclideanRing, typename TContainer = std::array<TEuclideanRing,dim>>
Self DGtal::PointVector< dim, TEuclideanRing, TContainer >::crossProduct ( const Self v) const

cross product with a PointVector

Parameters
va vector that is cross-producted to *this.
Returns
the cross product product
template<DGtal::Dimension dim, typename TEuclideanRing, typename TContainer = std::array<TEuclideanRing,dim>>
static Self DGtal::PointVector< dim, TEuclideanRing, TContainer >::diagonal ( Component  val = 1)
static
template<DGtal::Dimension dim, typename TEuclideanRing, typename TContainer = std::array<TEuclideanRing,dim>>
Component DGtal::PointVector< dim, TEuclideanRing, TContainer >::dot ( const Self v) const

dot product with a PointVector

Parameters
va vector that is dot-producted to *this.
Returns
the dot product of this and v.
Examples:
examples/tutorial-examples/polyhedralizer.cpp, topology/cubical-complex-collapse.cpp, tutorial-examples/AreaSurfaceEstimation-final.cpp, and tutorial-examples/polyhedralizer.cpp.
template<DGtal::Dimension dim, typename TEuclideanRing, typename TContainer = std::array<TEuclideanRing,dim>>
Iterator DGtal::PointVector< dim, TEuclideanRing, TContainer >::end ( )

PointVector end() iterator.

Returns
an Iterator on the last element of a Point/Vector.

Referenced by std::hash< DGtal::PointVector< dim, EuclideanRing, Container > >::operator()(), and DGtal::HyperRectDomain< Space >::size().

template<DGtal::Dimension dim, typename TEuclideanRing, typename TContainer = std::array<TEuclideanRing,dim>>
ConstIterator DGtal::PointVector< dim, TEuclideanRing, TContainer >::end ( ) const

PointVector end() const iterator.

Returns
a ConstIterator on the last element of a Point/Vector.
template<DGtal::Dimension dim, typename TEuclideanRing, typename TContainer = std::array<TEuclideanRing,dim>>
PointVector<dim, double, std::array<double,dim> > DGtal::PointVector< dim, TEuclideanRing, TContainer >::getNormalized ( ) const

Compute the normalization of a given vector (*this) and return a unitary vector on double.

Returns
a unitary vector with double as coordiante type.
Advanced:
the point container is forced to boost::array<double,dim>
Examples:
tutorial-examples/AreaSurfaceEstimation-final.cpp.
template<DGtal::Dimension dim, typename TEuclideanRing, typename TContainer = std::array<TEuclideanRing,dim>>
Self DGtal::PointVector< dim, TEuclideanRing, TContainer >::inf ( const Self apoint) const

Implements the infimum (or greatest lower bound). It means the point whose coordinates are exactly the minimum of the two points coordinate by coordinate.

Parameters
apointany point.
Returns
a new point being the inf between *this and apoint.
See also
isLower
template<DGtal::Dimension dim, typename TEuclideanRing, typename TContainer = std::array<TEuclideanRing,dim>>
bool DGtal::PointVector< dim, TEuclideanRing, TContainer >::isLower ( const Self p) const
Parameters
pany point.
Returns
true if this is below p (ie. this==inf(this,p)) NB: faster than computing the infimum and compare it afterwards.

Referenced by DGtal::HyperRectDomain< TSpace >::ConstSubRange::begin().

template<DGtal::Dimension dim, typename TEuclideanRing, typename TContainer = std::array<TEuclideanRing,dim>>
bool DGtal::PointVector< dim, TEuclideanRing, TContainer >::isUpper ( const Self p) const
Parameters
pany point.
Returns
true if this is upper p (ie. this==sup(this,p)) NB: faster than computing the supremum and compare it afterwards.
template<DGtal::Dimension dim, typename TEuclideanRing, typename TContainer = std::array<TEuclideanRing,dim>>
bool DGtal::PointVector< dim, TEuclideanRing, TContainer >::isValid ( ) const

Checks the validity/consistency of the object.

Returns
'true' if the object is valid, 'false' otherwise.
template<DGtal::Dimension dim, typename TEuclideanRing, typename TContainer = std::array<TEuclideanRing,dim>>
Component DGtal::PointVector< dim, TEuclideanRing, TContainer >::max ( ) const

Return the maximum component value of a point/vector.

Returns
the maximum value.
template<DGtal::Dimension dim, typename TEuclideanRing, typename TContainer = std::array<TEuclideanRing,dim>>
Iterator DGtal::PointVector< dim, TEuclideanRing, TContainer >::maxElement ( )

Return the iterator on the component with maximim value of a point/vector.

Returns
an iterator.
template<DGtal::Dimension dim, typename TEuclideanRing, typename TContainer = std::array<TEuclideanRing,dim>>
Component DGtal::PointVector< dim, TEuclideanRing, TContainer >::min ( ) const

Return the minimum component value of a point/vector.

Returns
the minimum value.
template<DGtal::Dimension dim, typename TEuclideanRing, typename TContainer = std::array<TEuclideanRing,dim>>
Iterator DGtal::PointVector< dim, TEuclideanRing, TContainer >::minElement ( )

Return the iterator on the component with minimum value of a point/vector.

Returns
an iterator.
template<DGtal::Dimension dim, typename TEuclideanRing, typename TContainer = std::array<TEuclideanRing,dim>>
void DGtal::PointVector< dim, TEuclideanRing, TContainer >::negate ( )

Negates this vector.

template<DGtal::Dimension dim, typename TEuclideanRing, typename TContainer = std::array<TEuclideanRing,dim>>
double DGtal::PointVector< dim, TEuclideanRing, TContainer >::norm ( const NormType  type = L_2) const

Computes the norm of a point/vector.

Warning
This method performs a conversion from the type T to double for each components to compute the norms. For exact norms (restricted to L_1 and L_infinity norms), please refer to PointVector::norm1 and PointVector::normInfinity.
Parameters
typespecifies the type of norm to consider (see NormType).
Returns
the norm of the point/vector as a double.

Referenced by DGtal::TangentFromDSS3DFunctor< DSS, LambdaFunction >::operator()(), and DGtal::functors::Point2DEmbedderIn3D< TDomain3D, TInteger >::Point2DEmbedderIn3D().

template<DGtal::Dimension dim, typename TEuclideanRing, typename TContainer = std::array<TEuclideanRing,dim>>
UnsignedComponent DGtal::PointVector< dim, TEuclideanRing, TContainer >::norm1 ( ) const

Computes the 1-norm of a vector.

Returns
the absolute sum of the components of this vector.
template<DGtal::Dimension dim, typename TEuclideanRing, typename TContainer = std::array<TEuclideanRing,dim>>
UnsignedComponent DGtal::PointVector< dim, TEuclideanRing, TContainer >::normInfinity ( ) const

Computes the infinity-norm of a vector.

Returns
the maximum absolute value of the components of this vector.
template<DGtal::Dimension dim, typename TEuclideanRing, typename TContainer = std::array<TEuclideanRing,dim>>
bool DGtal::PointVector< dim, TEuclideanRing, TContainer >::operator!= ( const Self pv) const

Difference operator on Points/Vectors.

Parameters
pvthe Point/Vector to compare to this.
Returns
true iff this differs from pv, false otherwise.
Warning
It inherits from operator!= of TContainer.
template<DGtal::Dimension dim, typename TEuclideanRing, typename TContainer = std::array<TEuclideanRing,dim>>
const Component& DGtal::PointVector< dim, TEuclideanRing, TContainer >::operator() ( Dimension  i) const
inline

Definition at line 425 of file PointVector.h.

425 { return (*this)[i]; }
template<DGtal::Dimension dim, typename TEuclideanRing, typename TContainer = std::array<TEuclideanRing,dim>>
Component& DGtal::PointVector< dim, TEuclideanRing, TContainer >::operator() ( Dimension  i)
inline

Definition at line 436 of file PointVector.h.

436 { return (*this)[i]; }
template<DGtal::Dimension dim, typename TEuclideanRing, typename TContainer = std::array<TEuclideanRing,dim>>
PointVector DGtal::PointVector< dim, TEuclideanRing, TContainer >::operator* ( Component  coeff) const

Multiplication operator with a scalar number

Parameters
coeffis the factor 'this' is multiplied by.
Returns
a new Point that is the multiplication of 'this' by coeff.
template<DGtal::Dimension dim, typename TEuclideanRing, typename TContainer = std::array<TEuclideanRing,dim>>
PointVector& DGtal::PointVector< dim, TEuclideanRing, TContainer >::operator*= ( Component  coeff)

Multiplies *this by the coeff scalar number.

Parameters
coeffis the factor *this get multiplied by.
Returns
a reference on 'this'.
template<DGtal::Dimension dim, typename TEuclideanRing, typename TContainer = std::array<TEuclideanRing,dim>>
Self DGtal::PointVector< dim, TEuclideanRing, TContainer >::operator+ ( const Self v) const

Addition operator.

Parameters
vis the Point that gets added to *this.
Returns
a new Point that is the addition of 'this' to [v].
template<DGtal::Dimension dim, typename TEuclideanRing, typename TContainer = std::array<TEuclideanRing,dim>>
Self& DGtal::PointVector< dim, TEuclideanRing, TContainer >::operator+= ( const Self v)

Addition operator with assignement.

Parameters
vis the Point that gets added to *this.
Returns
a reference on 'this'.
template<DGtal::Dimension dim, typename TEuclideanRing, typename TContainer = std::array<TEuclideanRing,dim>>
Self DGtal::PointVector< dim, TEuclideanRing, TContainer >::operator- ( const Self v) const

Substraction operator. Point - Vector => Point

Parameters
vis the Point that gets substracted to *this.
Returns
a new Point that is the subtraction 'this'-[v].
template<DGtal::Dimension dim, typename TEuclideanRing, typename TContainer = std::array<TEuclideanRing,dim>>
Self DGtal::PointVector< dim, TEuclideanRing, TContainer >::operator- ( ) const

Unary minus operator. -Vector => Vector

Returns
a new Vector that is the opposite of 'this', i.e. -'this'.
template<DGtal::Dimension dim, typename TEuclideanRing, typename TContainer = std::array<TEuclideanRing,dim>>
Self& DGtal::PointVector< dim, TEuclideanRing, TContainer >::operator-= ( const Self v)

Substraction operator with assignement.

Parameters
vis the Point that gets substracted to *this.
Returns
a reference on 'this'.
template<DGtal::Dimension dim, typename TEuclideanRing, typename TContainer = std::array<TEuclideanRing,dim>>
Self DGtal::PointVector< dim, TEuclideanRing, TContainer >::operator/ ( const Self v) const

Division operator.

Parameters
vis the Point that gets divided to *this.
Returns
the component division of *this by v.
template<DGtal::Dimension dim, typename TEuclideanRing, typename TContainer = std::array<TEuclideanRing,dim>>
Self DGtal::PointVector< dim, TEuclideanRing, TContainer >::operator/ ( const Component  coeff) const

Divides *this by the coeff scalar number.

Parameters
coeffis the factor *this get divided by.
Returns
the component division of *this by coeff.
template<DGtal::Dimension dim, typename TEuclideanRing, typename TContainer = std::array<TEuclideanRing,dim>>
Self& DGtal::PointVector< dim, TEuclideanRing, TContainer >::operator/= ( const Self v)

Division operator with assignement.

Parameters
vis the Point that gets divided to *this.
Returns
a reference on 'this'.
template<DGtal::Dimension dim, typename TEuclideanRing, typename TContainer = std::array<TEuclideanRing,dim>>
Self& DGtal::PointVector< dim, TEuclideanRing, TContainer >::operator/= ( const Component  coeff)

Divides *this by the coeff scalar number.

Parameters
coeffis the factor *this get divided by.
Returns
a reference on 'this'.
template<DGtal::Dimension dim, typename TEuclideanRing, typename TContainer = std::array<TEuclideanRing,dim>>
bool DGtal::PointVector< dim, TEuclideanRing, TContainer >::operator< ( const Self pv) const

Comparison operator on Points/Vectors (LesserThan).

Parameters
pvthe Point/Vector to compare to this.
Returns
true iff this < pv, false otherwise.
Warning
It inherits from operator< of TContainer. Consequently, it uses the lexicographical order when using default container.
template<DGtal::Dimension dim, typename TEuclideanRing, typename TContainer = std::array<TEuclideanRing,dim>>
bool DGtal::PointVector< dim, TEuclideanRing, TContainer >::operator<= ( const Self pv) const

Comparison operator on Points/Vectors (LesserOrEqualThan).

Parameters
pvthe Point/Vector to compare to this.
Returns
true iff this <= pv, false otherwise.
Warning
It inherits from operator<= of TContainer. Consequently, it uses the lexicographical order when using default container.
template<DGtal::Dimension dim, typename TEuclideanRing, typename TContainer = std::array<TEuclideanRing,dim>>
Self& DGtal::PointVector< dim, TEuclideanRing, TContainer >::operator= ( const Self pv)

Assignement Operator

Parameters
pvthe object to copy.
Returns
a reference on 'this'.
template<DGtal::Dimension dim, typename TEuclideanRing, typename TContainer = std::array<TEuclideanRing,dim>>
template<typename AnotherComponent >
Self& DGtal::PointVector< dim, TEuclideanRing, TContainer >::operator= ( const PointVector< dim, AnotherComponent, Container > &  v)

Assignment operator from PointVector with different component type. A static cast is used to cast the values during the copy.

Parameters
vis the Point that gets divided to *this.
Returns
a reference on 'this'.
template<DGtal::Dimension dim, typename TEuclideanRing, typename TContainer = std::array<TEuclideanRing,dim>>
bool DGtal::PointVector< dim, TEuclideanRing, TContainer >::operator== ( const Self pv) const

Equality operator.

Parameters
pvPoint/Vector to compare to this.
Returns
true iff points are equal.
Warning
It inherits from operator== of TContainer.
template<DGtal::Dimension dim, typename TEuclideanRing, typename TContainer = std::array<TEuclideanRing,dim>>
bool DGtal::PointVector< dim, TEuclideanRing, TContainer >::operator> ( const Self pv) const

Comparison operator on Points/Vectors (GreaterThan).

Parameters
pvthe Point/Vector to compare to this.
Returns
true iff this > pv, false otherwise.
Warning
It inherits from operator> of TContainer. Consequently, it uses the lexicographical order when using default container.
template<DGtal::Dimension dim, typename TEuclideanRing, typename TContainer = std::array<TEuclideanRing,dim>>
bool DGtal::PointVector< dim, TEuclideanRing, TContainer >::operator>= ( const Self pv) const

Comparison operator on Points/Vectors (GreaterOrEqualThan).

Parameters
pvthe Point/Vector to compare to this.
Returns
true iff this >= pv, false otherwise.
Warning
It inherits from operator>= of TContainer. Consequently, it uses the lexicographical order when using default container.
template<DGtal::Dimension dim, typename TEuclideanRing, typename TContainer = std::array<TEuclideanRing,dim>>
const Component& DGtal::PointVector< dim, TEuclideanRing, TContainer >::operator[] ( Dimension  i) const

Returns the i-th coefficient of the vector.

Precondition
The i index must lie between 0 and size() .
Parameters
iis the index of the retrieved coefficient.
template<DGtal::Dimension dim, typename TEuclideanRing, typename TContainer = std::array<TEuclideanRing,dim>>
Component& DGtal::PointVector< dim, TEuclideanRing, TContainer >::operator[] ( Dimension  i)

Returns a non-const reference to the i-th element of the vector.

Precondition
The i index must lie between 0 and size() .
Parameters
iis the index of the retrieved coefficient.
template<DGtal::Dimension dim, typename TEuclideanRing, typename TContainer = std::array<TEuclideanRing,dim>>
Self& DGtal::PointVector< dim, TEuclideanRing, TContainer >::partialCopy ( const Self pv,
std::initializer_list< Dimension dimensions 
)

Partial copy of a given PointVector. Only coordinates in dimensions are copied.

Parameters
pvthe object to copy.
dimensionsthe dimensions of v to copy (Size between 0 and N, all differents).
Returns
a reference on 'this'.
template<DGtal::Dimension dim, typename TEuclideanRing, typename TContainer = std::array<TEuclideanRing,dim>>
Self& DGtal::PointVector< dim, TEuclideanRing, TContainer >::partialCopy ( const Self pv,
const std::vector< Dimension > &  dimensions 
)

Partial copy of a given PointVector. Only coordinates in dimensions are copied.

Parameters
pvthe object to copy.
dimensionsthe dimensions of v to copy (Size between 0 and N, all differents).
Returns
a reference on 'this'.
template<DGtal::Dimension dim, typename TEuclideanRing, typename TContainer = std::array<TEuclideanRing,dim>>
Self& DGtal::PointVector< dim, TEuclideanRing, TContainer >::partialCopyInv ( const Self pv,
std::initializer_list< Dimension dimensions 
)

Inverse partial copy of a given PointVector. Only coordinates not in dimensions are copied.

Parameters
pvthe object to copy.
dimensionsthe dimensions of v to copy (Size between 0 and N, all differents).
Returns
a reference on 'this'.

Referenced by DGtal::HyperRectDomain< TSpace >::ConstSubRange::ConstSubRange().

template<DGtal::Dimension dim, typename TEuclideanRing, typename TContainer = std::array<TEuclideanRing,dim>>
Self& DGtal::PointVector< dim, TEuclideanRing, TContainer >::partialCopyInv ( const Self pv,
const std::vector< Dimension > &  dimensions 
)

Partial copy of a given PointVector. Only coordinates not in dimensions are copied.

Parameters
pvthe object to copy.
dimensionsthe dimensions of v to copy (Size between 0 and N, all differents).
Returns
a reference on 'this'.
template<DGtal::Dimension dim, typename TEuclideanRing, typename TContainer = std::array<TEuclideanRing,dim>>
bool DGtal::PointVector< dim, TEuclideanRing, TContainer >::partialEqual ( const Self pv,
const std::vector< Dimension > &  dimensions 
) const

Partial equality.

Parameters
pvPoint/Vector to compare to this.
dimensionsDimensions along which to compare the points.
Returns
true iff points are equal for given dimensions .
template<DGtal::Dimension dim, typename TEuclideanRing, typename TContainer = std::array<TEuclideanRing,dim>>
bool DGtal::PointVector< dim, TEuclideanRing, TContainer >::partialEqualInv ( const Self pv,
const std::vector< Dimension > &  dimensions 
) const

Partial inverse equality.

Parameters
pvPoint/Vector to compare to this.
dimensionsDimensions along which to compare the points.
Returns
true iff points are equal for dimensions not in dimensions.

Referenced by DGtal::HyperRectDomain< TSpace >::ConstSubRange::begin().

template<DGtal::Dimension dim, typename TEuclideanRing, typename TContainer = std::array<TEuclideanRing,dim>>
ReverseIterator DGtal::PointVector< dim, TEuclideanRing, TContainer >::rbegin ( )

PointVector rbegin() reverse iterator.

Returns
a ReverseIterator on the first element of a Point/Vector.
template<DGtal::Dimension dim, typename TEuclideanRing, typename TContainer = std::array<TEuclideanRing,dim>>
ConstReverseIterator DGtal::PointVector< dim, TEuclideanRing, TContainer >::rbegin ( ) const

PointVector rbegin() const reverse iterator.

Returns
an ConstReverseIterator on the first element of a Point/Vector.
template<DGtal::Dimension dim, typename TEuclideanRing, typename TContainer = std::array<TEuclideanRing,dim>>
ReverseIterator DGtal::PointVector< dim, TEuclideanRing, TContainer >::rend ( )

PointVector rend() reverse iterator.

Returns
a ReverseIterator on the last element of a Point/Vector.
template<DGtal::Dimension dim, typename TEuclideanRing, typename TContainer = std::array<TEuclideanRing,dim>>
ConstReverseIterator DGtal::PointVector< dim, TEuclideanRing, TContainer >::rend ( ) const

PointVector rend() const reverse iterator.

Returns
a ConstReverseIterator on the last element of a Point/Vector.
template<DGtal::Dimension dim, typename TEuclideanRing, typename TContainer = std::array<TEuclideanRing,dim>>
void DGtal::PointVector< dim, TEuclideanRing, TContainer >::reset ( )

Resets all the values to zero.

Referenced by DGtal::PointVector< dim, Integer >::clear().

template<DGtal::Dimension dim, typename TEuclideanRing, typename TContainer = std::array<TEuclideanRing,dim>>
Dimension DGtal::PointVector< dim, TEuclideanRing, TContainer >::rows ( ) const
inline

Definition at line 415 of file PointVector.h.

415 { return dim; }
template<DGtal::Dimension dim, typename TEuclideanRing, typename TContainer = std::array<TEuclideanRing,dim>>
void DGtal::PointVector< dim, TEuclideanRing, TContainer >::selfDisplay ( std::ostream &  out) const

Writes/Displays the object on an output stream.

Parameters
outthe output stream where the object is written.
template<DGtal::Dimension dim, typename TEuclideanRing, typename TContainer = std::array<TEuclideanRing,dim>>
static Dimension DGtal::PointVector< dim, TEuclideanRing, TContainer >::size ( )
static
template<DGtal::Dimension dim, typename TEuclideanRing, typename TContainer = std::array<TEuclideanRing,dim>>
Self DGtal::PointVector< dim, TEuclideanRing, TContainer >::sup ( const Self apoint) const

Implements the supremum (or least upper bound). It means the point whose coordinates are exactly the maximum of the two points coordinate by coordinate.

Parameters
apointany point.
Returns
a new point being the sup between *this and apoint.
See also
isUpper

Field Documentation

template<DGtal::Dimension dim, typename TEuclideanRing, typename TContainer = std::array<TEuclideanRing,dim>>
const Dimension DGtal::PointVector< dim, TEuclideanRing, TContainer >::dimension = dim
static

Copy of the static dimension of the Point/Vector.

Definition at line 167 of file PointVector.h.

Referenced by DGtal::ImplicitRoundedHyperCube< TSpace >::operator()().

template<DGtal::Dimension dim, typename TEuclideanRing, typename TContainer = std::array<TEuclideanRing,dim>>
Container DGtal::PointVector< dim, TEuclideanRing, TContainer >::myArray
protected

Internal data-structure: std::array with constant size.

Definition at line 804 of file PointVector.h.

template<DGtal::Dimension dim, typename TEuclideanRing, typename TContainer = std::array<TEuclideanRing,dim>>
PointVector< dim, Component, TC > DGtal::PointVector< dim, Component, TC >::zero
static

Static const for zero PointVector.

Static const for zero definition.

Definition at line 798 of file PointVector.h.


The documentation for this class was generated from the following file: