KiCad PCB EDA Suite
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 ()=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)
 

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.

Definition at line 54 of file vector3.h.

Member Typedef Documentation

◆ coord_type

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

Definition at line 58 of file vector3.h.

◆ extended_type

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

Definition at line 57 of file vector3.h.

Constructor & Destructor Documentation

◆ 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 ( x,
y,
z 
)

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

Definition at line 114 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 122 of file vector3.h.

Member Function Documentation

◆ Cross()

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

Compute cross product of self with aVector.

Definition at line 129 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 139 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 148 of file vector3.h.

Referenced by ARC_POINT_EDIT_BEHAVIOR::editArcEndpointKeepTangent().

◆ Normalize()

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

◆ operator!=()

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

Not equality operator.

Definition at line 177 of file vector3.h.

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

◆ operator*=()

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

Definition at line 184 of file vector3.h.

◆ operator/=()

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

Definition at line 195 of file vector3.h.

◆ operator==()

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

Equality operator.

Definition at line 170 of file vector3.h.

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

Member Data Documentation

◆ ECOORD_MAX

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

Definition at line 60 of file vector3.h.

◆ ECOORD_MIN

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

Definition at line 61 of file vector3.h.

◆ x

template<class T = int>
T VECTOR3< T >::x {}

Definition at line 63 of file vector3.h.

Referenced by ACOMPONENTBODY6::ACOMPONENTBODY6(), DXF_IMPORT_PLUGIN::addArc(), DXF_IMPORT_PLUGIN::addCircle(), DXF_IMPORT_PLUGIN::addEllipse(), DXF_IMPORT_PLUGIN::addInsert(), DXF_IMPORT_PLUGIN::addMText(), DXF_IMPORT_PLUGIN::addPoint(), DXF_IMPORT_PLUGIN::addText(), TRIANGLE_DISPLAY_LIST::AddToMiddleContourns(), RENDER_3D_OPENGL::addTopAndBottomTriangles(), DXF_IMPORT_PLUGIN::addVertex(), AMODEL::AMODEL(), ALTIUM_PCB::ConvertComponentBody6ToFootprintItem(), VECTOR3< T >::Cross(), VECTOR3< T >::Dot(), KIGFX::OPENGL_GAL::DrawBitmap(), KIGFX::OPENGL_GAL::drawLineQuad(), ARC_POINT_EDIT_BEHAVIOR::editArcEndpointKeepTangent(), PCB_IO_EASYEDAPRO_PARSER::fillFootprintModelInfo(), DXF_IMPORT_PLUGIN::getArbitraryAxis(), UTILS_STEP_MODEL::GetBoundingBox(), UTILS_BOX3D::GetCenter(), STEP_PCB_MODEL::getModelLabel(), STEP_PCB_MODEL::getModelLocation(), UTILS_BOX3D::GetSize(), getToVector3(), PCBNEW_JOBS_HANDLER::JobExportRender(), PCB_IO_KICAD_LEGACY::load3D(), PCB_IO_EAGLE::loadPolygon(), MATRIX3x3< T >::MATRIX3x3(), VECTOR3< T >::operator!=(), operator*(), operator<<(), VECTOR3< T >::operator==(), PCB_IO_EAGLE::packagePolygon(), kiapi::common::PackVector3D(), PCB_IO_KICAD_SEXPR_PARSER::parse3DModel(), ALTIUM_PCB::ParseComponentsBodies6Data(), PCB_IO_EASYEDA_PARSER::ParseToBoardItemContainer(), RENDER_3D_RAYTRACE_BASE::Reload(), PANEL_PREVIEW_3D_MODEL::SetSelectedModel(), PNS::shovedArea(), DIALOG_SELECT_3DMODEL::TransferDataFromWindow(), STEP_PCB_MODEL::transferModel(), and PANEL_PREVIEW_3D_MODEL::updateOrientation().

◆ y

template<class T = int>
T VECTOR3< T >::y {}

Definition at line 64 of file vector3.h.

Referenced by ACOMPONENTBODY6::ACOMPONENTBODY6(), DXF_IMPORT_PLUGIN::addArc(), DXF_IMPORT_PLUGIN::addCircle(), DXF_IMPORT_PLUGIN::addEllipse(), DXF_IMPORT_PLUGIN::addInsert(), DXF_IMPORT_PLUGIN::addMText(), DXF_IMPORT_PLUGIN::addPoint(), DXF_IMPORT_PLUGIN::addText(), TRIANGLE_DISPLAY_LIST::AddToMiddleContourns(), RENDER_3D_OPENGL::addTopAndBottomTriangles(), DXF_IMPORT_PLUGIN::addVertex(), AMODEL::AMODEL(), ALTIUM_PCB::ConvertComponentBody6ToFootprintItem(), VECTOR3< T >::Cross(), VECTOR3< T >::Dot(), KIGFX::OPENGL_GAL::DrawBitmap(), KIGFX::OPENGL_GAL::drawLineQuad(), ARC_POINT_EDIT_BEHAVIOR::editArcEndpointKeepTangent(), PCB_IO_EASYEDAPRO_PARSER::fillFootprintModelInfo(), DXF_IMPORT_PLUGIN::getArbitraryAxis(), UTILS_STEP_MODEL::GetBoundingBox(), UTILS_BOX3D::GetCenter(), STEP_PCB_MODEL::getModelLabel(), STEP_PCB_MODEL::getModelLocation(), UTILS_BOX3D::GetSize(), getToVector3(), PCBNEW_JOBS_HANDLER::JobExportRender(), PCB_IO_KICAD_LEGACY::load3D(), PCB_IO_EAGLE::loadPolygon(), MATRIX3x3< T >::MATRIX3x3(), VECTOR3< T >::operator!=(), operator*(), operator<<(), VECTOR3< T >::operator==(), PCB_IO_EAGLE::packagePolygon(), kiapi::common::PackVector3D(), PCB_IO_KICAD_SEXPR_PARSER::parse3DModel(), ALTIUM_PCB::ParseComponentsBodies6Data(), PCB_IO_EASYEDA_PARSER::ParseToBoardItemContainer(), RENDER_3D_RAYTRACE_BASE::Reload(), PANEL_PREVIEW_3D_MODEL::SetSelectedModel(), PNS::shovedArea(), DIALOG_SELECT_3DMODEL::TransferDataFromWindow(), STEP_PCB_MODEL::transferModel(), and PANEL_PREVIEW_3D_MODEL::updateOrientation().

◆ z


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