OpenVSPAPI  3.20.0
Public Member Functions | List of all members
Matrix4d Class Reference

A class for representing 4x4 matricies. More...

#include <openvsp_as.h>

Public Member Functions

void loadIdentity ()
 
void translatef (const double &in x, const double &in y, const double &in z)
 
void rotateX (const double &in ang)
 
void rotateY (const double &in ang)
 
void rotateZ (const double &in ang)
 
void rotate (const double &in ang, const vec3d &in axis)
 
void scale (const double &in scale)
 
vec3d xform (const vec3d &in v)
 
vec3d getAngles ()
 
void loadXZRef ()
 
void loadXYRef ()
 
void loadYZRef ()
 
void affineInverse ()
 
void buildXForm (const vec3d &in pos, const vec3d &in rot, const vec3d &in cent_rot)
 

Detailed Description

Matrix4d is typically used to perform rotations, translations, scaling, projections, and other transformations in 3D space.

Definition at line 781 of file openvsp_as.h.

Member Function Documentation

◆ affineInverse()

void Matrix4d::affineInverse ( )

Perform an affine transform on the Matrix4d

//==== Test Matrix4d ====//
Matrix4d m(); // Default Constructor
m.loadIdentity();
m.rotateY( 10.0 );
m.rotateX( 20.0 );
m.rotateZ( 30.0 );
vec3d c = m.xform( vec3d( 1.0, 1.0, 1.0 ) );
m.affineInverse();

◆ buildXForm()

void Matrix4d::buildXForm ( const vec3d &in  pos,
const vec3d &in  rot,
const vec3d &in  cent_rot 
)

Translate the Matrix4d to a given position and rotate it a about a given center of rotation

Parameters
[in]posPosition to translate to
[in]rotAngle of rotation (degrees)
[in]cent_rotCenter of rotation

◆ getAngles()

vec3d Matrix4d::getAngles ( )

Calculate the Matrix4d's angles between the X, Y and Z axes

m.rotate( PI / 4, vec3d( 0.0, 0.0, 1.0 ) ); // Radians
vec3d angles = mat.getAngles();
Returns
Angle measurement between each axis (degrees)

◆ loadIdentity()

void Matrix4d::loadIdentity ( )

Create a 4x4 indentity matrix

//==== Test Matrix4d ====//
Matrix4d m(); // Default Constructor
m.loadIdentity();
Returns
Identity Matrix4d

◆ loadXYRef()

void Matrix4d::loadXYRef ( )

Load an identy Matrix4d and set the Z coordinate of the diagonal (index 10) to -1

//==== Test Matrix4d ====//
Matrix4d m(); // Default Constructor
m.loadXYRef();
vec3d b = m.xform( vec3d( 1, 2, 3 ) );

◆ loadXZRef()

void Matrix4d::loadXZRef ( )

Load an identy Matrix4d and set the Y coordinate of the diagonal (index 5) to -1

//==== Test Matrix4d ====//
Matrix4d m(); // Default Constructor
m.loadXZRef();
vec3d b = m.xform( vec3d( 1, 2, 3 ) );

◆ loadYZRef()

void Matrix4d::loadYZRef ( )

Load an identy Matrix4d and set the X coordinate of the diagonal (index 0) to -1

//==== Test Matrix4d ====//
Matrix4d m(); // Default Constructor
m.loadYZRef();
vec3d b = m.xform( vec3d( 1, 2, 3 ) );

◆ rotate()

void Matrix4d::rotate ( const double &in  ang,
const vec3d &in  axis 
)

Rotate the Matrix4d about an arbitrary axis

//==== Test Matrix4d ====//
Matrix4d m(); // Default Constructor
m.loadIdentity();
m.rotate( PI / 4, vec3d( 0.0, 0.0, 1.0 ) ); // Radians
Parameters
[in]angAngle of rotation (rad)
[in]axisVector to rotate about

◆ rotateX()

void Matrix4d::rotateX ( const double &in  ang)

Rotate the Matrix4d about the X axis

//==== Test Matrix4d ====//
Matrix4d m(); // Default Constructor
m.loadIdentity();
m.rotateX( 90.0 );
Parameters
[in]angAngle of rotation (degrees)

◆ rotateY()

void Matrix4d::rotateY ( const double &in  ang)

Rotate the Matrix4d about the Y axis

//==== Test Matrix4d ====//
Matrix4d m(); // Default Constructor
m.loadIdentity();
m.rotateY( 90.0 );
Parameters
[in]angAngle of rotation (degrees)

◆ rotateZ()

void Matrix4d::rotateZ ( const double &in  ang)

Rotate the Matrix4d about the Z axis

//==== Test Matrix4d ====//
Matrix4d m(); // Default Constructor
m.loadIdentity();
m.rotateZ( 90.0 );
Parameters
[in]angAngle of rotation (degrees)

◆ scale()

void Matrix4d::scale ( const double &in  scale)

Multiply the Matrix4d by a scalar value

//==== Test Matrix4d ====//
Matrix4d m(); // Default Constructor
m.loadXZRef();
m.scale( 10.0 );
Parameters
[in]scaleValue to scale by

◆ translatef()

void Matrix4d::translatef ( const double &in  x,
const double &in  y,
const double &in  z 
)

Translate the Matrix4d along the given axes values

//==== Test Matrix4d ====//
Matrix4d m(); // Default Constructor
m.loadIdentity();
m.translatef( 1.0, 0.0, 0.0 );
Parameters
[in]xTranslation along the X axis
[in]yTranslation along the Y axis
[in]zTranslation along the Z axis
Returns
Translated Matrix4d

◆ xform()

vec3d Matrix4d::xform ( const vec3d &in  v)

Transform the Matrix4d by the given vector

//==== Test Matrix4d ====//
Matrix4d m(); // Default Constructor
m.loadIdentity();
vec3d a = m.xform( vec3d( 1.0, 2.0, 3.0 ) );
Parameters
[in]vTranformation vector

The documentation for this class was generated from the following file:
Matrix4d
A class for representing 4x4 matricies.
Definition: openvsp_as.h:781
Matrix4d::getAngles
vec3d getAngles()
vec3d
A class for representing 3D vectors.
Definition: openvsp_as.h:341
Matrix4d::loadIdentity
void loadIdentity()