FormIt C++ API
v23.0.0 (2023.0.0)
|
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... | |
UnitVector3d & | set (double xx, double yy, double zz, bool bVerifyLength) |
UnitVector3d & | zero () |
UnitVector3d & | negate () |
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 |
|
inline |
WSM::UnitVector3d::UnitVector3d | ( | double | xx, |
double | yy, | ||
double | zz, | ||
bool | bVerifyLength = true |
||
) |
|
explicit |
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.
|
inlinestatic |
|
inline |
|
inline |
|
inline |
int WSM::UnitVector3d::dominantDirection | ( | ) | 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.
|
inline |
|
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 |
|
inline |
|
inline |
|
inline |
|
inline |
Cross product.
|
inline |
Cross product.
|
inline |
void WSM::UnitVector3d::operator*= | ( | const Transf3d & | ) |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
UnitVector3d WSM::UnitVector3d::perpend | ( | ) | const |
UnitVector3d& WSM::UnitVector3d::set | ( | double | xx, |
double | yy, | ||
double | zz, | ||
bool | bVerifyLength | ||
) |
|
inline |
|
static |
|
static |
|
static |
|
static |
double WSM::UnitVector3d::x |
double WSM::UnitVector3d::y |
double WSM::UnitVector3d::z |