FormIt C++ API  v23.0.0 (2023.0.0)
WSM::UnitVector3d Class Reference

Description

The UnitVector3d class stores a unit vector in 3D space.

The coordinates of the unit vector are accessed via public data members, x, y, and z, or via the subscript operator, where indices 0, 1, and 2 denote the x-, y-, and z- coordinates, respectively.

The operator '*' is the cross product of vectors, the operator '' is the dot product.

Note, this class is a modification of Vector3d where the length is always 1 or 0.

#include <UnitVector3d.h>

Public Member Functions

 UnitVector3d ()
 
 UnitVector3d (double xx, double yy, double zz, bool bVerifyLength=true)
 
 UnitVector3d (const Vector3d &v, bool bVerifyLength=true)
 
Vector3d operator+ (const UnitVector3d &v) const
 
Vector3d operator- (const UnitVector3d &v) const
 
double operator% (const UnitVector3d &v) const
 
double operator% (const Vector3d &v) const
 
Vector3d operator* (const UnitVector3d &v) const
 Cross product. More...
 
Vector3d operator* (const Vector3d &v) const
 Cross product. More...
 
UnitVector3d operator- () const
 
Vector3d operator* (double scalar) const
 
Vector3d operator/ (double scalar) const
 
double operator[] (size_t index) const
 
double & operator[] (size_t index)
 
double dist (const UnitVector3d &v) const
 
double distSqrd (const UnitVector3d &v) const
 
double distRect (const UnitVector3d &v) const
 
bool isEqual (const UnitVector3d &v, double epsSqrd=WSM_DISTANCE_TOL2) const
 Note espSqrd relates to the angle between the unit vectors by 2 - 2 cos(angle) = epsSqrd. More...
 
bool isEqualRect (const UnitVector3d &v, double epsRect=WSM_DISTANCE_TOL) const
 
double angle (const UnitVector3d &) const
 
UnitVector3d perpend () const
 
void operator*= (const Transf3d &)
 
bool isParallel (const UnitVector3d &, double epsNorSqrd=WSM_ANGLE_TOL2) const
 
bool isParallel (const Vector3d &, double epsNorSqrd=WSM_ANGLE_TOL2) const
 
bool isPerpend (const UnitVector3d &, double epsNor=WSM_ANGLE_TOL) const
 
bool isExactNull () const
 
int dominantDirection () const
 
UnitVector3d CreateArbitraryPerpendicularVector3D () const
 Make an arbitrary perpendicular that is primarily in the x direction. More...
 
UnitVector3dset (double xx, double yy, double zz, bool bVerifyLength)
 
UnitVector3dzero ()
 
UnitVector3dnegate ()
 

Static Public Member Functions

static double det (const WSM::UnitVector3d &a, const WSM::UnitVector3d &b, const WSM::UnitVector3d &c)
 

Public Attributes

double x
 
double y
 
double z
 

Static Public Attributes

static const UnitVector3d kNull
 
static const UnitVector3d kXDir
 
static const UnitVector3d kYDir
 
static const UnitVector3d kZDir
 

Constructor & Destructor Documentation

WSM::UnitVector3d::UnitVector3d ( )
inline
WSM::UnitVector3d::UnitVector3d ( double  xx,
double  yy,
double  zz,
bool  bVerifyLength = true 
)
WSM::UnitVector3d::UnitVector3d ( const Vector3d v,
bool  bVerifyLength = true 
)
explicit

Member Function Documentation

double WSM::UnitVector3d::angle ( const UnitVector3d ) const
UnitVector3d WSM::UnitVector3d::CreateArbitraryPerpendicularVector3D ( ) const

Make an arbitrary perpendicular that is primarily in the x direction.

if this vector is in the x direction then use the y direction. this is used in the geometry attributes to create xaxis vectors.

static double WSM::UnitVector3d::det ( const WSM::UnitVector3d a,
const WSM::UnitVector3d b,
const WSM::UnitVector3d c 
)
inlinestatic
double WSM::UnitVector3d::dist ( const UnitVector3d v) const
inline
double WSM::UnitVector3d::distRect ( const UnitVector3d v) const
inline
double WSM::UnitVector3d::distSqrd ( const UnitVector3d v) const
inline
int WSM::UnitVector3d::dominantDirection ( ) const
bool WSM::UnitVector3d::isEqual ( const UnitVector3d v,
double  epsSqrd = WSM_DISTANCE_TOL2 
) const
inline

Note espSqrd relates to the angle between the unit vectors by 2 - 2 cos(angle) = epsSqrd.

So angle = arccos(1 - epsSqrd / 2). The default espSqrd = WSM_DISTANCE_TOL2 means equal unit vectors differ by an angle of no more than 5.7295e-5 degrees.

bool WSM::UnitVector3d::isEqualRect ( const UnitVector3d v,
double  epsRect = WSM_DISTANCE_TOL 
) const
inline
bool WSM::UnitVector3d::isExactNull ( ) const
inline
bool WSM::UnitVector3d::isParallel ( const UnitVector3d ,
double  epsNorSqrd = WSM_ANGLE_TOL2 
) const
bool WSM::UnitVector3d::isParallel ( const Vector3d ,
double  epsNorSqrd = WSM_ANGLE_TOL2 
) const
bool WSM::UnitVector3d::isPerpend ( const UnitVector3d ,
double  epsNor = WSM_ANGLE_TOL 
) const
UnitVector3d& WSM::UnitVector3d::negate ( )
inline
double WSM::UnitVector3d::operator% ( const UnitVector3d v) const
inline
double WSM::UnitVector3d::operator% ( const Vector3d v) const
inline
WSM::Vector3d WSM::UnitVector3d::operator* ( const UnitVector3d v) const
inline

Cross product.

WSM::Vector3d WSM::UnitVector3d::operator* ( const Vector3d v) const
inline

Cross product.

Vector3d WSM::UnitVector3d::operator* ( double  scalar) const
inline
void WSM::UnitVector3d::operator*= ( const Transf3d )
Vector3d WSM::UnitVector3d::operator+ ( const UnitVector3d v) const
inline
Vector3d WSM::UnitVector3d::operator- ( const UnitVector3d v) const
inline
UnitVector3d WSM::UnitVector3d::operator- ( ) const
inline
Vector3d WSM::UnitVector3d::operator/ ( double  scalar) const
inline
double WSM::UnitVector3d::operator[] ( size_t  index) const
inline
double& WSM::UnitVector3d::operator[] ( size_t  index)
inline
UnitVector3d WSM::UnitVector3d::perpend ( ) const
UnitVector3d& WSM::UnitVector3d::set ( double  xx,
double  yy,
double  zz,
bool  bVerifyLength 
)
UnitVector3d& WSM::UnitVector3d::zero ( )
inline

Member Data Documentation

const UnitVector3d WSM::UnitVector3d::kNull
static
const UnitVector3d WSM::UnitVector3d::kXDir
static
const UnitVector3d WSM::UnitVector3d::kYDir
static
const UnitVector3d WSM::UnitVector3d::kZDir
static
double WSM::UnitVector3d::x
double WSM::UnitVector3d::y
double WSM::UnitVector3d::z

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