CVB++ 14.1
Point3DH< T, ENABLE > Class Template Referencefinal

Multi-purpose 3D vector class (homogeneous). More...

#include <cvb/point_3d_h.hpp>

Public Member Functions

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

Related Functions

(Note that these are not member functions.)

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

Detailed Description

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

Multi-purpose 3D vector class (homogeneous).

Constructor & Destructor Documentation

◆ Point3DH() [1/5]

Point3DH ( )
defaultnoexcept

Creates a default point at (0, 0).

Exceptions
Doesnot throw any exception.

◆ Point3DH() [2/5]

Point3DH ( x,
y,
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.

◆ Point3DH() [3/5]

Point3DH ( x,
y,
z,
w 
)
inlinenoexcept

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

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

◆ Point3DH() [4/5]

Point3DH ( Point3D< T >  point3d)
inlineexplicitnoexcept

Create a homogeneous point from a point.

Parameters
[in]point3d3D Point with x-, y- and z-component.
Exceptions
Doesnot throw any exception.

◆ Point3DH() [5/5]

Point3DH ( const T(&)  list[N])
inlinenoexcept

Construct a point with an initializer list.

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

Member Function Documentation

◆ Normalize()

void Normalize ( )
inlinenoexcept

Normalize the x-, y-, and z- with the w-component.

Exceptions
Doesnot throw any exception.

◆ operator!=()

bool operator!= ( const Point3DH< 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*=()

Point3DH< 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+=()

Point3DH< T > & operator+= ( const Point3DH< T > &  point)
inlinenoexcept

Adds and assigns to this point.

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

◆ operator-=()

Point3DH< T > & operator-= ( const Point3DH< T > &  point)
inlinenoexcept

Subtracts and assigns to this point.

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

◆ operator/=()

Point3DH< 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==()

bool operator== ( const Point3DH< 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]

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]

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.

◆ SetW()

void SetW ( w)
inline

Sets the w-component of the point.

Parameters
[in]wW-component.
Exceptions
Doesnot throw any exception.

◆ SetX()

void SetX ( x)
inlinenoexcept

Sets the x-component of the point.

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

◆ SetY()

void SetY ( y)
inline

Sets the y-component of the point.

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

◆ SetZ()

void SetZ ( z)
inline

Sets the z-component of the point.

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

◆ W()

T W ( ) const
inlinenoexcept

Gets the w-component of the point.

Returns
W-component.
Exceptions
Doesnot throw any exception.

◆ X()

T X ( ) const
inlinenoexcept

Gets the x-component of the point.

Returns
X-component.
Exceptions
Doesnot throw any exception.

◆ Y()

T Y ( ) const
inlinenoexcept

Gets the y-component of the point.

Returns
Y-component.
Exceptions
Doesnot throw any exception.

◆ Z()

T Z ( ) const
inlinenoexcept

Gets the z-component of the point.

Returns
Z-component.
Exceptions
Doesnot throw any exception.

Friends And Related Function Documentation

◆ get()

auto get ( const Point3DH< T > &  point) -> decltype(point[I])
related

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

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

◆ operator*() [1/2]

T operator* ( const Point3DH< T > &  lhs,
const Point3DH< 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/2]

Point3DH< T > operator* ( const Point3DH< 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+()

Point3DH< T > operator+ ( const Point3DH< T > &  lhs,
const Point3DH< 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-()

Point3DH< T > operator- ( const Point3DH< T > &  lhs,
const Point3DH< 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/()

Point3DH< T > operator/ ( const Point3DH< 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()

void set ( Point3DH< T > &  point,
const T &  val 
)
related

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

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