GSDP:GAM100/CProcessing/mat3 inverse()
From Inside
< GSDP:GAM100 | CProcessing
mat3_inverse()
Description
Creates a Mat3 inverse matrix from an input Mat3.
Parameters
mat3_inverse(Mat3 original)
- original - (Mat3) The matrix to create the inverse of.
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_translate(vec2_set(canvasWidth / 2.0f, canvasHeight / 2.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);
}