GSDP:GAM100/CProcessing/CP Matrix

From Inside
< GSDP:GAM100‎ | CProcessing
Revision as of 14:40, 26 June 2020 by >J.thiel (New page: =CP_Matrix= ==Description== A '''CP_Matrix''' (3D matrix type) is a structure that can hold nine float values. This is used for linear algebra and transformation, but can be used for any p...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

CP_Matrix

Description

A CP_Matrix (3D matrix type) is a structure that can hold nine float values. This is used for linear algebra and transformation, but can be used for any purpose that requires nine float values. There are a series of operations that can be done using a 3D matrix that are also provided.

Example

void update() 
{
  // create a transform and set it to initialized values
  CP_Matrix transform = CP_Matrix_Identity();

  // make the matrix a translation transform by (100, 100)
  transform = CP_Matrix_Translate((CP_Vector) { 100, 100 });

  // create a vec2 position
  CP_Vector position;
  position.x = 100;
  position.y = 100;

  // apply that matrix to the point and store it in the position
  position = CP_Matrix_MultiplyVector(transform, position);
}

Related

Personal tools
Namespaces

Variants
Actions
Navigation
NameSpaces:>
Tools
Dynamic:>