Aim: Implements basic operations that will be used in Point and Vector classes. More...
#include <DGtal/kernel/PointVector.h>
Public Types | |
enum | NormType { L_2 , L_1 , L_infty } |
typedef PointVector< dim, TEuclideanRing, TContainer > | Self |
Self type. | |
typedef TEuclideanRing | Component |
Type for Vector elements. | |
typedef Component | Coordinate |
Type for Point elements. | |
typedef NumberTraits< Component >::UnsignedVersion | UnsignedComponent |
Unsigned version of the components. | |
typedef DGtal::Dimension | Dimension |
Copy of the dimension type. | |
typedef Component | Scalar |
Types needed by CLinearAlgebraContainer. | |
typedef Dimension | Index |
typedef TContainer | Container |
Copy of the container type. | |
typedef Container::iterator | Iterator |
Mutable iterator type. | |
typedef Container::const_iterator | ConstIterator |
Constant iterator type. | |
typedef Container::reverse_iterator | ReverseIterator |
Mutable reverse iterator type. | |
typedef Container::const_reverse_iterator | ConstReverseIterator |
Constant reverse iterator type. | |
Public Member Functions | |
BOOST_CONCEPT_ASSERT ((concepts::CEuclideanRing< TEuclideanRing >)) | |
PointVector () | |
Constructor. | |
PointVector (const Component *ptrValues) | |
Constructor from array of values. | |
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. | |
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. | |
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. | |
PointVector (std::initializer_list< Component > init) | |
Constructor from initializer list. | |
template<typename LeftComponent , typename LeftStorage , typename RightComponent , typename RightStorage , typename BinaryFunctor > | |
PointVector (const PointVector< dim, LeftComponent, LeftStorage > &apoint1, const PointVector< dim, RightComponent, RightStorage > &apoint2, const BinaryFunctor &f) | |
Constructor taking two points and a functor as parameters. | |
template<typename OtherComponent , typename OtherStorage , typename UnaryFunctor > | |
PointVector (const PointVector< dim, OtherComponent, OtherStorage > &apoint1, const UnaryFunctor &f) | |
Constructor taking a point and a unary functor as parameters. | |
~PointVector () | |
Destructor. | |
PointVector (const Self &other) | |
Copy constructor. | |
template<typename OtherComponent , typename OtherCont , typename std::enable_if< std::is_same< Component, ArithmeticConversionType< Component, OtherComponent > >::value, int >::type = 0> | |
PointVector (const PointVector< dim, OtherComponent, OtherCont > &other) | |
Copy constructor from another component PointVector. | |
template<typename OtherComponent , typename OtherCont , typename std::enable_if< ! std::is_same< Component, ArithmeticConversionType< Component, OtherComponent > >::value, int >::type = 0> | |
PointVector (const PointVector< dim, OtherComponent, OtherCont > &other) | |
Copy constructor from another component PointVector. | |
Self & | operator= (const Self &pv) |
Assignement Operator. | |
template<typename OtherComponent , typename OtherContainer , typename std::enable_if< std::is_same< Component, ArithmeticConversionType< Component, OtherComponent > >::value, int >::type = 0> | |
Self & | operator= (const PointVector< dim, OtherComponent, OtherContainer > &v) |
Assignment operator from PointVector with different component type. | |
template<typename OtherComponent , typename OtherContainer , typename std::enable_if< std::is_same< Component, ArithmeticConversionType< Component, OtherComponent > >::value, int >::type = 0> | |
Self & | partialCopy (const PointVector< dim, OtherComponent, OtherContainer > &pv, const std::vector< Dimension > &dimensions) |
Partial copy of a given PointVector. | |
template<typename OtherComponent , typename OtherContainer , typename std::enable_if< std::is_same< Component, ArithmeticConversionType< Component, OtherComponent > >::value, int >::type = 0> | |
Self & | partialCopyInv (const PointVector< dim, OtherComponent, OtherContainer > &pv, const std::vector< Dimension > &dimensions) |
Partial copy of a given PointVector. | |
template<typename OtherComponent , typename OtherContainer , typename UnaryFunctor > | |
Self & | partialCopy (const PointVector< dim, OtherComponent, OtherContainer > &pv, const std::vector< Dimension > &dimensions, const UnaryFunctor &f) |
Partial copy of a given PointVector using a functor. | |
template<typename OtherComponent , typename OtherContainer , typename UnaryFunctor > | |
Self & | partialCopyInv (const PointVector< dim, OtherComponent, OtherContainer > &pv, const std::vector< Dimension > &dimensions, const UnaryFunctor &f) |
Partial copy of a given PointVector using a functor. | |
template<typename OtherComponent , typename OtherContainer > | |
bool | partialEqual (const PointVector< dim, OtherComponent, OtherContainer > &pv, const std::vector< Dimension > &dimensions) const |
Partial equality. | |
template<typename OtherComponent , typename OtherContainer > | |
bool | partialEqualInv (const PointVector< dim, OtherComponent, OtherContainer > &pv, const std::vector< Dimension > &dimensions) const |
Partial inverse equality. | |
Iterator | begin () |
Iterator | end () |
ConstIterator | begin () const |
ConstIterator | end () const |
ReverseIterator | rbegin () |
ReverseIterator | rend () |
ConstReverseIterator | rbegin () const |
ConstReverseIterator | rend () const |
const Component * | data () const noexcept |
Component * | data () noexcept |
Dimension | rows () const |
const Component & | operator[] (Dimension i) const |
const Component & | operator() (Dimension i) const |
Component & | operator[] (Dimension i) |
Component & | operator() (Dimension i) |
template<typename OtherComponent , typename std::enable_if< std::is_same< Component, ArithmeticConversionType< Component, OtherComponent > >::value, int >::type = 0> | |
PointVector & | operator+= (OtherComponent coeff) |
Adds the coeff scalar number to *this. | |
template<typename OtherComponent , typename OtherStorage , typename std::enable_if< std::is_same< Component, ArithmeticConversionType< Component, OtherComponent > >::value, int >::type = 0> | |
PointVector & | operator+= (PointVector< dim, OtherComponent, OtherStorage > const &v) |
Adds the v vector/point to *this, componentwise. | |
template<typename OtherComponent , typename std::enable_if< std::is_same< Component, ArithmeticConversionType< Component, OtherComponent > >::value, int >::type = 0> | |
PointVector & | operator-= (OtherComponent coeff) |
Subtracts the coeff scalar number to *this. | |
template<typename OtherComponent , typename OtherStorage , typename std::enable_if< std::is_same< Component, ArithmeticConversionType< Component, OtherComponent > >::value, int >::type = 0> | |
PointVector & | operator-= (PointVector< dim, OtherComponent, OtherStorage > const &v) |
Subtracts the v vector/point to *this, componentwise. | |
template<typename OtherComponent , typename std::enable_if< std::is_same< Component, ArithmeticConversionType< Component, OtherComponent > >::value, int >::type = 0> | |
PointVector & | operator*= (OtherComponent coeff) |
Multiplies *this by the coeff scalar number. | |
template<typename OtherComponent , typename OtherStorage , typename std::enable_if< std::is_same< Component, ArithmeticConversionType< Component, OtherComponent > >::value, int >::type = 0> | |
PointVector & | operator*= (PointVector< dim, OtherComponent, OtherStorage > const &v) |
Multiplies *this by the v vector/point, componentwise. | |
template<typename OtherComponent , typename std::enable_if< std::is_same< Component, ArithmeticConversionType< Component, OtherComponent > >::value, int >::type = 0> | |
PointVector & | operator/= (OtherComponent coeff) |
Divides *this by the coeff scalar number. | |
template<typename OtherComponent , typename OtherStorage , typename std::enable_if< std::is_same< Component, ArithmeticConversionType< Component, OtherComponent > >::value, int >::type = 0> | |
PointVector & | operator/= (PointVector< dim, OtherComponent, OtherStorage > const &v) |
Divides *this by the v vector/point, componentwise. | |
Self | operator- () const |
Unary minus operator. | |
template<typename OtherComponent , typename OtherStorage > | |
auto | dot (const PointVector< dim, OtherComponent, OtherStorage > &v) const -> decltype(DGtal::dotProduct(*this, v)) |
Dot product with a PointVector. | |
template<typename OtherComponent , typename OtherStorage > | |
auto | crossProduct (const PointVector< dim, OtherComponent, OtherStorage > &v) const -> decltype(DGtal::crossProduct(*this, v)) |
Cross product with a PointVector. | |
template<typename OtherComponent , typename OtherStorage > | |
double | cosineSimilarity (const PointVector< dim, OtherComponent, OtherStorage > &v) const |
Positive angle between two vectors, deduced from their scalar product. | |
template<typename OtherComponent , typename OtherStorage > | |
auto | inf (const PointVector< dim, OtherComponent, OtherStorage > &aPoint) const -> decltype(DGtal::inf(*this, aPoint)) |
Implements the infimum (or greatest lower bound). | |
template<typename OtherComponent , typename OtherStorage > | |
auto | sup (const PointVector< dim, OtherComponent, OtherStorage > &aPoint) const -> decltype(DGtal::sup(*this, aPoint)) |
Implements the supremum (or least upper bound). | |
template<typename OtherComponent , typename OtherStorage > | |
bool | isLower (const PointVector< dim, OtherComponent, OtherStorage > &p) const |
Return true if this point is below a given point. | |
template<typename OtherComponent , typename OtherStorage > | |
bool | isUpper (const PointVector< dim, OtherComponent, OtherStorage > &p) const |
Return true if this point is upper a given point. | |
Component | max () const |
Component | min () const |
Iterator | maxElement () |
Iterator | minElement () |
void | negate () |
double | norm (const NormType type=L_2) const |
double | squaredNorm () const |
UnsignedComponent | norm1 () const |
UnsignedComponent | normInfinity () const |
PointVector< dim, double, std::array< double, dim > > | getNormalized () const |
void | reset () |
Resets all the values to zero. | |
void | clear () |
Resets all the values to zero. | |
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 |
Copy of the static dimension of the Point/Vector. | |
static Self | zero |
Static const for zero PointVector. | |
Protected Attributes | |
Container | myArray |
Internal data-structure: std::array with constant size. | |
Friends | |
template<DGtal::Dimension otherDim, typename TOtherEuclideanRing , typename TOtherContainer > | |
class | PointVector |
template<Dimension ptDim, typename LeftEuclideanRing , typename LeftContainer , typename RightEuclideanRing , typename RightContainer > | |
bool | operator== (PointVector< ptDim, LeftEuclideanRing, LeftContainer > const &lhs, PointVector< ptDim, RightEuclideanRing, RightContainer > const &rhs) |
Equality operator between two Points/Vectors. | |
template<Dimension ptDim, typename LeftEuclideanRing , typename LeftContainer , typename RightEuclideanRing , typename RightContainer > | |
bool | operator!= (PointVector< ptDim, LeftEuclideanRing, LeftContainer > const &lhs, PointVector< ptDim, RightEuclideanRing, RightContainer > const &rhs) |
Difference operator on Points/Vectors. | |
template<Dimension ptDim, typename LeftEuclideanRing , typename LeftContainer , typename RightEuclideanRing , typename RightContainer > | |
bool | operator< (PointVector< ptDim, LeftEuclideanRing, LeftContainer > const &lhs, PointVector< ptDim, RightEuclideanRing, RightContainer > const &rhs) |
Comparison operator on Points/Vectors (LesserThan). | |
template<Dimension ptDim, typename LeftEuclideanRing , typename LeftContainer , typename RightEuclideanRing , typename RightContainer > | |
bool | operator<= (PointVector< ptDim, LeftEuclideanRing, LeftContainer > const &lhs, PointVector< ptDim, RightEuclideanRing, RightContainer > const &rhs) |
Comparison operator on Points/Vectors (LesserOrEqualThan). | |
template<Dimension ptDim, typename LeftEuclideanRing , typename LeftContainer , typename RightEuclideanRing , typename RightContainer > | |
bool | operator>= (PointVector< ptDim, LeftEuclideanRing, LeftContainer > const &lhs, PointVector< ptDim, RightEuclideanRing, RightContainer > const &rhs) |
Comparison operator on Points/Vectors (GreaterOrEqualThan). | |
template<Dimension ptDim, typename LeftEuclideanRing , typename LeftContainer , typename RightEuclideanRing , typename RightContainer > | |
auto | operator+ (PointVector< ptDim, LeftEuclideanRing, LeftContainer > const &lhs, PointVector< ptDim, RightEuclideanRing, RightContainer > const &rhs) -> decltype(DGtal::constructFromArithmeticConversion(lhs, rhs)) |
Addition operator between two Points/Vectors. | |
template<Dimension ptDim, typename LeftEuclideanRing , typename LeftContainer , typename RightEuclideanRing , typename RightContainer > | |
auto | operator- (PointVector< ptDim, LeftEuclideanRing, LeftContainer > const &lhs, PointVector< ptDim, RightEuclideanRing, RightContainer > const &rhs) -> decltype(DGtal::constructFromArithmeticConversion(lhs, rhs)) |
Subtraction operator between two Points/Vectors. | |
template<Dimension ptDim, typename LeftEuclideanRing , typename LeftContainer , typename RightEuclideanRing , typename RightContainer > | |
auto | operator* (PointVector< ptDim, LeftEuclideanRing, LeftContainer > const &lhs, PointVector< ptDim, RightEuclideanRing, RightContainer > const &rhs) -> decltype(DGtal::constructFromArithmeticConversion(lhs, rhs)) |
Multiplication operator between two Points/Vectors. | |
template<Dimension ptDim, typename LeftEuclideanRing , typename LeftContainer , typename RightEuclideanRing , typename RightContainer > | |
auto | operator/ (PointVector< ptDim, LeftEuclideanRing, LeftContainer > const &lhs, PointVector< ptDim, RightEuclideanRing, RightContainer > const &rhs) -> decltype(DGtal::constructFromArithmeticConversion(lhs, rhs)) |
Division operator between two Points/Vectors. | |
template<DGtal::Dimension ptDim, typename LeftEuclideanRing , typename LeftContainer , typename RightScalar > | |
auto | operator+ (DGtal::PointVector< ptDim, LeftEuclideanRing, LeftContainer > const &lhs, RightScalar const &rhs) -> decltype(DGtal::constructFromArithmeticConversion(lhs, rhs)) |
Addition operator between a Point/Vector and a scalar. | |
template<Dimension ptDim, typename LeftScalar , typename RightEuclideanRing , typename RightContainer > | |
auto | operator+ (LeftScalar const &lhs, PointVector< ptDim, RightEuclideanRing, RightContainer > const &rhs) -> decltype(DGtal::constructFromArithmeticConversion(lhs, rhs)) |
Addition operator between a scalar and a Point/Vector. | |
template<DGtal::Dimension ptDim, typename LeftEuclideanRing , typename LeftContainer , typename RightScalar > | |
auto | operator- (DGtal::PointVector< ptDim, LeftEuclideanRing, LeftContainer > const &lhs, RightScalar const &rhs) -> decltype(DGtal::constructFromArithmeticConversion(lhs, rhs)) |
Subtraction operator between a Point/Vector and a scalar. | |
template<Dimension ptDim, typename LeftScalar , typename RightEuclideanRing , typename RightContainer > | |
auto | operator- (LeftScalar const &lhs, PointVector< ptDim, RightEuclideanRing, RightContainer > const &rhs) -> decltype(DGtal::constructFromArithmeticConversion(lhs, rhs)) |
Substraction operator between a scalar and a Point/Vector. | |
template<DGtal::Dimension ptDim, typename LeftEuclideanRing , typename LeftContainer , typename RightScalar > | |
auto | operator* (DGtal::PointVector< ptDim, LeftEuclideanRing, LeftContainer > const &lhs, RightScalar const &rhs) -> decltype(DGtal::constructFromArithmeticConversion(lhs, rhs)) |
Multiplication operator between a Point/Vector and a scalar. | |
template<Dimension ptDim, typename LeftScalar , typename RightEuclideanRing , typename RightContainer > | |
auto | operator* (LeftScalar const &lhs, PointVector< ptDim, RightEuclideanRing, RightContainer > const &rhs) -> decltype(DGtal::constructFromArithmeticConversion(lhs, rhs)) |
Multiplication operator between a scalar and a Point/Vector. | |
template<DGtal::Dimension ptDim, typename LeftEuclideanRing , typename LeftContainer , typename RightScalar > | |
auto | operator/ (DGtal::PointVector< ptDim, LeftEuclideanRing, LeftContainer > const &lhs, RightScalar const &rhs) -> decltype(DGtal::constructFromArithmeticConversion(lhs, rhs)) |
Division operator between a Point/Vector and a scalar. | |
template<Dimension ptDim, typename LeftScalar , typename RightEuclideanRing , typename RightContainer > | |
auto | operator/ (LeftScalar const &lhs, PointVector< ptDim, RightEuclideanRing, RightContainer > const &rhs) -> decltype(DGtal::constructFromArithmeticConversion(lhs, rhs)) |
Division operator between a scalar and a Point/Vector. | |
template<Dimension ptDim, typename LeftEuclideanRing , typename LeftContainer , typename RightEuclideanRing , typename RightContainer > | |
DGtal::ArithmeticConversionType< LeftEuclideanRing, RightEuclideanRing > | dotProduct (PointVector< ptDim, LeftEuclideanRing, LeftContainer > const &lhs, PointVector< ptDim, RightEuclideanRing, RightContainer > const &rhs) |
Dot product between two points/vectors. | |
template<typename LeftEuclideanRing , typename LeftContainer , typename RightEuclideanRing , typename RightContainer > | |
auto | crossProduct (PointVector< 3, LeftEuclideanRing, LeftContainer > const &lhs, PointVector< 3, RightEuclideanRing, RightContainer > const &rhs) -> decltype(DGtal::constructFromArithmeticConversion(lhs, rhs)) |
Cross product of two 3D Points/Vectors. | |
template<typename LeftEuclideanRing , typename LeftContainer , typename RightEuclideanRing , typename RightContainer > | |
PointVector< 3, DGtal::ArithmeticConversionType< LeftEuclideanRing, RightEuclideanRing > > | crossProduct (PointVector< 2, LeftEuclideanRing, LeftContainer > const &lhs, PointVector< 2, RightEuclideanRing, RightContainer > const &rhs) |
Cross product of two 2D Points/Vectors. | |
template<Dimension ptDim, typename LeftEuclideanRing , typename LeftContainer , typename RightEuclideanRing , typename RightContainer > | |
double | cosineSimilarity (PointVector< ptDim, LeftEuclideanRing, LeftContainer > const &lhs, PointVector< ptDim, RightEuclideanRing, RightContainer > const &rhs) |
Positive angle between two vectors, deduced from their scalar product. | |
template<Dimension ptDim, typename LeftEuclideanRing , typename LeftContainer , typename RightEuclideanRing , typename RightContainer > | |
auto | inf (PointVector< ptDim, LeftEuclideanRing, LeftContainer > const &lhs, PointVector< ptDim, RightEuclideanRing, RightContainer > const &rhs) -> decltype(DGtal::constructFromArithmeticConversion(lhs, rhs)) |
Implements the infimum (or greatest lower bound). | |
template<Dimension ptDim, typename LeftEuclideanRing , typename LeftContainer , typename RightEuclideanRing , typename RightContainer > | |
auto | sup (PointVector< ptDim, LeftEuclideanRing, LeftContainer > const &lhs, PointVector< ptDim, RightEuclideanRing, RightContainer > const &rhs) -> decltype(DGtal::constructFromArithmeticConversion(lhs, rhs)) |
Implements the supremum (or least upper bound). | |
template<Dimension ptDim, typename LeftEuclideanRing , typename LeftContainer , typename RightEuclideanRing , typename RightContainer > | |
bool | isLower (PointVector< ptDim, LeftEuclideanRing, LeftContainer > const &lhs, PointVector< ptDim, RightEuclideanRing, RightContainer > const &rhs) |
Return true if the first point is below the second point. | |
template<Dimension ptDim, typename LeftEuclideanRing , typename LeftContainer , typename RightEuclideanRing , typename RightContainer > | |
bool | isUpper (PointVector< ptDim, LeftEuclideanRing, LeftContainer > const &lhs, PointVector< ptDim, RightEuclideanRing, RightContainer > const &rhs) |
Return true if the first point is upper the second point. | |
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. |
TContainer | specifies 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. |
All operations involving PointVector, and some of its methods, follow the classical arithmetic conversion rules. More precisely, if an operation involves two component types T and U, then the result will have the type of T() + U()
as component type, that is the last of T and U in the following conversion chain:
A consequence is that if the result is stored in a PointVector whose component type has lower rank than the result type in the conversion chain above, then it will result in a compilation error. This behavior is designed to avoid unwanted conversions that may lead to loss of precision.
This constraint can be dodged by using one of the conversion constructor (explicitly or along with a conversion functor) or equivalent methods.
For example, dividing a PointVector with integer components by an integer uses the Euclidean division and returns a PointVector with higher integer component type. On the other hand, dividing a PointVector with integer components by a double will use classical division on real numbers and returns a PointVector with double component type.
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 592 of file PointVector.h.
TEuclideanRing DGtal::PointVector< dim, TEuclideanRing, TContainer >::Component |
Type for Vector elements.
Definition at line 614 of file PointVector.h.
Container::const_iterator DGtal::PointVector< dim, TEuclideanRing, TContainer >::ConstIterator |
Constant iterator type.
Definition at line 641 of file PointVector.h.
Container::const_reverse_iterator DGtal::PointVector< dim, TEuclideanRing, TContainer >::ConstReverseIterator |
Constant reverse iterator type.
Definition at line 643 of file PointVector.h.
TContainer DGtal::PointVector< dim, TEuclideanRing, TContainer >::Container |
Copy of the container type.
Definition at line 633 of file PointVector.h.
Component DGtal::PointVector< dim, TEuclideanRing, TContainer >::Coordinate |
Type for Point elements.
Definition at line 617 of file PointVector.h.
DGtal::Dimension DGtal::PointVector< dim, TEuclideanRing, TContainer >::Dimension |
Copy of the dimension type.
Definition at line 623 of file PointVector.h.
Dimension DGtal::PointVector< dim, TEuclideanRing, TContainer >::Index |
Definition at line 630 of file PointVector.h.
Container::iterator DGtal::PointVector< dim, TEuclideanRing, TContainer >::Iterator |
Mutable iterator type.
Copy of the Container iterator types
Definition at line 640 of file PointVector.h.
Container::reverse_iterator DGtal::PointVector< dim, TEuclideanRing, TContainer >::ReverseIterator |
Mutable reverse iterator type.
Definition at line 642 of file PointVector.h.
Component DGtal::PointVector< dim, TEuclideanRing, TContainer >::Scalar |
Types needed by CLinearAlgebraContainer.
Definition at line 629 of file PointVector.h.
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 611 of file PointVector.h.
NumberTraits<Component>::UnsignedVersion DGtal::PointVector< dim, TEuclideanRing, TContainer >::UnsignedComponent |
Unsigned version of the components.
Definition at line 620 of file PointVector.h.
enum DGtal::PointVector::NormType |
Specify the set of norm types
Enumerator | |
---|---|
L_2 | |
L_1 | |
L_infty |
Definition at line 1493 of file PointVector.h.
DGtal::PointVector< dim, TEuclideanRing, TContainer >::PointVector | ( | ) |
Constructor.
|
explicit |
Constructor from array of values.
ptrValues | the array of values. |
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.
x | the first value. |
y | the second value. |
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.
x | the first value. |
y | the second value. |
z | the third value. |
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.
x | the first value. |
y | the second value. |
z | the third value. |
t | the fourth value. |
DGtal::PointVector< dim, TEuclideanRing, TContainer >::PointVector | ( | std::initializer_list< Component > | init | ) |
Constructor from initializer list.
init | the initializer list. |
DGtal::PointVector< dim, TEuclideanRing, TContainer >::PointVector | ( | const PointVector< dim, LeftComponent, LeftStorage > & | apoint1, |
const PointVector< dim, RightComponent, RightStorage > & | 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
DGtal::PointVector< dim, TEuclideanRing, TContainer >::PointVector | ( | const PointVector< dim, OtherComponent, OtherStorage > & | 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
|
inline |
DGtal::PointVector< dim, TEuclideanRing, TContainer >::PointVector | ( | const Self & | other | ) |
Copy constructor.
other | the object to clone. |
DGtal::PointVector< dim, TEuclideanRing, TContainer >::PointVector | ( | const PointVector< dim, OtherComponent, OtherCont > & | other | ) |
Copy constructor from another component PointVector.
other | the object to clone. |
|
explicit |
Copy constructor from another component PointVector.
other | the object to clone. |
|
static |
k | any number between 0 and Dimension-1. |
val | any value. |
Iterator DGtal::PointVector< dim, TEuclideanRing, TContainer >::begin | ( | ) |
PointVector begin() iterator.
Referenced by DGtal::Shortcuts< TKSpace >::saveVectorFieldOBJ(), TEST_CASE(), testDoubleOnSegment(), testDoubleShrink(), testDoubleShrinkHorizontal(), and testSpecialCase().
ConstIterator DGtal::PointVector< dim, TEuclideanRing, TContainer >::begin | ( | ) | const |
PointVector begin() const iterator.
DGtal::PointVector< dim, TEuclideanRing, TContainer >::BOOST_CONCEPT_ASSERT | ( | (concepts::CEuclideanRing< TEuclideanRing >) | ) |
std::string DGtal::PointVector< dim, TEuclideanRing, TContainer >::className | ( | ) | const |
Referenced by exampleUpdate(), main(), main(), and testDisplayDT3d().
|
inline |
Resets all the values to zero.
Definition at line 1551 of file PointVector.h.
References DGtal::PointVector< dim, TEuclideanRing, TContainer >::reset().
|
inline |
Positive angle between two vectors, deduced from their scalar product.
v | any vector |
Referenced by TEST_CASE().
|
inline |
Cross product with a PointVector.
v | a vector that is cross-producted to *this. |
Referenced by DGtal::detail::BoundedLatticePolytopeSpecializer< 3, TInteger >::addEdgeConstraint(), DGtal::detail::BoundedRationalPolytopeSpecializer< 3, TInteger >::addEdgeConstraint(), DGtal::detail::BoundedLatticePolytopeSpecializer< 3, TInteger >::crossProduct(), DGtal::detail::BoundedRationalPolytopeSpecializer< 3, TInteger >::crossProduct(), DGtal::Shortcuts< TKSpace >::getPrimalVertices(), DGtal::SphericalTriangle< TSpace >::polarTriangle(), DGtal::Shortcuts< TKSpace >::saveVectorFieldOBJ(), and TEST_CASE().
|
inlinenoexcept |
PointVector data() (const and non-const) access to raw data of a std container
|
inlinenoexcept |
PointVector data() (const and non-const) access to raw data of a std container
|
static |
val | any value. |
Referenced by DGtal::ImplicitHyperCube< TSpace >::getLowerBound(), DGtal::ImplicitNorm1Ball< TSpace >::getLowerBound(), DGtal::ImplicitRoundedHyperCube< TSpace >::getLowerBound(), DGtal::ImplicitHyperCube< TSpace >::getUpperBound(), DGtal::ImplicitNorm1Ball< TSpace >::getUpperBound(), and DGtal::ImplicitRoundedHyperCube< TSpace >::getUpperBound().
|
inline |
Dot product with a PointVector.
v | a vector that is dot-producted to *this. |
Referenced by DGtal::SphericalTriangle< TSpace >::algebraicArea(), DGtal::ConvexHullCommonKernel< dim, TCoordinateInteger, TInternalInteger >::compute(), DGtal::ConvexHullCommonKernel< dim, TCoordinateInteger, TInternalInteger >::compute(), DGtal::ConvexCellComplex< TPoint >::computeFaceGeometry(), DGtal::ConvexCellComplex< TPoint >::computeHalfSpace(), DGtal::ConvexHullCommonKernel< dim, TCoordinateInteger, TInternalInteger >::dot(), DGtal::SphericalTriangle< TSpace >::interiorAngles(), main(), precompute(), and TEST_CASE().
Iterator DGtal::PointVector< dim, TEuclideanRing, TContainer >::end | ( | ) |
PointVector end() iterator.
Referenced by DGtal::Shortcuts< TKSpace >::saveVectorFieldOBJ(), and TEST_CASE().
ConstIterator DGtal::PointVector< dim, TEuclideanRing, TContainer >::end | ( | ) | const |
PointVector end() const iterator.
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.
Referenced by main(), and testBallQuad().
|
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. |
Referenced by TEST_CASE().
bool DGtal::PointVector< dim, TEuclideanRing, TContainer >::isLower | ( | const PointVector< dim, OtherComponent, OtherStorage > & | p | ) | const |
Return true if this point is below a given point.
p | any point. |
Referenced by DGtal::ArrayImageAdapter< TArrayIterator, HyperRectDomain< TSpace > >::ArrayImageAdapter(), DGtal::HyperRectDomain< TSpace >::ConstSubRange::begin(), and TEST_CASE().
bool DGtal::PointVector< dim, TEuclideanRing, TContainer >::isUpper | ( | const PointVector< dim, OtherComponent, OtherStorage > & | p | ) | const |
Return true if this point is upper a given point.
p | any point. |
Referenced by DGtal::ArrayImageAdapter< TArrayIterator, HyperRectDomain< TSpace > >::ArrayImageAdapter(), and TEST_CASE().
bool DGtal::PointVector< dim, TEuclideanRing, TContainer >::isValid | ( | ) | const |
Checks the validity/consistency of the object.
Component DGtal::PointVector< dim, TEuclideanRing, TContainer >::max | ( | ) | const |
Return the maximum component value of a point/vector.
Referenced by TEST_CASE(), and TEST_CASE().
Iterator DGtal::PointVector< dim, TEuclideanRing, TContainer >::maxElement | ( | ) |
Return the iterator on the component with maximim value of a point/vector.
Referenced by TEST_CASE(), and TEST_CASE().
Component DGtal::PointVector< dim, TEuclideanRing, TContainer >::min | ( | ) | const |
Return the minimum component value of a point/vector.
Referenced by TEST_CASE(), and TEST_CASE().
Iterator DGtal::PointVector< dim, TEuclideanRing, TContainer >::minElement | ( | ) |
Return the iterator on the component with minimum value of a point/vector.
Referenced by TEST_CASE(), and TEST_CASE().
void DGtal::PointVector< dim, TEuclideanRing, TContainer >::negate | ( | ) |
Negates this vector.
double DGtal::PointVector< dim, TEuclideanRing, TContainer >::norm | ( | const NormType | type = L_2 | ) | const |
Computes the norm of a point/vector.
type | specifies the type of norm to consider (see NormType). |
Referenced by main(), DGtal::TangentFromDSS3DFunctor< DSS, LambdaFunction >::operator()(), DGtal::functors::Point2DEmbedderIn3D< TDomain3D, TInteger >::Point2DEmbedderIn3D(), DGtal::functors::Point2DEmbedderIn3D< TDomain3D, TInteger >::Point2DEmbedderIn3D(), DGtal::functors::Point2DEmbedderIn3D< TDomain3D, TInteger >::Point2DEmbedderIn3D(), DGtal::SphericalTriangle< TSpace >::setA(), DGtal::SphericalTriangle< TSpace >::setB(), DGtal::SphericalTriangle< TSpace >::setC(), and signed_dist_to_unit_circle().
UnsignedComponent DGtal::PointVector< dim, TEuclideanRing, TContainer >::norm1 | ( | ) | const |
Computes the 1-norm of a vector.
Referenced by DGtal::SphericalTriangle< TSpace >::algebraicArea().
UnsignedComponent DGtal::PointVector< dim, TEuclideanRing, TContainer >::normInfinity | ( | ) | const |
Computes the infinity-norm of a vector.
|
inline |
Definition at line 1015 of file PointVector.h.
|
inline |
Definition at line 1004 of file PointVector.h.
|
inline |
Multiplies *this by the coeff scalar number.
|
inline |
Multiplies *this by the v vector/point, componentwise.
|
inline |
Adds the coeff scalar number to *this.
|
inline |
Adds the v vector/point to *this, componentwise.
|
inline |
Unary minus operator.
-Vector => Vector
|
inline |
Subtracts the coeff scalar number to *this.
|
inline |
Subtracts the v vector/point to *this, componentwise.
|
inline |
Divides *this by the coeff scalar number.
|
inline |
Divides *this by the v vector/point, componentwise.
Self & DGtal::PointVector< dim, TEuclideanRing, TContainer >::operator= | ( | const PointVector< dim, OtherComponent, OtherContainer > & | v | ) |
Assignment operator from PointVector with different component type.
v | is the Point that gets copied to *this. |
Self & DGtal::PointVector< dim, TEuclideanRing, TContainer >::operator= | ( | const Self & | pv | ) |
Assignement Operator.
pv | the object to copy. |
Component & DGtal::PointVector< dim, TEuclideanRing, TContainer >::operator[] | ( | Dimension | i | ) |
Returns a non-const reference to the i-th element of the vector.
i | is the index of the retrieved coefficient. |
const Component & DGtal::PointVector< dim, TEuclideanRing, TContainer >::operator[] | ( | Dimension | i | ) | const |
Returns the i-th coefficient of the vector.
i | is the index of the retrieved coefficient. |
Self & DGtal::PointVector< dim, TEuclideanRing, TContainer >::partialCopy | ( | const PointVector< dim, OtherComponent, OtherContainer > & | pv, |
const std::vector< Dimension > & | dimensions ) |
Partial copy of a given PointVector.
Only coordinates in dimensions are copied.
OtherComponent | Component type of the point to copy from. |
OtherContainer | Storage type of the point to copy from. |
pv | the object to copy. |
dimensions | the dimensions of v to copy (Size between 0 and N, all differents). |
Referenced by TEST_CASE(), and testIterator().
Self & DGtal::PointVector< dim, TEuclideanRing, TContainer >::partialCopy | ( | const PointVector< dim, OtherComponent, OtherContainer > & | pv, |
const std::vector< Dimension > & | dimensions, | ||
const UnaryFunctor & | f ) |
Partial copy of a given PointVector using a functor.
Only coordinates in dimensions are copied.
OtherComponent | Component type of the point to copy from. |
OtherContainer | Storage type of the point to copy from. |
UnaryFunctor | Type of the functor applied to copied values. |
pv | the object to copy. |
dimensions | the dimensions of v to copy (Size between 0 and N, all differents). |
f | the functor applied to copied values. |
Self & DGtal::PointVector< dim, TEuclideanRing, TContainer >::partialCopyInv | ( | const PointVector< dim, OtherComponent, OtherContainer > & | pv, |
const std::vector< Dimension > & | dimensions ) |
Partial copy of a given PointVector.
Only coordinates not in dimensions are copied.
OtherComponent | Component type of the point to copy from. |
OtherContainer | Storage type of the point to copy from. |
pv | the object to copy. |
dimensions | the dimensions of v to copy (Size between 0 and N, all differents). |
Referenced by DGtal::HyperRectDomain< TSpace >::ConstSubRange::ConstSubRange(), DGtal::HyperRectDomain< TSpace >::ConstSubRange::ConstSubRange(), DGtal::HyperRectDomain< TSpace >::ConstSubRange::ConstSubRange(), DGtal::HyperRectDomain< TSpace >::ConstSubRange::ConstSubRange(), DGtal::HyperRectDomain< TSpace >::ConstSubRange::ConstSubRange(), and TEST_CASE().
Self & DGtal::PointVector< dim, TEuclideanRing, TContainer >::partialCopyInv | ( | const PointVector< dim, OtherComponent, OtherContainer > & | pv, |
const std::vector< Dimension > & | dimensions, | ||
const UnaryFunctor & | f ) |
Partial copy of a given PointVector using a functor.
Only coordinates not in dimensions are copied.
OtherComponent | Component type of the point to copy from. |
OtherContainer | Storage type of the point to copy from. |
UnaryFunctor | Type of the functor applied to copied values. |
pv | the object to copy. |
dimensions | the dimensions of v to copy (Size between 0 and N, all differents). |
f | the functor applied to copied values. |
bool DGtal::PointVector< dim, TEuclideanRing, TContainer >::partialEqual | ( | const PointVector< dim, OtherComponent, OtherContainer > & | pv, |
const std::vector< Dimension > & | dimensions ) const |
Partial equality.
Only coordinates in dimensions are compared.
OtherComponent | Component type of the point to compare with. |
OtherContainer | Storage type of the point to compare with. |
pv | Point/Vector to compare to this. |
dimensions | Dimensions along which to compare the points. |
bool DGtal::PointVector< dim, TEuclideanRing, TContainer >::partialEqualInv | ( | const PointVector< dim, OtherComponent, OtherContainer > & | pv, |
const std::vector< Dimension > & | dimensions ) const |
Partial inverse equality.
Only coordinates not in dimensions are compared.
OtherComponent | Component type of the point to compare with. |
OtherContainer | Storage type of the point to compare with. |
pv | Point/Vector to compare to this. |
dimensions | Dimensions along which to compare the points. |
ReverseIterator DGtal::PointVector< dim, TEuclideanRing, TContainer >::rbegin | ( | ) |
PointVector rbegin() reverse iterator.
ConstReverseIterator DGtal::PointVector< dim, TEuclideanRing, TContainer >::rbegin | ( | ) | const |
PointVector rbegin() const reverse iterator.
ReverseIterator DGtal::PointVector< dim, TEuclideanRing, TContainer >::rend | ( | ) |
PointVector rend() reverse iterator.
ConstReverseIterator DGtal::PointVector< dim, TEuclideanRing, TContainer >::rend | ( | ) | const |
PointVector rend() const reverse iterator.
void DGtal::PointVector< dim, TEuclideanRing, TContainer >::reset | ( | ) |
Resets all the values to zero.
Referenced by DGtal::PointVector< dim, TEuclideanRing, TContainer >::clear().
|
inline |
void DGtal::PointVector< dim, TEuclideanRing, TContainer >::selfDisplay | ( | std::ostream & | out | ) | const |
Writes/Displays the object on an output stream.
out | the output stream where the object is written. |
|
static |
Returns the size of the vector (i.e. the number of its coefficients).
Referenced by DGtal::functors::Point2DEmbedderIn3D< TDomain3D, TInteger >::operator()(), DGtal::functors::SliceRotator2D< TDomain3D, TInteger >::operator()(), DGtal::LpMetric< TSpace >::rawDistance(), DGtal::functors::Point2DEmbedderIn3D< TDomain3D, TInteger >::shiftOriginPoint(), and testContourHelper().
double DGtal::PointVector< dim, TEuclideanRing, TContainer >::squaredNorm | ( | ) | const |
Computes the square L2 norm of a point/vector.
|
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. |
Referenced by TEST_CASE().
|
friend |
Positive angle between two vectors, deduced from their scalar product.
|
friend |
Cross product of two 2D Points/Vectors.
|
friend |
Cross product of two 3D Points/Vectors.
|
friend |
Dot product between two points/vectors.
|
friend |
Implements the infimum (or greatest lower bound).
It means the point whose coordinates are exactly the minimum of the two points coordinate by coordinate.
|
friend |
Return true if the first point is below the second point.
|
friend |
Return true if the first point is upper the second point.
|
friend |
Difference operator on Points/Vectors.
|
friend |
Multiplication operator between a Point/Vector and a scalar.
|
friend |
Multiplication operator between a scalar and a Point/Vector.
|
friend |
Multiplication operator between two Points/Vectors.
|
friend |
Addition operator between a Point/Vector and a scalar.
|
friend |
Addition operator between a scalar and a Point/Vector.
|
friend |
Addition operator between two Points/Vectors.
|
friend |
Subtraction operator between a Point/Vector and a scalar.
|
friend |
Substraction operator between a scalar and a Point/Vector.
|
friend |
Subtraction operator between two Points/Vectors.
|
friend |
Division operator between a Point/Vector and a scalar.
|
friend |
Division operator between a scalar and a Point/Vector.
|
friend |
Division operator between two Points/Vectors.
|
friend |
Comparison operator on Points/Vectors (LesserThan).
|
friend |
Comparison operator on Points/Vectors (LesserOrEqualThan).
|
friend |
Equality operator between two Points/Vectors.
|
friend |
Comparison operator on Points/Vectors (GreaterOrEqualThan).
|
friend |
Definition at line 600 of file PointVector.h.
|
friend |
Implements the supremum (or least upper bound).
It means the point whose coordinates are exactly the maximum of the two points coordinate by coordinate.
|
static |
Copy of the static dimension of the Point/Vector.
Definition at line 626 of file PointVector.h.
Referenced by DGtal::ImplicitRoundedHyperCube< TSpace >::operator()().
|
protected |
Internal data-structure: std::array with constant size.
Definition at line 1601 of file PointVector.h.
|
static |
Static const for zero PointVector.
Static const for zero definition.
Definition at line 1595 of file PointVector.h.
Referenced by DGtal::ConvexCellComplex< TPoint >::computeFaceGeometry(), DGtal::ShortcutsGeometry< TKSpace >::getTrivialNormalVectors(), DGtal::SphericalTriangle< TSpace >::interiorAngles(), DGtal::Shortcuts< TKSpace >::outputDualDigitalSurfaceAsObj(), DGtal::SphericalTriangle< TSpace >::setA(), DGtal::SphericalTriangle< TSpace >::setB(), and DGtal::SphericalTriangle< TSpace >::setC().