CVB++ 15.0
Point3D< T, ENABLE > Class Template Referencefinal

Multi-purpose 3D vector class. More...

#include <cvb/point_3d.hpp>

Public Member Functions

 Point3D () noexcept=default
 Creates a default point at (0, 0).
 
 Point3D (T x, T y, T z) noexcept
 Create a point from the x, y and z component.
 
template<std::size_t N>
 Point3D (const T(&list)[N]) noexcept
 Construct a point with an initializer list.
 
X () const noexcept
 Get the x component of the point.
 
void SetX (T x) noexcept
 Set the x component of the point.
 
Y () const noexcept
 Get the y component of the point.
 
void SetY (T y)
 Set the y component of the point.
 
Z () const noexcept
 Get the z component of the point.
 
void SetZ (T z)
 Set the z component of the point.
 
Length () const noexcept
 Gets the length of this point.
 
bool operator== (const Point3D< T > &other) const noexcept
 Compares to an other point.
 
bool operator!= (const Point3D< T > &other) const noexcept
 Compares to an other point.
 
template<class C>
 operator Point3D< C > () const noexcept
 Enable casting.
 
Point3D< T > & operator+= (const Point3D< T > &point) noexcept
 Adds and assigns to this point.
 
Point3D< T > & operator-= (const Point3D< T > &point) noexcept
 Subtracts and assigns to this point.
 
Point3D< T > & operator*= (const T &value) noexcept
 Multiplies by a scalar and assigns to this point.
 
Point3D< T > & operator/= (const T &value) noexcept
 Divide by a scalar and assigns to this point.
 
const T & operator[] (int index) const noexcept
 Index based element access.
 
T & operator[] (int index) noexcept
 Index based element access.
 

Related Symbols

(Note that these are not member symbols.)

template<size_t I, class T, std::enable_if_t< less< I, 3 >::value, int > = 0>
auto get (const Point3D< T > &point) noexcept -> decltype(point[I])
 Get's the I-th element of the Point3D<T>.
 
template<size_t I, class T, std::enable_if_t< less< I, 3 >::value, int > = 0>
void set (Point3D< T > &point, const T &val) noexcept
 Set's the value of the I-th element in the Point3D<T> point.
 
template<class T>
Point3D< T > operator+ (const Point3D< T > &lhs, const Point3D< T > &rhs)
 Add two points.
 
template<class T>
Point3D< T > operator- (const Point3D< T > &lhs, const Point3D< T > &rhs)
 Subtracts two points.
 
template<class T>
operator* (const Point3D< T > &lhs, const Point3D< T > &rhs)
 Inner product of two point vectors.
 
template<class T>
Point3D< T > operator* (const Point3D< T > &lhs, const T &rhs)
 Multiply point with scalar.
 
template<class T>
Point3D< T > operator* (const T &lhs, const Point3D< T > &rhs)
 Multiply scalar with point.
 
template<class T>
Point3D< T > operator/ (const Point3D< T > &lhs, const T &rhs)
 Divide point by scalar.
 
template<class T>
Point3DC< T > operator* (const T &lhs, const Point3DC< T > &rhs)
 Multiply scalar with point.
 
template<class T>
Point3DH< T > operator* (const T &lhs, const Point3DH< T > &rhs)
 Multiply scalar with point.
 

Detailed Description

template<class T, class ENABLE = void>
class Cvb::Point3D< T, ENABLE >

Multi-purpose 3D vector class.

Constructor & Destructor Documentation

◆ Point3D() [1/3]

template<class T, class ENABLE = void>
Point3D ( )
defaultnoexcept

Creates a default point at (0, 0).

Exceptions
Doesnot throw any exception.

◆ Point3D() [2/3]

template<class T, class ENABLE = void>
Point3D ( T x,
T y,
T z )
inlinenoexcept

Create a point from the x, y and z component.

Parameters
[in]xData to initialize with
[in]yData to initialize with
[in]zData to initialize with
Exceptions
Doesnot throw any exception.

◆ Point3D() [3/3]

template<class T, class ENABLE = void>
template<std::size_t N>
Point3D ( const T(&) list[N])
inlinenoexcept

Construct a point with an initializer list.

Parameters
[in]listContaining exactly 3 elements.
Exceptions
Doesnot throw any exception.

Member Function Documentation

◆ Length()

template<class T, class ENABLE = void>
T Length ( ) const
inlinenoexcept

Gets the length of this point.

Returns
length of this point.
Exceptions
Doesnot throw any exception.

◆ operator!=()

template<class T, class ENABLE = void>
bool operator!= ( const Point3D< T > & other) const
inlinenoexcept

Compares to an other point.

Parameters
[in]otherOther point.
Returns
True if not equal, otherwise false.
Exceptions
Doesnot throw any exception.

◆ operator*=()

template<class T, class ENABLE = void>
Point3D< T > & operator*= ( const T & value)
inlinenoexcept

Multiplies by a scalar and assigns to this point.

Parameters
[in]valueThe scalar.
Returns
This point.
Exceptions
Doesnot throw any exception.

◆ operator+=()

template<class T, class ENABLE = void>
Point3D< T > & operator+= ( const Point3D< T > & point)
inlinenoexcept

Adds and assigns to this point.

Parameters
[in]pointOther point.
Returns
This point.
Exceptions
Doesnot throw any exception.

◆ operator-=()

template<class T, class ENABLE = void>
Point3D< T > & operator-= ( const Point3D< T > & point)
inlinenoexcept

Subtracts and assigns to this point.

Parameters
[in]pointOther point.
Returns
This point.
Exceptions
Doesnot throw any exception.

◆ operator/=()

template<class T, class ENABLE = void>
Point3D< T > & operator/= ( const T & value)
inlinenoexcept

Divide by a scalar and assigns to this point.

Parameters
[in]valueThe scalar.
Returns
This point.
Exceptions
Doesnot throw any exception.

◆ operator==()

template<class T, class ENABLE = void>
bool operator== ( const Point3D< T > & other) const
inlinenoexcept

Compares to an other point.

Parameters
[in]otherOther point.
Returns
True if equal, otherwise false.
Exceptions
Doesnot throw any exception.

◆ operator[]() [1/2]

template<class T, class ENABLE = void>
const T & operator[] ( int index) const
inlinenoexcept

Index based element access.

Parameters
[in]indexIndex of the element.
Returns
A const reference to the element.
Exceptions
Doesnot throw any exception.

◆ operator[]() [2/2]

template<class T, class ENABLE = void>
T & operator[] ( int index)
inlinenoexcept

Index based element access.

Parameters
[in]indexIndex of the element.
Returns
A reference to the element.
Exceptions
Doesnot throw any exception.

◆ SetX()

template<class T, class ENABLE = void>
void SetX ( T x)
inlinenoexcept

Set the x component of the point.

Parameters
[in]xX component.
Exceptions
Doesnot throw any exception.

◆ SetY()

template<class T, class ENABLE = void>
void SetY ( T y)
inline

Set the y component of the point.

Parameters
[in]yY component.
Exceptions
Doesnot throw any exception.

◆ SetZ()

template<class T, class ENABLE = void>
void SetZ ( T z)
inline

Set the z component of the point.

Parameters
[in]zZ component.
Exceptions
Doesnot throw any exception.

◆ X()

template<class T, class ENABLE = void>
T X ( ) const
inlinenoexcept

Get the x component of the point.

Returns
X component.
Exceptions
Doesnot throw any exception.

◆ Y()

template<class T, class ENABLE = void>
T Y ( ) const
inlinenoexcept

Get the y component of the point.

Returns
Y component.
Exceptions
Doesnot throw any exception.

◆ Z()

template<class T, class ENABLE = void>
T Z ( ) const
inlinenoexcept

Get the z component of the point.

Returns
Z component.
Exceptions
Doesnot throw any exception.

Friends And Related Symbol Documentation

◆ get()

template<size_t I, class T, std::enable_if_t< less< I, 3 >::value, int > = 0>
auto get ( const Point3D< T > & point) -> decltype(point[I])
related

Get's the I-th element of the Point3D<T>.

See also
Block, Visit
Precondition
I < 3
Template Parameters
IThe index of the element.
Parameters
pointThe Point3D<T> to retrieve the I-th element from.
Returns
The I-th element of point.

◆ operator*() [1/5]

template<class T>
T operator* ( const Point3D< T > & lhs,
const Point3D< T > & rhs )
related

Inner product of two point vectors.

Parameters
[in]lhsRight hand side point.
[in]rhsLeft hand side value.
Returns
The computation result.
Exceptions
Doesnot throw any exception.

◆ operator*() [2/5]

template<class T>
Point3D< T > operator* ( const Point3D< T > & lhs,
const T & rhs )
related

Multiply point with scalar.

Parameters
[in]lhsRight hand side point.
[in]rhsLeft hand side value.
Returns
The computation result.
Exceptions
Doesnot throw any exception.

◆ operator*() [3/5]

template<class T>
Point3D< T > operator* ( const T & lhs,
const Point3D< T > & rhs )
related

Multiply scalar with point.

Parameters
[in]lhsRight hand side value.
[in]rhsLeft hand side point.
Returns
The computation result.
Exceptions
Doesnot throw any exception.

◆ operator*() [4/5]

template<class T>
Point3DC< T > operator* ( const T & lhs,
const Point3DC< T > & rhs )
related

Multiply scalar with point.

Parameters
[in]lhsRight hand side value.
[in]rhsLeft hand side point.
Returns
The computation result.
Exceptions
Doesnot throw any exception.

◆ operator*() [5/5]

template<class T>
Point3DH< T > operator* ( const T & lhs,
const Point3DH< T > & rhs )
related

Multiply scalar with point.

Parameters
[in]lhsRight hand side value.
[in]rhsLeft hand side point.
Returns
The computation result.
Exceptions
Doesnot throw any exception.

◆ operator+()

template<class T>
Point3D< T > operator+ ( const Point3D< T > & lhs,
const Point3D< T > & rhs )
related

Add two points.

Parameters
[in]lhsRight hand side point.
[in]rhsLeft hand side point.
Returns
The computation result.
Exceptions
Doesnot throw any exception.

◆ operator-()

template<class T>
Point3D< T > operator- ( const Point3D< T > & lhs,
const Point3D< T > & rhs )
related

Subtracts two points.

Parameters
[in]lhsRight hand side point.
[in]rhsLeft hand side point.
Returns
The computation result.
Exceptions
Doesnot throw any exception.

◆ operator/()

template<class T>
Point3D< T > operator/ ( const Point3D< T > & lhs,
const T & rhs )
related

Divide point by scalar.

Parameters
[in]lhsRight hand side matrix.
[in]rhsLeft hand side value.
Returns
The computation result.
Exceptions
Doesnot throw any exception.

◆ set()

template<size_t I, class T, std::enable_if_t< less< I, 3 >::value, int > = 0>
void set ( Point3D< T > & point,
const T & val )
related

Set's the value of the I-th element in the Point3D<T> point.

See also
Block, Visit
Precondition
I < 3
Template Parameters
IThe index of the element.
Parameters
pointThe Point3D<T,K> to set the I-th value in.
valThe value to be written to the I-th element of point.