# 3D Affine Transforms (pre)Â¶

Pre transfrom functions which are regular transfrom functions.

## Functions documentationÂ¶

void `glm_translate_to`(mat4 m, vec3 v, mat4 dest)Â¶

translate existing transform matrix by v vector and store result in dest

Parameters:
[in] m affine transfrom
[in] v translate vector [x, y, z]
[out] dest translated matrix
void `glm_translate`(mat4 m, vec3 v)Â¶

translate existing transform matrix by v vector and stores result in same matrix

Parameters:
[in, out] m affine transfrom
[in] v translate vector [x, y, z]
void `glm_translate_x`(mat4 m, float x)Â¶

translate existing transform matrix by x factor

Parameters:
[in, out] m affine transfrom
[in] v x factor
void `glm_translate_y`(mat4 m, float y)Â¶

translate existing transform matrix by y factor

Parameters:
[in, out] m affine transfrom
[in] v y factor
void `glm_translate_z`(mat4 m, float z)Â¶

translate existing transform matrix by z factor

Parameters:
[in, out] m affine transfrom
[in] v z factor
void `glm_translate_make`(mat4 m, vec3 v)Â¶

creates NEW translate transform matrix by v vector.

Parameters:
[in, out] m affine transfrom
[in] v translate vector [x, y, z]
void `glm_scale_to`(mat4 m, vec3 v, mat4 dest)Â¶

scale existing transform matrix by v vector and store result in dest

Parameters:
[in] m affine transfrom
[in] v scale vector [x, y, z]
[out] dest scaled matrix
void `glm_scale_make`(mat4 m, vec3 v)Â¶

creates NEW scale matrix by v vector

Parameters:
[out] m affine transfrom
[in] v scale vector [x, y, z]
void `glm_scale`(mat4 m, vec3 v)Â¶

scales existing transform matrix by v vector and stores result in same matrix

Parameters:
[in, out] m affine transfrom
[in] v scale vector [x, y, z]
void `glm_scale_uni`(mat4 m, float s)Â¶

applies uniform scale to existing transform matrix v = [s, s, s] and stores result in same matrix

Parameters:
[in, out] m affine transfrom
[in] v scale factor
void `glm_rotate_x`(mat4 m, float angle, mat4 dest)Â¶

rotate existing transform matrix around X axis by angle and store result in dest

Parameters:
[in] m affine transfrom
[out] dest rotated matrix
void `glm_rotate_y`(mat4 m, float angle, mat4 dest)Â¶

rotate existing transform matrix around Y axis by angle and store result in dest

Parameters:
[in] m affine transfrom
[out] dest rotated matrix
void `glm_rotate_z`(mat4 m, float angle, mat4 dest)Â¶

rotate existing transform matrix around Z axis by angle and store result in dest

Parameters:
[in] m affine transfrom
[out] dest rotated matrix
void `glm_rotate_make`(mat4 m, float angle, vec3 axis)Â¶

creates NEW rotation matrix by angle and axis, axis will be normalized so you donâ€™t need to normalize it

Parameters:
[out] m affine transfrom
[in] axis axis
void `glm_rotate`(mat4 m, float angle, vec3 axis)Â¶

rotate existing transform matrix around Z axis by angle and axis

Parameters:
[in, out] m affine transfrom
[in] axis axis
void `glm_rotate_at`(mat4 m, vec3 pivot, float angle, vec3 axis)Â¶

rotate existing transform around given axis by angle at given pivot point (rotation center)

Parameters:
[in, out] m affine transfrom
[in] pivot pivot, anchor point, rotation center
[in] axis axis
void `glm_rotate_atm`(mat4 m, vec3 pivot, float angle, vec3 axis)Â¶
creates NEW rotation matrix by angle and axis at given point
this creates rotation matrix, it assumes you donâ€™t have a matrix
this should work faster than glm_rotate_at because it reduces one glm_translate.
Parameters:
[in, out] m affine transfrom
[in] pivot pivot, anchor point, rotation center
[in] axis axis
void `glm_decompose_scalev`(mat4 m, vec3 s)Â¶

decompose scale vector

Parameters:
[in] m affine transform
[out] s scale vector (Sx, Sy, Sz)
bool `glm_uniscaled`(mat4 m)Â¶

returns true if matrix is uniform scaled. This is helpful for creating normal matrix.

Parameters:
[in] m matrix
void `glm_decompose_rs`(mat4 m, mat4 r, vec3 s)Â¶

decompose rotation matrix (mat4) and scale vector [Sx, Sy, Sz] DONâ€™T pass projected matrix here

Parameters:
[in] m affine transform
[out] r rotation matrix
[out] s scale matrix
void `glm_decompose`(mat4 m, vec4 t, mat4 r, vec3 s)Â¶

decompose affine transform, TODO: extract shear factors. DONâ€™T pass projected matrix here

Parameters:
[in] m affine transfrom
[out] t translation vector
[out] r rotation matrix (mat4)
[out] s scaling vector [X, Y, Z]
void `glm_spin`(mat4 m, float angle, vec3 axis)Â¶
rotate existing transform matrix around given axis by angle around self (doesnâ€™t affected by position)
Parameters:
[in, out] m affine transfrom