![]()  | 
  
    libgpac
    
   Documentation of the core library of GPAC 
   | 
  
import <evg.idl;
 Collaboration diagram for Matrix:Public Member Functions | |
| Matrix | copy (Matrix from) | 
| boolean | equal (Matrix other) | 
| Matrix | translate (float x, float y, float z) | 
| Matrix | translate (Vec3f v) | 
| Matrix | scale (float x, float y, float z) | 
| Matrix | scale (Vec3f v) | 
| Matrix | rotate (float x, float y, float z, float angle) | 
| Matrix | rotate (Vec4f v) | 
| Matrix | add (Matrix mul, optional boolean do_4x4=false) | 
| Matrix | inverse (optional boolean do_4x4=false) | 
| Matrix | transpose () | 
| Matrix | ortho (float left, float right, float bottom, float top, float z_near, float z_far) | 
| Matrix | perspective (float fov, float aspect_ratio, float z_near, float z_far) | 
| Matrix | lookat (Vec3f position, Vec3f target, Vec3f up_vector) | 
| Rectf | apply (Rectf rc) | 
| Vec4f | apply (Vec4f v) | 
| Vec3f | apply (Vec3f v) | 
Data Fields | |
| attribute boolean | identity | 
| attribute const boolean | is3D = true | 
| attribute Array< float > | m | 
| attribute readonly float | yaw | 
| attribute readonly float | pitch | 
| attribute readonly float | roll | 
| attribute readonly Vec3f | dec_translate | 
| attribute readonly Vec3f | dec_scale | 
| attribute readonly Vec4f | dec_rotate | 
| attribute readonly Vec3f | dec_shear | 
Matrix 4x4 object.
The Matrix object can be imported using:
Most transformation values return the matrix object so that transformations can be chained:
All objects (Vec3f, Vec4f, Rectf) used in the API do not use constructors, their type is inferred if the expected attributes (eg x y, ...) are present in the object
copies matrix
| from | matrix to copy coefficient from | 
| boolean Matrix::equal | ( | Matrix | other | ) | 
check matrices are equal
| other | matrix to compare with | 
| Matrix Matrix::translate | ( | float | x, | 
| float | y, | ||
| float | z | ||
| ) | 
translate a matrix
| x | X translation value | 
| y | Y translation value | 
| z | Z translation value | 
translate a matrix
| v | translation vector | 
| Matrix Matrix::scale | ( | float | x, | 
| float | y, | ||
| float | z | ||
| ) | 
scale a matrix
| x | X scale value | 
| y | Y scale value | 
| z | Z scale value | 
| Matrix Matrix::rotate | ( | float | x, | 
| float | y, | ||
| float | z, | ||
| float | angle | ||
| ) | 
rotate a matrix
| x | X value of rotation axis vector | 
| y | Y value of rotation axis vector | 
| z | Z value of rotation axis vector | 
| angle | rotation angle in radians | 
scale a matrix
| v | rotation vector+angle | 
multiplies with another matrix (mx = mx * mul)
| mul | the matrix | 
| do_4x4 | if true, performs full multiplication on each row/col, otherwise handles last row as 0 0 0 1 | 
inverse the matrix
| do_4x4 | if true, performs full inversion on each row/col, otherwise handles last row as 0 0 0 1 | 
| Matrix Matrix::transpose | ( | ) | 
transposes the matrix
| Matrix Matrix::ortho | ( | float | left, | 
| float | right, | ||
| float | bottom, | ||
| float | top, | ||
| float | z_near, | ||
| float | z_far | ||
| ) | 
Loads an orthogonal projection matrix
| left | min horizontal coordinate of viewport | 
| right | max horizontal coordinate of viewport | 
| bottom | min vertical coordinate of viewport | 
| top | max vertical coordinate of viewport | 
| z_near | min depth coordinate of viewport | 
| z_far | max depth coordinate of viewport | 
| Matrix Matrix::perspective | ( | float | fov, | 
| float | aspect_ratio, | ||
| float | z_near, | ||
| float | z_far | ||
| ) | 
loads a perspective projection matrix
| fov | camera field of view angle in radian | 
| aspect_ratio | viewport aspect ratio | 
| z_near | min depth coordinate of viewport | 
| z_far | max depth coordinate of viewport | 
loads a lookat matrix
| position | position | 
| target | look direction | 
| up_vector | vector describing the up direction | 
transforms a rectangle
| rc | the rectangle to transform | 
transforms a 4D vector
| v | the 4D vector to transform | 
transforms a 3D vector
| v | the 3D vector to transform | 
| attribute boolean Matrix::identity | 
indicates if matrix is identity. If set to true, resets matrix
| attribute const boolean Matrix::is3D = true | 
indicates matrix is a 3D matrix
| attribute Array<float> Matrix::m | 
float buffer of coefficients (typically use matrix.m to pass matrices uniforms)
| attribute readonly float Matrix::yaw | 
yaw value of matrix
| attribute readonly float Matrix::pitch | 
pitch value of matrix
| attribute readonly float Matrix::roll | 
roll value of matrix
| attribute readonly Vec3f Matrix::dec_translate | 
translation value of decomposed matrix
| attribute readonly Vec3f Matrix::dec_scale | 
scale value of decomposed matrix
| attribute readonly Vec4f Matrix::dec_rotate | 
rotation value of decomposed matrix
| attribute readonly Vec3f Matrix::dec_shear | 
shear value of decomposed matrix