GSDP:GAM100/CProcessing/mat3 set()
From Inside
< GSDP:GAM100 | CProcessing
mat3_set()
Description
Create a Mat3 by inputting each individual value of every index of the matrix.
Parameters
mat3_set(float m00, float m01, float m02, float m10, float m11, float m12, float m20, float m21, float m22)
- mXY - (float) Each input is a matrix index in row X and column Y.
Example
Vec2 end_position;
void init()
{
end_position = vec2_set(canvasWidth / 2.0f + 80.0f, canvasHeight / 2.0f + 80.0f);
}
void update()
{
background(color(255, 255, 255, 255));
// Create transformation matrices
Mat3 trans = mat3_set(1.0f, 0, canvasWidth / 2.0f,
0, 1.0f, canvasHeight / 2.0f,
0, 0, 1.0f);
Mat3 rotate = mat3_rotate(5.0f);
// Combine
Mat3 transform = mat3_concat(trans, mat3_concat(rotate, mat3_inverse(trans)));
// Update the end point of the line
end_position = mat3_mult_vec2(transform, end_position);
line(canvasWidth / 2.0f, canvasHeight / 2.0f, end_position.x, end_position.y);
}