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 ()=default
Construct a 3D-vector with x, y, z = 0.

VECTOR3 (T x, T y, T z)
Construct a vector with given components x, y, z.

template<typename CastingType >
VECTOR3 (const VECTOR3< CastingType > &aVec)
Initializes a vector from another specialization.

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
Equality operator.

bool operator!= (const VECTOR3< T > &aVector) const
Not equality operator.

VECTOR3< T > & operator*= (T val)

VECTOR3< T > & operator/= (T val)

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.

Definition at line 53 of file vector3.h.

## ◆ coord_type

template<class T = int>
 typedef T VECTOR3< T >::coord_type

Definition at line 57 of file vector3.h.

## ◆ extended_type

template<class T = int>
 typedef VECTOR3_TRAITS::extended_type VECTOR3< T >::extended_type

Definition at line 56 of file vector3.h.

## ◆ VECTOR3() [1/3]

template<class T = int>
 VECTOR3< T >::VECTOR3 ( )
default

Construct a 3D-vector with x, y, z = 0.

## ◆ VECTOR3() [2/3]

template<class T >
 VECTOR3< T >::VECTOR3 ( T x, T y, T z )

Construct a vector with given components x, y, z.

Definition at line 113 of file vector3.h.

## ◆ VECTOR3() [3/3]

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

Initializes a vector from another specialization.

Beware of rounding issues.

Definition at line 121 of file vector3.h.

## ◆ Cross()

template<class T >
 VECTOR3< T > VECTOR3< T >::Cross ( const VECTOR3< T > & aVector ) const

Compute cross product of self with aVector.

Definition at line 128 of file vector3.h.

References VECTOR3< T >::x, VECTOR3< T >::y, and VECTOR3< T >::z.

Referenced by DXF_IMPORT_PLUGIN::getArbitraryAxis(), and SHAPE_ARC::IsCCW().

## ◆ Dot()

template<class T >
 VECTOR3< T >::extended_type VECTOR3< T >::Dot ( const VECTOR3< T > & aVector ) const

Compute the dot product of self with aVector.

Definition at line 138 of file vector3.h.

References VECTOR3< T >::x, VECTOR3< T >::y, and VECTOR3< T >::z.

## ◆ EuclideanNorm()

template<class T >
 T VECTOR3< T >::EuclideanNorm

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

Definition at line 147 of file vector3.h.

Referenced by PCB_POINT_EDITOR::editArcEndpointKeepTangent().

## ◆ Normalize()

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

Compute the normalized vector.

Definition at line 154 of file vector3.h.

## ◆ operator!=()

template<class T >
 bool VECTOR3< T >::operator!= ( const VECTOR3< T > & aVector ) const

Not equality operator.

Definition at line 176 of file vector3.h.

References VECTOR3< T >::x, VECTOR3< T >::y, and VECTOR3< T >::z.

## ◆ operator*=()

template<class T >
 VECTOR3< T > & VECTOR3< T >::operator*= ( T val )

Definition at line 183 of file vector3.h.

## ◆ operator/=()

template<class T >
 VECTOR3< T > & VECTOR3< T >::operator/= ( T val )

Definition at line 194 of file vector3.h.

## ◆ operator==()

template<class T >
 bool VECTOR3< T >::operator== ( const VECTOR3< T > & aVector ) const

Equality operator.

Definition at line 169 of file vector3.h.

References VECTOR3< T >::x, VECTOR3< T >::y, and VECTOR3< T >::z.

## ◆ ECOORD_MAX

template<class T = int>
 constexpr extended_type VECTOR3< T >::ECOORD_MAX = std::numeric_limits::max()
staticconstexpr

Definition at line 59 of file vector3.h.

## ◆ ECOORD_MIN

template<class T = int>
 constexpr extended_type VECTOR3< T >::ECOORD_MIN = std::numeric_limits::min()
staticconstexpr

Definition at line 60 of file vector3.h.

## ◆ z

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