Horizon
Loading...
Searching...
No Matches
VECTOR3< T > Class Template Reference

Define a general 3D-vector. More...

#include <vector3.h>

Public Types

typedef VECTOR3_TRAITS< T >::extended_type extended_type
typedef T coord_type

Public Member Functions

 VECTOR3 ()
 Construct a 3D-vector with x, y = 0.
 VECTOR3 (T x, T y, T z)
 Construct a vector with given components x, y.
template<typename CastingType>
 VECTOR3 (const VECTOR3< CastingType > &aVec)
 Initializes a vector from another specialization.
 VECTOR3 (const VECTOR3< T > &aVec)
 Copy a vector.
VECTOR3< T > Cross (const VECTOR3< T > &aVector) const
 Compute cross product of self with aVector.
VECTOR3< T >::extended_type Dot (const VECTOR3< T > &aVector) const
 Compute the dot product of self with aVector.
EuclideanNorm () const
 Compute the Euclidean norm of the vector, which is defined as sqrt(x ** 2 + y ** 2).
VECTOR3< T > Normalize ()
 Compute the normalized vector.
bool operator== (const VECTOR3< T > &aVector) const
 Not equality operator.
bool operator!= (const VECTOR3< T > &aVector) const

Public Attributes

x
y
z

Static Public Attributes

static constexpr extended_type ECOORD_MAX = std::numeric_limits<extended_type>::max()
static constexpr extended_type ECOORD_MIN = std::numeric_limits<extended_type>::min()

Detailed Description

template<class T = int>
class VECTOR3< T >

Define a general 3D-vector.

This class uses templates to be universal. Several operators are provided to help easy implementing of linear algebra equations.

Constructor & Destructor Documentation

◆ VECTOR3()

template<class T = int>
template<typename CastingType>
VECTOR3< T >::VECTOR3 ( const VECTOR3< CastingType > & aVec)
inline

Initializes a vector from another specialization.

Beware of rounding issues.

Member Function Documentation

◆ EuclideanNorm()

template<class T>
T VECTOR3< T >::EuclideanNorm ( ) const

Compute the Euclidean norm of the vector, which is defined as sqrt(x ** 2 + y ** 2).

It is used to calculate the length of the vector.

Returns
Scalar, the euclidean norm

◆ Normalize()

template<class T>
VECTOR3< T > VECTOR3< T >::Normalize ( )

Compute the normalized vector.

Equality operator


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