Please Login First
×
Create a new article
Write your page title here:
We currently have 319 articles on Inside. Type your article name above or click on one of the titles below and start writing!



    Inside

    GSDP:GAM100/CProcessing/mat3()

    mat3()

    Description

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

    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