Berserk
Static Public Member Functions | List of all members
MathUtils3d Class Reference

3d space math utils More...

#include <MathUtils3d.hpp>

Static Public Member Functions

static TVecN< float, 3 > Multiply (const Mat4x4f &m, const TVecN< float, 3 > &v)
 
static Mat4x4f IdentityMatrix ()
 Identity matrix e. More...
 
static void SetScale (Mat4x4f &m, const Vec3f &scale)
 Set scale elements. More...
 
static Mat4x4f Scale (const Vec3f &scale)
 
static void SetTranslation (Mat4x4f &m, const Vec3f &t)
 Set translation column of matrix m to vec t. More...
 
static Mat4x4f Translate (const Vec3f &t)
 Translation in the direction of vec t. More...
 
static Mat4x4f RotateX (float angleRad)
 Clockwise around axis rotation. More...
 
static Mat4x4f RotateY (float angleRad)
 Clockwise around axis rotation. More...
 
static Mat4x4f RotateZ (float angleRad)
 Clockwise around axis rotation. More...
 
static Mat4x4f Rotate (const Vec3f &axis, float angleRad)
 Clockwise rotation around an arbitrary axis. More...
 
static Mat4x4f LookAt (const Vec3f &eye, const Vec3f &direction, const Vec3f &up)
 Look at view matrix for camera (in OpenGL style) More...
 
static Mat4x4f Perspective (float fov, float aspect, float near, float far)
 Perspective projection. More...
 
static Mat4x4f Orthographic (float left, float right, float bottom, float top, float near, float far)
 Orthographic projection. More...
 

Detailed Description

3d space math utils

Member Function Documentation

◆ IdentityMatrix()

static Mat4x4f MathUtils3d::IdentityMatrix ( )
inlinestatic

Identity matrix e.

◆ LookAt()

static Mat4x4f MathUtils3d::LookAt ( const Vec3f eye,
const Vec3f direction,
const Vec3f up 
)
inlinestatic

Look at view matrix for camera (in OpenGL style)

 | y
 |
 |_____ x
/

/ /z

Note
Final are is located in the negative z space
Parameters
eyeCurrent viewer position
directionDirection vector of viewing
upUp vector to define orientation
Returns
Look matrix to transform world position to the View space

◆ Multiply()

static TVecN<float, 3> MathUtils3d::Multiply ( const Mat4x4f m,
const TVecN< float, 3 > &  v 
)
inlinestatic

◆ Orthographic()

static Mat4x4f MathUtils3d::Orthographic ( float  left,
float  right,
float  bottom,
float  top,
float  near,
float  far 
)
inlinestatic

Orthographic projection.

Perspective projection to range [-1..1]x[-1..1]x[-1..1]. Note that z axis value are in range [-1..1] (as in OpenGL).

Warning
Left < right
Bottom < top
Near < far
Returns
Orthographic matrix

◆ Perspective()

static Mat4x4f MathUtils3d::Perspective ( float  fov,
float  aspect,
float  near,
float  far 
)
inlinestatic

Perspective projection.

Perspective projection to range [-1..1]x[-1..1]x[-1..1]. Note that z axis value are in range [-1..1] (as in OpenGL).

Warning
fov should be me more than 0
aspect should be more than 0
Parameters
fovAngle between top and bottom sides in radians
aspectWidth / height ratio
nearNear clip plane
farFar clip plane
Returns
Perspective matrix

◆ Rotate()

static Mat4x4f MathUtils3d::Rotate ( const Vec3f axis,
float  angleRad 
)
inlinestatic

Clockwise rotation around an arbitrary axis.

◆ RotateX()

static Mat4x4f MathUtils3d::RotateX ( float  angleRad)
inlinestatic

Clockwise around axis rotation.

◆ RotateY()

static Mat4x4f MathUtils3d::RotateY ( float  angleRad)
inlinestatic

Clockwise around axis rotation.

◆ RotateZ()

static Mat4x4f MathUtils3d::RotateZ ( float  angleRad)
inlinestatic

Clockwise around axis rotation.

◆ Scale()

static Mat4x4f MathUtils3d::Scale ( const Vec3f scale)
inlinestatic

◆ SetScale()

static void MathUtils3d::SetScale ( Mat4x4f m,
const Vec3f scale 
)
inlinestatic

Set scale elements.

◆ SetTranslation()

static void MathUtils3d::SetTranslation ( Mat4x4f m,
const Vec3f t 
)
inlinestatic

Set translation column of matrix m to vec t.

◆ Translate()

static Mat4x4f MathUtils3d::Translate ( const Vec3f t)
inlinestatic

Translation in the direction of vec t.


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