OpenVSPAPI  3.19.0
Public Member Functions | List of all members
vec3d Class Reference

A class for representing 3D vectors. More...

#include <openvsp_as.h>

Public Member Functions

double & operator[] (int) const
 
double x () const
 
double y () const
 
double z () const
 
vec3dset_xyz (double x, double y, double z)
 
vec3dset_x (double x)
 
vec3dset_y (double y)
 
vec3dset_z (double z)
 
void rotate_x (double cos_alpha, double sin_alpha)
 
void rotate_y (double cos_alpha, double sin_alpha)
 
void rotate_z (double cos_alpha, double sin_alpha)
 
void scale_x (double scale)
 
void scale_y (double scale)
 
void scale_z (double scale)
 
void offset_x (double offset)
 
void offset_y (double offset)
 
void offset_z (double offset)
 
void rotate_z_zero_x (double cos_alpha, double sin_alpha)
 
void rotate_z_zero_y (double cos_alpha, double sin_alpha)
 
vec3d reflect_xy ()
 
vec3d reflect_xz ()
 
vec3d reflect_yz ()
 
vec3d operator+ (const vec3d &in) const
 
vec3d operator- (const vec3d &in) const
 
vec3d operator * (double b) const
 
vec3d operator * (const vec3d &in) const
 
vec3d operator/ (double b) const
 
double mag () const
 
void normalize ()
 

Detailed Description

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 341 of file openvsp_as.h.

Member Function Documentation

◆ mag()

double vec3d::mag ( ) const

Get the magnitude of a vec3d

Returns
Magnitude

◆ normalize()

void vec3d::normalize ( )

Normalize the vec3d

◆ offset_x()

void vec3d::offset_x ( double  offset)

Offset the X coordinate of the vec3d

Parameters
[in]offsetOffset for the X value

◆ offset_y()

void vec3d::offset_y ( double  offset)

Offset the Y coordinate of the vec3d

Parameters
[in]offsetOffset for the Y value

◆ offset_z()

void vec3d::offset_z ( double  offset)

Offset the Z coordinate of the vec3d

Parameters
[in]offsetOffset 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

◆ operator *() [2/2]

vec3d vec3d::operator * ( const vec3d in) const

Multiplication operator for two vec3d objects, performed by the multiplication of each corresponding component

◆ operator+()

vec3d vec3d::operator+ ( const vec3d in) const

Addition operator for two vec3d objects, performed by the addition of each corresponding component

◆ operator-()

vec3d vec3d::operator- ( const vec3d in) const

Subtraction operator for two vec3d objects, performed by the subtraction of each corresponding component

◆ 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

◆ 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}

Parameters
[in]cos_alphaCosine of rotation angle
[in]sin_alphaSine 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}

Parameters
[in]cos_alphaCosine of rotation angle
[in]sin_alphaSine 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}

Parameters
[in]cos_alphaCosine of rotation angle
[in]sin_alphaSine 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_alphaCosine of rotation angle
[in]sin_alphaSine 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_alphaCosine of rotation angle
[in]sin_alphaSine of rotation angle

◆ scale_x()

void vec3d::scale_x ( double  scale)

Scale the X coordinate of the vec3d

Parameters
[in]scaleScaling factor for the X value

◆ scale_y()

void vec3d::scale_y ( double  scale)

Scale the Y coordinate of the vec3d

Parameters
[in]scaleScaling factor for the Y value

◆ scale_z()

void vec3d::scale_z ( double  scale)

Scale the Z coordinate of the vec3d

Parameters
[in]scaleScaling factor for the Z value

◆ set_x()

vec3d& vec3d::set_x ( double  x)

Set the X coordinate (index 0) of the vec3d

Parameters
[in]xNew X value
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]xNew X value
[in]yNew Y value
[in]zNew Z value
Returns
Updated vec3d

◆ set_y()

vec3d& vec3d::set_y ( double  y)

Set the Y coordinate (index 1) of the vec3d

Parameters
[in]yNew Y value
Returns
Updated vec3d

◆ set_z()

vec3d& vec3d::set_z ( double  z)

Set the z coordinate (index 2) of the vec3d

Parameters
[in]zin double new z value
Returns
vec3d result

◆ x()

double vec3d::x ( ) const

Get the X coordinate (index 0) of the vec3d

Returns
X value

◆ y()

double vec3d::y ( ) const

Get the Y coordinate (index 1) of the vec3d

Returns
Y value

◆ z()

double vec3d::z ( ) const

Get the Z coordinate (index 2) of the vec3d

Returns
Z value

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