PointVector  v1.0
Header-only n-dimensional point and vector implementations for C++11
geomdl::Point< T, S > Class Template Reference

Represents n-dimensional points. More...

#include <Point.hxx>

Public Types

using value_type = T
 value type, first keyword, expected to be a primitive type.
 
using size_type = std::size_t
 size type, second keyword, expected to be a positive number.
 
using iterator = T *
 iterator type.
 

Public Member Functions

 Point ()
 Default constructor.
 
 Point (const Point< value_type, S > &rhs)
 Copy constructor. More...
 
 Point (std::initializer_list< value_type > values)
 Aggregate constructor from a brace-init-list. More...
 
 Point (T *values)
 Initializes the point from an array. More...
 
 Point (T value)
 Initializes all components of the point to the same value. More...
 
Point< value_type, S > & operator= (const Point< value_type, S > &rhs)
 Copy assignment operator. More...
 
Point< value_type, S > & operator= (Point< value_type, S > &&rhs)
 Move assignment operator. More...
 
Point< value_type, S > & operator+= (const Point< value_type, S > &rhs)
 Compound assignment operator (complex addition). More...
 
Point< value_type, S > & operator-= (const Point< value_type, S > &rhs)
 Compound assignment operator (complex subtraction). More...
 
Point< value_type, S > & operator+= (const T &rhs)
 Compound assignment operator (primitive addition). More...
 
Point< value_type, S > & operator-= (const T &rhs)
 Compound assignment operator (primitive subtraction). More...
 
Point< value_type, S > & operator*= (const T &rhs)
 Compound assignment operator (primitive multiplication). More...
 
Point< value_type, S > & operator/= (const T &rhs)
 Compound assignment operator (primitive division). More...
 
value_typeoperator[] (size_type idx)
 Array subscript operator. More...
 
const value_typeoperator[] (size_type idx) const
 Array subscript operator (const). More...
 
iterator begin ()
 Iterator begin. More...
 
iterator end ()
 Iterator end. More...
 
value_typedata ()
 Access data. More...
 

Friends

Point< value_type, S > operator+ (Point< value_type, S > lhs, const Point< value_type, S > &rhs)
 Arithmetic operator (complex addition). More...
 
Point< value_type, S > operator- (Point< value_type, S > lhs, const Point< value_type, S > &rhs)
 Arithmetic operator (complex subtraction). More...
 
Point< value_type, S > operator+ (Point< value_type, S > lhs, const T &rhs)
 Arithmetic operator (primitive addition). More...
 
Point< value_type, S > operator- (Point< value_type, S > lhs, const T &rhs)
 Arithmetic operator (primitive subtraction). More...
 
Point< value_type, S > operator* (Point< value_type, S > lhs, const T &rhs)
 Arithmetic operator (primitive multiplication). More...
 
Point< value_type, S > operator/ (Point< value_type, S > lhs, const T &rhs)
 Arithmetic operator (primitive division). More...
 
bool operator== (const Point< value_type, S > &lhs, const Point< value_type, S > &rhs)
 Equality operator. More...
 
bool operator!= (const Point< value_type, S > &lhs, const Point< value_type, S > &rhs)
 Inequality operator. More...
 
std::ostream & operator<< (std::ostream &lhs, Point< value_type, S > &rhs)
 Stream extraction operator. More...
 
std::istream & operator>> (std::istream &lhs, Point< value_type, S > &rhs)
 Stream insertion operator. More...
 

Detailed Description

template<typename T, std::size_t S>
class geomdl::Point< T, S >

Represents n-dimensional points.

Template Parameters
Ttype of the values contained, e.g. float, double
Sdimension

Constructor & Destructor Documentation

template<typename T, std::size_t S>
geomdl::Point< T, S >::Point ( const Point< value_type, S > &  rhs)
inline

Copy constructor.

Parameters
rhsobject on the right hand side
template<typename T, std::size_t S>
geomdl::Point< T, S >::Point ( std::initializer_list< value_type values)
inline

Aggregate constructor from a brace-init-list.

Parameters
valuesbrace-init-list
template<typename T, std::size_t S>
geomdl::Point< T, S >::Point ( T *  values)
inlineexplicit

Initializes the point from an array.

Parameters
valuesarray containing the initial values
template<typename T, std::size_t S>
geomdl::Point< T, S >::Point ( value)
inlineexplicit

Initializes all components of the point to the same value.

Parameters
valueinitial value

Member Function Documentation

template<typename T, std::size_t S>
iterator geomdl::Point< T, S >::begin ( )
inline

Iterator begin.

Returns
iterator
template<typename T, std::size_t S>
value_type* geomdl::Point< T, S >::data ( )
inline

Access data.

Returns the direct pointer to the array used internally.

Returns
pointer to the array
template<typename T, std::size_t S>
iterator geomdl::Point< T, S >::end ( )
inline

Iterator end.

Returns
iterator
template<typename T, std::size_t S>
Point<value_type, S>& geomdl::Point< T, S >::operator*= ( const T &  rhs)
inline

Compound assignment operator (primitive multiplication).

Parameters
rhsobject to be multiplicated
Returns
current object after operation
template<typename T, std::size_t S>
Point<value_type, S>& geomdl::Point< T, S >::operator+= ( const Point< value_type, S > &  rhs)
inline

Compound assignment operator (complex addition).

Parameters
rhsobject to be added
Returns
current object after operation
template<typename T, std::size_t S>
Point<value_type, S>& geomdl::Point< T, S >::operator+= ( const T &  rhs)
inline

Compound assignment operator (primitive addition).

Parameters
rhsobject to be added
Returns
current object after operation
template<typename T, std::size_t S>
Point<value_type, S>& geomdl::Point< T, S >::operator-= ( const Point< value_type, S > &  rhs)
inline

Compound assignment operator (complex subtraction).

Parameters
rhsobject to be subtracted
Returns
current object after operation
template<typename T, std::size_t S>
Point<value_type, S>& geomdl::Point< T, S >::operator-= ( const T &  rhs)
inline

Compound assignment operator (primitive subtraction).

Parameters
rhsobject to be subtracted
Returns
current object after operation
template<typename T, std::size_t S>
Point<value_type, S>& geomdl::Point< T, S >::operator/= ( const T &  rhs)
inline

Compound assignment operator (primitive division).

Parameters
rhsobject to be divided
Returns
current object after operation
template<typename T, std::size_t S>
Point<value_type, S>& geomdl::Point< T, S >::operator= ( const Point< value_type, S > &  rhs)
inline

Copy assignment operator.

Parameters
rhsobject to be copied
Returns
point
template<typename T, std::size_t S>
Point<value_type, S>& geomdl::Point< T, S >::operator= ( Point< value_type, S > &&  rhs)
inline

Move assignment operator.

Parameters
rhsobject to be moved
Returns
point
template<typename T, std::size_t S>
value_type& geomdl::Point< T, S >::operator[] ( size_type  idx)
inline

Array subscript operator.

Parameters
idxarray index
Returns
value corresponding to the index
template<typename T, std::size_t S>
const value_type& geomdl::Point< T, S >::operator[] ( size_type  idx) const
inline

Array subscript operator (const).

Parameters
idxarray index
Returns
value corresponding to the index

Friends And Related Function Documentation

template<typename T, std::size_t S>
bool operator!= ( const Point< value_type, S > &  lhs,
const Point< value_type, S > &  rhs 
)
friend

Inequality operator.

Parameters
lhsobject on the left hand side
rhsobject on the right hand side
Returns
object after operation
template<typename T, std::size_t S>
Point<value_type, S> operator* ( Point< value_type, S >  lhs,
const T &  rhs 
)
friend

Arithmetic operator (primitive multiplication).

Parameters
lhsobject on the left hand side
rhsobject on the right hand side
Returns
object after operation
template<typename T, std::size_t S>
Point<value_type, S> operator+ ( Point< value_type, S >  lhs,
const Point< value_type, S > &  rhs 
)
friend

Arithmetic operator (complex addition).

Parameters
lhsobject on the left hand side
rhsobject on the right hand side
Returns
object after operation
template<typename T, std::size_t S>
Point<value_type, S> operator+ ( Point< value_type, S >  lhs,
const T &  rhs 
)
friend

Arithmetic operator (primitive addition).

Parameters
lhsobject on the left hand side
rhsobject on the right hand side
Returns
object after operation
template<typename T, std::size_t S>
Point<value_type, S> operator- ( Point< value_type, S >  lhs,
const Point< value_type, S > &  rhs 
)
friend

Arithmetic operator (complex subtraction).

Parameters
lhsobject on the left hand side
rhsobject on the right hand side
Returns
object after operation
template<typename T, std::size_t S>
Point<value_type, S> operator- ( Point< value_type, S >  lhs,
const T &  rhs 
)
friend

Arithmetic operator (primitive subtraction).

Parameters
lhsobject on the left hand side
rhsobject on the right hand side
Returns
object after operation
template<typename T, std::size_t S>
Point<value_type, S> operator/ ( Point< value_type, S >  lhs,
const T &  rhs 
)
friend

Arithmetic operator (primitive division).

Parameters
lhsobject on the left hand side
rhsobject on the right hand side
Returns
object after operation
template<typename T, std::size_t S>
std::ostream& operator<< ( std::ostream &  lhs,
Point< value_type, S > &  rhs 
)
friend

Stream extraction operator.

Parameters
lhsobject on the left hand side
rhsobject on the right hand side
Returns
object after operation
template<typename T, std::size_t S>
bool operator== ( const Point< value_type, S > &  lhs,
const Point< value_type, S > &  rhs 
)
friend

Equality operator.

Parameters
lhsobject on the left hand side
rhsobject on the right hand side
Returns
object after operation
template<typename T, std::size_t S>
std::istream& operator>> ( std::istream &  lhs,
Point< value_type, S > &  rhs 
)
friend

Stream insertion operator.

Parameters
lhsobject on the left hand side
rhsobject on the right hand side
Returns
object after operation

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