Workspace 6.21.5
|
A vector or 3D point in space with useful operation support. More...
#include <Mesh/Geometry/vector3d.h>
Public Types | |
enum | Axis { AxisX , AxisY , AxisZ } |
Public Member Functions | |
Vector3d () | |
Create a zero vector. | |
Vector3d (const double *v) | |
Vector3d (const std::vector< double > &v) | |
Vector3d (const Vector3d &v)=default | |
Create a copy of a vector. | |
Vector3d (double X, double Y, double Z) | |
Create a vector with specific co-ordinates. | |
bool | isNanVector () const |
Check whether coords are valid numbers. | |
bool | isZeroVector () const |
bool | IsZeroVector () const |
double | magnitude () const |
double | magnitude_2 () const |
Vector3d & | operator*= (double d) |
Vector3d & | operator+= (const Vector3d &v) |
Vector3d & | operator-= (const Vector3d &v) |
Vector3d & | operator/= (double d) |
Vector3d & | operator= (const Vector3d &v)=default |
double & | operator[] (int i) |
double | operator[] (int i) const |
void | scaleToUnitVector () |
void | ScaleToUnitVector () |
void | setToZero () |
Set all three components of the vector to zero. | |
void | SetToZero () |
Vector3d | unitVector () const |
Vector3d | UnitVector () const |
Vector3d | vectorProjection (const Vector3d &v) |
Public Attributes | |
double | x |
X co-ordinate. | |
double | y |
Y co-ordinate. | |
double | z |
Z co-ordinate. | |
Related Functions | |
(Note that these are not member functions.) | |
double | cosAngle (const Vector3d &t1, const Vector3d &t2) |
Vector3d | crossProduct (const Vector3d &t1, const Vector3d &t2) |
double | dotProduct (const Vector3d &t1, const Vector3d &t2) |
double | magnitude (const Vector3d &v) |
Convenience function - simply calls v.magnitude(). | |
double | magnitude_2 (const Vector3d &v) |
Convenience function - simply calls v.magnitude_2(). | |
bool | operator!= (const Vector3d &v0, const Vector3d &v1) |
Non-equivalence. | |
Vector3d | operator* (const Vector3d &t, double d) |
Multiplication by a scalar. | |
Vector3d | operator* (double d, const Vector3d &t) |
Multiplication by a scalar. | |
Vector3d | operator+ (const Vector3d &t1, const Vector3d &t2) |
Addition. | |
Vector3d | operator- (const Vector3d &t1) |
Negation. | |
Vector3d | operator- (const Vector3d &t1, const Vector3d &t2) |
Subtraction. | |
Vector3d | operator/ (const Vector3d &t, double d) |
Division. | |
bool | operator== (const Vector3d &v0, const Vector3d &v1) |
Equivalence. | |
double | scalarTripleProduct (const Vector3d &t1, const Vector3d &t2, const Vector3d &t3) |
double | sinAngle (const Vector3d &t1, const Vector3d &t2) |
Vector3d | unitVector (const Vector3d &v) |
Convenience function - simply calls v.unitVector(). | |
Common vector operations are defined, such as addition, multiplication, etc. There are also dot and cross product functions. All functions are inlined for maximum performance.
enum Axis |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Scales the vector to unit length. If it is a zero vector, a ScaledZeroVectorError exception is thrown.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
t1 and t2 can be any arbitrary vectors (including being parallel, in which case a zero vector will be returned).
|
related |
|
related |
|
related |
double x |
double y |
double z |