OpenLexocad  27.1
Base::Vector3< _Precision > Class Template Reference

#include <Vector3D.h>

Public Types

typedef _Precision num_type
 
typedef float_traits< num_typetraits_type
 

Public Member Functions

 Vector3 (_Precision fx=0.0, _Precision fy=0.0, _Precision fz=0.0)
 Construction. More...
 
 Vector3 (const Vector3< _Precision > &rcVct)
 Construction. More...
 
bool IsOnLineSegment (const Vector3< _Precision > &startVct, const Vector3< _Precision > &endVct) const
 Check if Vector is on a line segment. More...
 
void Set (_Precision fX, _Precision fY, _Precision fZ)
 
Operator
_Precision & operator [] (unsigned short usIndex)
 Returns a reference to a coordinate. usIndex must be in the range [0,2]. More...
 
const _Precision & operator [] (unsigned short usIndex) const
 Returns a const reference to a coordinate. usIndex must be in the range [0,2]. More...
 
Vector3 operator+ (const Vector3< _Precision > &rcVct) const
 Vector addition. More...
 
Vector3 operator & (const Vector3< _Precision > &rcVct) const
 
Vector3 operator - (const Vector3< _Precision > &rcVct) const
 Vector subtraction. More...
 
Vector3 operator - (void) const
 Negative vector. More...
 
Vector3operator+= (const Vector3< _Precision > &rcVct)
 Vector summation. More...
 
Vector3operator -= (const Vector3< _Precision > &rcVct)
 Vector subtraction. More...
 
Vector3 operator * (_Precision fScale) const
 Vector scaling. More...
 
Vector3 operator/ (_Precision fDiv) const
 
Vector3operator *= (_Precision fScale)
 
Vector3operator/= (_Precision fDiv)
 
Vector3operator= (const Vector3< _Precision > &rcVct)
 Assignment. More...
 
_Precision operator * (const Vector3< _Precision > &rcVct) const
 Scalar product. More...
 
_Precision Dot (const Vector3< _Precision > &rcVct) const
 Scalar product. More...
 
Vector3 operator % (const Vector3< _Precision > &rcVct) const
 Cross product. More...
 
Vector3 Cross (const Vector3< _Precision > &rcVct) const
 Cross product. More...
 
bool operator != (const Vector3< _Precision > &rcVct) const
 Comparing for inequality. More...
 
bool operator== (const Vector3< _Precision > &rcVct) const
 Comparing for equality. More...
 
Modification
void ScaleX (_Precision f)
 
void ScaleY (_Precision f)
 
void ScaleZ (_Precision f)
 
void Scale (_Precision fX, _Precision fY, _Precision fZ)
 
void MoveX (_Precision f)
 
void MoveY (_Precision f)
 
void MoveZ (_Precision f)
 
void Move (_Precision fX, _Precision fY, _Precision fZ)
 
void RotateX (_Precision f)
 
void RotateY (_Precision f)
 
void RotateZ (_Precision f)
 
Mathematics
_Precision Length (void) const
 Length of the vector. More...
 
_Precision Sqr (void) const
 Squared length of the vector. More...
 
Vector3Normalize (void)
 Set length to 1. More...
 
_Precision GetAngle (const Vector3 &rcVect) const
 Get angle between both vectors. The returned value lies in the interval [0,pi]. More...
 
void TransformToCoordinateSystem (const Vector3 &rclBase, const Vector3 &rclDirX, const Vector3 &rclDirY)
 
bool IsEqual (const Vector3 &rclPnt, _Precision tol) const
 IsEqual. More...
 
Vector3ProjectToPlane (const Vector3 &rclBase, const Vector3 &rclNorm)
 Projects this point onto the plane given by the base rclBase and the normal rclNorm. More...
 
void ProjectToPlane (const Vector3 &rclBase, const Vector3 &rclNorm, Vector3 &rclProj) const
 
Vector3ProjectToLine (const Vector3 &rclPoint, const Vector3 &rclLine)
 Projects this point onto the line given by the base rclPoint and the direction rclLine. More...
 
Vector3 Perpendicular (const Vector3 &rclBase, const Vector3 &rclDir) const
 
_Precision DistanceToPlane (const Vector3 &rclBase, const Vector3 &rclNorm) const
 
_Precision DistanceToLine (const Vector3 &rclBase, const Vector3 &rclDirect) const
 Computes the distance from this point to the line given by rclBase and rclDirect. More...
 
Vector3 DistanceToLineSegment (const Vector3 &rclP1, const Vector3 &rclP2) const
 

Static Public Member Functions

static num_type epsilon ()
 

Public Attributes

Public data members
_Precision x
 
_Precision y
 
_Precision z
 

Detailed Description

template<class _Precision>
class Base::Vector3< _Precision >

The Vector Base class.

Member Typedef Documentation

◆ num_type

template<class _Precision>
typedef _Precision Base::Vector3< _Precision >::num_type

◆ traits_type

template<class _Precision>
typedef float_traits<num_type> Base::Vector3< _Precision >::traits_type

Constructor & Destructor Documentation

◆ Vector3() [1/2]

template<class _Precision>
Base::Vector3< _Precision >::Vector3 ( _Precision  fx = 0.0,
_Precision  fy = 0.0,
_Precision  fz = 0.0 
)
explicit

Construction.

◆ Vector3() [2/2]

template<class _Precision>
Base::Vector3< _Precision >::Vector3 ( const Vector3< _Precision > &  rcVct)

Construction.

Member Function Documentation

◆ Cross()

template<class _Precision>
Vector3 Base::Vector3< _Precision >::Cross ( const Vector3< _Precision > &  rcVct) const

Cross product.

◆ DistanceToLine()

template<class _Precision>
_Precision Base::Vector3< _Precision >::DistanceToLine ( const Vector3< _Precision > &  rclBase,
const Vector3< _Precision > &  rclDirect 
) const

Computes the distance from this point to the line given by rclBase and rclDirect.

◆ DistanceToLineSegment()

template<class _Precision>
Vector3 Base::Vector3< _Precision >::DistanceToLineSegment ( const Vector3< _Precision > &  rclP1,
const Vector3< _Precision > &  rclP2 
) const

Computes the vector from this point to the point on the line segment with the shortest distance. The line segment is defined by rclP1 and rclP2. Note: If the projection of this point is outside the segment then the shortest distance to rclP1 or rclP2 is computed.

◆ DistanceToPlane()

template<class _Precision>
_Precision Base::Vector3< _Precision >::DistanceToPlane ( const Vector3< _Precision > &  rclBase,
const Vector3< _Precision > &  rclNorm 
) const

Computes the distance to the given plane. Depending on the side this point is located the distance can also be negative. The distance is positive if the point is at the same side the plane normal points to, negative otherwise.

◆ Dot()

template<class _Precision>
_Precision Base::Vector3< _Precision >::Dot ( const Vector3< _Precision > &  rcVct) const

Scalar product.

◆ epsilon()

template<class _Precision>
static num_type Base::Vector3< _Precision >::epsilon ( )
inlinestatic

◆ GetAngle()

template<class _Precision>
_Precision Base::Vector3< _Precision >::GetAngle ( const Vector3< _Precision > &  rcVect) const

Get angle between both vectors. The returned value lies in the interval [0,pi].

◆ IsEqual()

template<class _Precision>
bool Base::Vector3< _Precision >::IsEqual ( const Vector3< _Precision > &  rclPnt,
_Precision  tol 
) const

IsEqual.

Parameters
rclPnt
tol
Returns
true or false If the distance to point rclPnt is within the tolerance tol both points are considered equal.

◆ IsOnLineSegment()

template<class _Precision>
bool Base::Vector3< _Precision >::IsOnLineSegment ( const Vector3< _Precision > &  startVct,
const Vector3< _Precision > &  endVct 
) const

Check if Vector is on a line segment.

◆ Length()

template<class _Precision>
_Precision Base::Vector3< _Precision >::Length ( void  ) const

Length of the vector.

◆ Move()

template<class _Precision>
void Base::Vector3< _Precision >::Move ( _Precision  fX,
_Precision  fY,
_Precision  fZ 
)

◆ MoveX()

template<class _Precision>
void Base::Vector3< _Precision >::MoveX ( _Precision  f)

◆ MoveY()

template<class _Precision>
void Base::Vector3< _Precision >::MoveY ( _Precision  f)

◆ MoveZ()

template<class _Precision>
void Base::Vector3< _Precision >::MoveZ ( _Precision  f)

◆ Normalize()

template<class _Precision>
Vector3& Base::Vector3< _Precision >::Normalize ( void  )

Set length to 1.

◆ operator !=()

template<class _Precision>
bool Base::Vector3< _Precision >::operator != ( const Vector3< _Precision > &  rcVct) const

Comparing for inequality.

◆ operator %()

template<class _Precision>
Vector3 Base::Vector3< _Precision >::operator % ( const Vector3< _Precision > &  rcVct) const

Cross product.

◆ operator &()

template<class _Precision>
Vector3 Base::Vector3< _Precision >::operator & ( const Vector3< _Precision > &  rcVct) const

◆ operator *() [1/2]

template<class _Precision>
Vector3 Base::Vector3< _Precision >::operator * ( _Precision  fScale) const

Vector scaling.

◆ operator *() [2/2]

template<class _Precision>
_Precision Base::Vector3< _Precision >::operator * ( const Vector3< _Precision > &  rcVct) const

Scalar product.

◆ operator *=()

template<class _Precision>
Vector3& Base::Vector3< _Precision >::operator *= ( _Precision  fScale)

◆ operator -() [1/2]

template<class _Precision>
Vector3 Base::Vector3< _Precision >::operator - ( const Vector3< _Precision > &  rcVct) const

Vector subtraction.

◆ operator -() [2/2]

template<class _Precision>
Vector3 Base::Vector3< _Precision >::operator - ( void  ) const

Negative vector.

◆ operator -=()

template<class _Precision>
Vector3& Base::Vector3< _Precision >::operator -= ( const Vector3< _Precision > &  rcVct)

Vector subtraction.

◆ operator []() [1/2]

template<class _Precision>
_Precision& Base::Vector3< _Precision >::operator [] ( unsigned short  usIndex)

Returns a reference to a coordinate. usIndex must be in the range [0,2].

◆ operator []() [2/2]

template<class _Precision>
const _Precision& Base::Vector3< _Precision >::operator [] ( unsigned short  usIndex) const

Returns a const reference to a coordinate. usIndex must be in the range [0,2].

◆ operator+()

template<class _Precision>
Vector3 Base::Vector3< _Precision >::operator+ ( const Vector3< _Precision > &  rcVct) const

Vector addition.

◆ operator+=()

template<class _Precision>
Vector3& Base::Vector3< _Precision >::operator+= ( const Vector3< _Precision > &  rcVct)

Vector summation.

◆ operator/()

template<class _Precision>
Vector3 Base::Vector3< _Precision >::operator/ ( _Precision  fDiv) const

◆ operator/=()

template<class _Precision>
Vector3& Base::Vector3< _Precision >::operator/= ( _Precision  fDiv)

◆ operator=()

template<class _Precision>
Vector3& Base::Vector3< _Precision >::operator= ( const Vector3< _Precision > &  rcVct)

Assignment.

◆ operator==()

template<class _Precision>
bool Base::Vector3< _Precision >::operator== ( const Vector3< _Precision > &  rcVct) const

Comparing for equality.

◆ Perpendicular()

template<class _Precision>
Vector3 Base::Vector3< _Precision >::Perpendicular ( const Vector3< _Precision > &  rclBase,
const Vector3< _Precision > &  rclDir 
) const

Get the perpendicular of this point to the line defined by rclBase and rclDir. Note: Do not mix up this method with ProjectToLine.

◆ ProjectToLine()

template<class _Precision>
Vector3& Base::Vector3< _Precision >::ProjectToLine ( const Vector3< _Precision > &  rclPoint,
const Vector3< _Precision > &  rclLine 
)

Projects this point onto the line given by the base rclPoint and the direction rclLine.

Projects a point rclPoint onto the line defined by the origin and the direction rclLine. The result is a vector from rclPoint to the point on the line. The length of this vector is the distance from rclPoint to the line. Note: The resulting vector does not depend on the current vector.

◆ ProjectToPlane() [1/2]

template<class _Precision>
Vector3& Base::Vector3< _Precision >::ProjectToPlane ( const Vector3< _Precision > &  rclBase,
const Vector3< _Precision > &  rclNorm 
)

Projects this point onto the plane given by the base rclBase and the normal rclNorm.

◆ ProjectToPlane() [2/2]

template<class _Precision>
void Base::Vector3< _Precision >::ProjectToPlane ( const Vector3< _Precision > &  rclBase,
const Vector3< _Precision > &  rclNorm,
Vector3< _Precision > &  rclProj 
) const

Projects this point onto the plane given by the base rclBase and the normal rclNorm and stores the result in rclProj.

◆ RotateX()

template<class _Precision>
void Base::Vector3< _Precision >::RotateX ( _Precision  f)

◆ RotateY()

template<class _Precision>
void Base::Vector3< _Precision >::RotateY ( _Precision  f)

◆ RotateZ()

template<class _Precision>
void Base::Vector3< _Precision >::RotateZ ( _Precision  f)

◆ Scale()

template<class _Precision>
void Base::Vector3< _Precision >::Scale ( _Precision  fX,
_Precision  fY,
_Precision  fZ 
)

◆ ScaleX()

template<class _Precision>
void Base::Vector3< _Precision >::ScaleX ( _Precision  f)

◆ ScaleY()

template<class _Precision>
void Base::Vector3< _Precision >::ScaleY ( _Precision  f)

◆ ScaleZ()

template<class _Precision>
void Base::Vector3< _Precision >::ScaleZ ( _Precision  f)

◆ Set()

template<class _Precision>
void Base::Vector3< _Precision >::Set ( _Precision  fX,
_Precision  fY,
_Precision  fZ 
)

◆ Sqr()

template<class _Precision>
_Precision Base::Vector3< _Precision >::Sqr ( void  ) const

Squared length of the vector.

◆ TransformToCoordinateSystem()

template<class _Precision>
void Base::Vector3< _Precision >::TransformToCoordinateSystem ( const Vector3< _Precision > &  rclBase,
const Vector3< _Precision > &  rclDirX,
const Vector3< _Precision > &  rclDirY 
)

Transforms this point to the coordinate system defined by origin rclBase, vector vector rclDirX and vector vector rclDirY.

Note
rclDirX must be perpendicular to rclDirY, i.e. rclDirX * rclDirY = 0..

Member Data Documentation

◆ x

template<class _Precision>
_Precision Base::Vector3< _Precision >::x

x-coordinate

◆ y

template<class _Precision>
_Precision Base::Vector3< _Precision >::y

y-coordinate

◆ z

template<class _Precision>
_Precision Base::Vector3< _Precision >::z

z-coordinate


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