GSDP:GAM100/CProcessing/mat3 identity()

From Inside
Jump to: navigation, search

mat3_identity()

Description

Create a Mat3 identity matrix. This is the same as the default Mat3 that you get from calling mat3().

Example

Mat3 default_m;
Mat3 identity_m;

void init()
{
  textFont(defaultFont, 30.0f);
  fill(color(0, 0, 0, 255));

  default_m = mat3();
  identity_m = mat3_identity();
}

void update()
{
  background(color(255, 255, 255, 255));

  // Print out the default matrix
  text("Default: ", 0, 30);
  char matrix[128] = {0};
  sprintf_s(matrix, 128,"[%.0f, %.0f, %.0f]\n[%.0f, %.0f, %.0f]\n[%.0f, %.0f, %.0f]",
    default_m.m00, default_m.m01, default_m.m02,
    default_m.m10, default_m.m11, default_m.m12,
    default_m.m20, default_m.m21, default_m.m22);
  textBox(matrix, 175, 30, 200);

  // Print out the identity matrix
  text("Identity: ", 0, 150);
  sprintf_s(matrix, 128, "[%.0f, %.0f, %.0f]\n[%.0f, %.0f, %.0f]\n[%.0f, %.0f, %.0f]",
    identity_m.m00, identity_m.m01, identity_m.m02,
    identity_m.m10, identity_m.m11, identity_m.m12,
    identity_m.m20, identity_m.m21, identity_m.m22);
  textBox(matrix, 175, 150, 200);

  text("They are the same!", 0, 300);
}

Related

Personal tools
Namespaces

Variants
Actions
Navigation
NameSpaces:>
Tools
Dynamic:>