GSDP:GAM100/CProcessing/CP Matrix Inverse()

From Inside
Jump to: navigation, search

CP_Matrix_Inverse()

Description

Creates a CP_Matrix inverse matrix from an input CP_Matrix.

Parameters

CP_Matrix_Inverse(CP_Matrix original)

  • original - (CP_Matrix) The matrix to create the inverse of.

Example

CP_Vector end_position;
void init()
{
  end_position = CP_Vector_Set(CP_System_GetWindowWidth() / 2.0f + 80.0f, CP_System_GetWindowHeight() / 2.0f + 80.0f);
}

void update()
{
  CP_Settings_Background(CP_Color_Create(255, 255, 255, 255));

  // Create transformation matrices
  CP_Matrix trans = CP_Matrix_Translate(vec2_set(CP_System_GetWindowWidth() / 2.0f, CP_System_GetWindowHeight() / 2.0f));
  CP_Matrix rotate = CP_Matrix_Rotate(5.0f);

  // Combine
  CP_Matrix transform = CP_Matrix_Multiply(trans, CP_Matrix_Multiply(rotate, CP_Matrix_Inverse(trans)));

  // Update the end point of the line
  end_position = CP_Vector_MatrixMultiply(transform, end_position);

  CP_Graphics_DrawLine(CP_System_GetWindowWidth() / 2.0f, CP_System_GetWindowHeight() / 2.0f, end_position.x, end_position.y);
}

Related

Personal tools
Namespaces

Variants
Actions
Navigation
NameSpaces:>
Tools
Dynamic:>