3d space math utils
More...
#include <MathUtils3d.hpp>
|
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...
|
|
◆ IdentityMatrix()
static Mat4x4f MathUtils3d::IdentityMatrix |
( |
| ) |
|
|
inlinestatic |
◆ LookAt()
Look at view matrix for camera (in OpenGL style)
| y
|
|_____ x
/
/ /z
- Note
- Final are is located in the negative z space
- Parameters
-
eye | Current viewer position |
direction | Direction vector of viewing |
up | Up 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
-
fov | Angle between top and bottom sides in radians |
aspect | Width / height ratio |
near | Near clip plane |
far | Far 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()
◆ SetScale()
static void MathUtils3d::SetScale |
( |
Mat4x4f & |
m, |
|
|
const Vec3f & |
scale |
|
) |
| |
|
inlinestatic |
◆ SetTranslation()
static void MathUtils3d::SetTranslation |
( |
Mat4x4f & |
m, |
|
|
const Vec3f & |
t |
|
) |
| |
|
inlinestatic |
Set translation column of matrix m to vec t.
◆ Translate()
Translation in the direction of vec t.
The documentation for this class was generated from the following file: