A class for representing 3D vectors.
More...
#include <openvsp_as.h>
vec3d is typically used to describe coordinate points and vectors in 3D space. All 3 elements in the vector are of type double.
Definition at line 349 of file openvsp_as.h.
◆ mag()
double vec3d::mag |
( |
| ) |
const |
Get the magnitude of a vec3d
if ( abs( a.
mag() - sqrt( 14 ) ) > 1e-6 ) {
Print(
"---> Error: Vec3d Mag " ); }
- Returns
- Magnitude
◆ normalize()
void vec3d::normalize |
( |
| ) |
|
◆ offset_x()
void vec3d::offset_x |
( |
double |
offset | ) |
|
Offset the X coordinate of the vec3d
- Parameters
-
[in] | offset | Offset for the X value |
◆ offset_y()
void vec3d::offset_y |
( |
double |
offset | ) |
|
Offset the Y coordinate of the vec3d
- Parameters
-
[in] | offset | Offset for the Y value |
◆ offset_z()
void vec3d::offset_z |
( |
double |
offset | ) |
|
Offset the Z coordinate of the vec3d
- Parameters
-
[in] | offset | Offset for the Z value |
◆ operator *() [1/2]
vec3d vec3d::operator * |
( |
double |
b | ) |
const |
Scalar multiplication operator for a vec3d, performed by the multiplication of each vec3d component and the scalar
double b = 1.5;
Print(
"a * b = ",
false );
◆ operator *() [2/2]
Multiplication operator for two vec3d objects, performed by the multiplication of each corresponding component
Print(
"a * b = ",
false );
◆ operator+()
Addition operator for two vec3d objects, performed by the addition of each corresponding component
Print(
"a + b = ",
false );
◆ operator-()
Subtraction operator for two vec3d objects, performed by the subtraction of each corresponding component
\code{.cpp}
Print(
"a - b = ",
false );
◆ operator/()
vec3d vec3d::operator/ |
( |
double |
b | ) |
const |
Scalar division operator for a vec3d, performed by the division of of each vec3d component by the scalar
double b = 1.5;
Print(
"a / b = ",
false );
◆ operator[]()
double& vec3d::operator[] |
( |
int |
| ) |
const |
Indexing operator for vec3d. Supported indexes are 0 (X), 1 (Y), and 2 (Z).
◆ reflect_xy()
vec3d vec3d::reflect_xy |
( |
| ) |
|
Reflect the vec3d accross the XY plane
- Returns
- Reflected vec3d
◆ reflect_xz()
vec3d vec3d::reflect_xz |
( |
| ) |
|
Reflect the vec3d accross the XZ plane
- Returns
- Reflected vec3d
◆ reflect_yz()
vec3d vec3d::reflect_yz |
( |
| ) |
|
Reflect the vec3d accross the YZ plane
- Returns
- Reflected vec3d
◆ rotate_x()
void vec3d::rotate_x |
( |
double |
cos_alpha, |
|
|
double |
sin_alpha |
|
) |
| |
Rotate the vec3d about the X axis.
\begin{equation}x = cos \textunderscore alpha * x + sin \textunderscore alpha * z\end{equation}
\begin{equation}y = -sin \textunderscore alpha * old_y + cos \textunderscore alpha * z\end{equation}
a.
rotate_x( cos( 0.5 * PI ), sin( 0.5 * PI ) );
- Parameters
-
[in] | cos_alpha | Cosine of rotation angle |
[in] | sin_alpha | Sine of rotation angle |
◆ rotate_y()
void vec3d::rotate_y |
( |
double |
cos_alpha, |
|
|
double |
sin_alpha |
|
) |
| |
Rotate the vec3d about the Y axis.
\begin{equation}x = cos \textunderscore alpha * x - sin \textunderscore alpha * z\end{equation}
\begin{equation}z = sin \textunderscore alpha * old_x + cos \textunderscore alpha * z\end{equation}
a.
rotate_y( cos( 0.5 * PI ), sin( 0.5 * PI ) );
- Parameters
-
[in] | cos_alpha | Cosine of rotation angle |
[in] | sin_alpha | Sine of rotation angle |
◆ rotate_z()
void vec3d::rotate_z |
( |
double |
cos_alpha, |
|
|
double |
sin_alpha |
|
) |
| |
Rotate the vec3d about the Z axis.
\begin{equation}x = cos \textunderscore alpha * x + sin \textunderscore alpha * y\end{equation}
\begin{equation}y = -sin \textunderscore alpha * old_x + cos \textunderscore alpha * y\end{equation}
a.
rotate_z( cos( 0.5 * PI ), sin( 0.5 * PI ) );
- Parameters
-
[in] | cos_alpha | Cosine of rotation angle |
[in] | sin_alpha | Sine of rotation angle |
◆ rotate_z_zero_x()
void vec3d::rotate_z_zero_x |
( |
double |
cos_alpha, |
|
|
double |
sin_alpha |
|
) |
| |
Rotate the vec3d about the Z axis assuming zero X coordinate value
- Parameters
-
[in] | cos_alpha | Cosine of rotation angle |
[in] | sin_alpha | Sine of rotation angle |
◆ rotate_z_zero_y()
void vec3d::rotate_z_zero_y |
( |
double |
cos_alpha, |
|
|
double |
sin_alpha |
|
) |
| |
Rotate the vec3d about the Z axis assuming zero Y coordinate value
- Parameters
-
[in] | cos_alpha | Cosine of rotation angle |
[in] | sin_alpha | Sine of rotation angle |
◆ scale_x()
void vec3d::scale_x |
( |
double |
scale | ) |
|
Scale the X coordinate of the vec3d
- Parameters
-
[in] | scale | Scaling factor for the X value |
◆ scale_y()
void vec3d::scale_y |
( |
double |
scale | ) |
|
Scale the Y coordinate of the vec3d
- Parameters
-
[in] | scale | Scaling factor for the Y value |
◆ scale_z()
void vec3d::scale_z |
( |
double |
scale | ) |
|
Scale the Z coordinate of the vec3d
- Parameters
-
[in] | scale | Scaling factor for the Z value |
◆ set_x()
vec3d& vec3d::set_x |
( |
double |
x | ) |
|
Set the X coordinate (index 0) of the vec3d
- Parameters
-
- Returns
- Updated vec3d
◆ set_xyz()
vec3d& vec3d::set_xyz |
( |
double |
x, |
|
|
double |
y, |
|
|
double |
z |
|
) |
| |
Set all three elements of the vec3d vector
- Parameters
-
[in] | x | New X value |
[in] | y | New Y value |
[in] | z | New Z value |
- Returns
- Updated vec3d
◆ set_y()
vec3d& vec3d::set_y |
( |
double |
y | ) |
|
Set the Y coordinate (index 1) of the vec3d
- Parameters
-
- Returns
- Updated vec3d
◆ set_z()
vec3d& vec3d::set_z |
( |
double |
z | ) |
|
Set the z coordinate (index 2) of the vec3d
- Parameters
-
[in] | z | in double new z value |
- Returns
- vec3d result
◆ x()
double vec3d::x |
( |
| ) |
const |
Get the X coordinate (index 0) of the vec3d
Print(
"a.x() = ",
false );
Print(
"a[0]= ",
false );
- Returns
- X value
◆ y()
double vec3d::y |
( |
| ) |
const |
Get the Y coordinate (index 1) of the vec3d
Print(
"a.y() = ",
false );
Print(
"a[1]= ",
false );
- Returns
- Y value
◆ z()
double vec3d::z |
( |
| ) |
const |
Get the Z coordinate (index 2) of the vec3d
Print(
"a.z() = ",
false );
Print(
"a[2]= ",
false );
- Returns
- Z value
The documentation for this class was generated from the following file: