|
libQuat
|
Classes | |
| struct | vec_3d_ |
Typedefs | |
| typedef struct vec_3d_ | vec_3d |
Functions | |
| LIBQUAT_DLL_EXPORTED float | dot_prod (const vec_3d *a, const vec_3d *b) |
| LIBQUAT_DLL_EXPORTED vec_3d | vector_sub (const vec_3d *a, const vec_3d *b) |
| LIBQUAT_DLL_EXPORTED vec_3d | vector_add (const vec_3d *a, const vec_3d *b) |
| LIBQUAT_DLL_EXPORTED vec_3d | vector_prod (const vec_3d *a, const vec_3d *b) |
| LIBQUAT_DLL_EXPORTED LIBQUAT_DLL_EXPORTED const char * | print_vector (const vec_3d *a, const char *name) |
| LIBQUAT_DLL_EXPORTED float | vector_norm (const vec_3d *a) |
| LIBQUAT_DLL_EXPORTED vec_3d | unit_vec (const vec_3d *a) |
| LIBQUAT_DLL_EXPORTED mat_3x3 | get_cross_matrix (const vec_3d *a) |
| LIBQUAT_DLL_EXPORTED vec_3d | operator- (const vec_3d &a, const vec_3d &b) |
| LIBQUAT_DLL_EXPORTED vec_3d | operator- (const vec_3d &a) |
| LIBQUAT_DLL_EXPORTED vec_3d | operator+ (const vec_3d &a, const vec_3d &b) |
| LIBQUAT_DLL_EXPORTED float | operator* (const vec_3d &a, const vec_3d &b) |
| LIBQUAT_DLL_EXPORTED vec_3d | operator* (const float a, const vec_3d &b) |
| LIBQUAT_DLL_EXPORTED vec_3d | operator* (const vec_3d &a, const float b) |
| LIBQUAT_DLL_EXPORTED vec_3d | operator/ (const vec_3d &a, const float b) |
| LIBQUAT_DLL_EXPORTED vec_3d | operator^ (const vec_3d &a, const vec_3d &b) |
| LIBQUAT_DLL_EXPORTED float | operator~ (const vec_3d &a) |
| LIBQUAT_DLL_EXPORTED std::ostream & | operator<< (std::ostream &out, vec_3d const &v) |
| LIBQUAT_DLL_EXPORTED std::ostream & | operator<< (std::ostream &out, quaternion const &v) |
Obtain the dot product of two 3D vectors.
\[ \vec{a}\cdot\vec{b}=a_xb_x + a_yb_y + a_zb_z \]
| [in] | a | first vector |
| [in] | b | second vector |
The cross product of vectors can be represented as a matrix multiplication operation. This function obtains the 3x3 matrix of the cross-product operator from the first vector.
\[\begin{align*} \left(\vec{a}\times\right)\vec{b} &= \tilde{A}_a\vec{b}\\ \tilde{A}_a &= \begin{bmatrix}0&-a_z&a_y\\a_z&0&-a_x\\-a_y&a_x&0\end{bmatrix} \end{align*}\]
| [in] | a | input vector |
3x3 matrix for the cross product operator \(\left(\vec{a}\times\right)\) Scalar multiplication of a 3D vector.
\[ a\cdot\vec{b}=a\cdot b_x\hat{i} + a\cdot b_y \hat{j} + a\cdot b_z\hat{k} \]
| [in] | a | pre-multiplying scalar |
| [in] | b | second vector |
Scalar multiplication of a 3D vector.
\[ \vec{a}\cdot b=a_x\cdot b\hat{i} + a_y\cdot b\hat{j} + a_z\cdot b\hat{k} \]
| [in] | a | first vector |
| [in] | b | post-multiplying scalar |
Obtain the dot product of two 3D vectors.
\[ \vec{a}\cdot\vec{b}=a_xb_x + a_yb_y + a_zb_z \]
| [in] | a | first vector |
| [in] | b | second vector |
Add one vector to another.
\[ \vec{c}=\vec{a}-\vec{b}=\left(a_x-b_x\right)\hat{i}+ \left(a_y-b_y\right)\hat{j}+\left(a_z-b_z\right)\hat{k} \]
| [in] | a | first vector to add |
| [in] | b | second vector to add |
Subtract one vector from another.
\[ \vec{c}=\vec{a}-\vec{b}=\left(a_x-b_x\right)\hat{i}+ \left(a_y-b_y\right)\hat{j}+\left(a_z-b_z\right)\hat{k} \]
| [in] | a | vector to subtract from |
| [in] | b | vector to subtract |
| LIBQUAT_DLL_EXPORTED std::ostream & operator<< | ( | std::ostream & | out, |
| quaternion const & | v | ||
| ) |
operator to print a vec_3d instance.
| out | std::ostream stream to print output to |
| v | vector to print |
| LIBQUAT_DLL_EXPORTED std::ostream & operator<< | ( | std::ostream & | out, |
| vec_3d const & | v | ||
| ) |
operator to print a vec_3d instance.
| out | std::ostream stream to print output to |
| v | vector to print |
Compute the vector product of two 3d vectors.
\[\begin{align*} \vec{a}\times\vec{b} &= \begin{vmatrix} \hat{i} & \hat{j} & \hat{k}\\ a_x & a_y & a_z\\ b_x & b_y & b_z \end{vmatrix}\\ &= \left(a_yb_z-b_ya_z\right)\hat{i} - \left(a_xb_z-b_xa_z\right)\hat{j} + \left(a_xb_y-b_xa_y\right)\hat{k} \end{align*} \]
| [in] | a | first vector \(\vec{a}\) |
| [in] | b | second vector \(\vec{b}\) |
| LIBQUAT_DLL_EXPORTED float operator~ | ( | const vec_3d & | a | ) |
Compute the norm a vector.
\[\lVert\vec{a}\rVert = \sqrt{\vec{a}\cdot\vec{a}} \]
| [in] | a | input vector |
| LIBQUAT_DLL_EXPORTED LIBQUAT_DLL_EXPORTED const char * print_vector | ( | const vec_3d * | a, |
| const char * | name | ||
| ) |
Print formatted vector on stdout.
| [in] | a | vector to print |
| [in] | name | name of the vector |
Obtain unit vector in the same direction as given vector.
\[\hat{a}=\frac{\vec{a}}{\lVert\vec{a}\rVert}\]
| [in] | a | input vector |
Add one vector to another.
\[ \vec{c}=\vec{a}+\vec{b}=\left(a_x+b_x\right)\hat{i}+ \left(a_y+b_y\right)\hat{j}+\left(a_z+b_z\right)\hat{k}\]
| [in] | a | vector to add to |
| [in] | b | vector to add |
| LIBQUAT_DLL_EXPORTED float vector_norm | ( | const vec_3d * | a | ) |
Compute the norm a vector.
\[\lVert\vec{a}\rVert = \sqrt{\vec{a}\cdot\vec{a}} \]
| [in] | a | input vector |
Compute the vector product of two 3d vectors.
\[\begin{align*} \vec{a}\times\vec{b} &= \begin{vmatrix} \hat{i} & \hat{j} & \hat{k}\\ a_x & a_y & a_z\\ b_x & b_y & b_z \end{vmatrix}\\ &= \left(a_yb_z-b_ya_z\right)\hat{i} - \left(a_xb_z-b_xa_z\right)\hat{j} + \left(a_xb_y-b_xa_y\right)\hat{k} \end{align*} \]
| [in] | a | first vector \(\vec{a}\) |
| [in] | b | second vector \(\vec{b}\) |
Subtract one vector from another.
\[ \vec{c}=\vec{a}-\vec{b}=\left(a_x-b_x\right)\hat{i}+ \left(a_y-b_y\right)\hat{j}+\left(a_z-b_z\right)\hat{k}\]
| [in] | a | vector to subtract from |
| [in] | b | vector to subtract |