# data[].attributes.body
#define GLM_ENABLE_EXPERIMENTAL

#define GLM_SWIZZLE

#include <iostream>

#include <glm/glm.hpp>

#include <glm/gtx/string_cast.hpp>

#include <glm/gtc/constants.hpp>

#include <glm/mat4x4.hpp>

#include <glm/mat3x2.hpp>

#include <glm/mat3x3.hpp>

int main()

{

glm::mat3 m = { {1,1,-1}, {0,2,0}, {2,3,1} };

glm::mat3 n = { {1, 0, 0}, {0, -1, 1}, {0, 1, 2} };

glm::mat3 mn = m * n;

glm::mat3 nm = n * m;

std::cout << to_string(mn) << std::endl;

std::cout << to_string(nm) << std::endl;

return 0;

}

# data[].attributes.body
#define GLM_ENABLE_EXPERIMENTAL

#define GLM_SWIZZLE

#include <iostream>

#include <glm/glm.hpp>

#include <glm/gtx/string_cast.hpp>

#include <glm/gtc/constants.hpp>

#include <glm/mat4x4.hpp>

#include <glm/mat2x2.hpp>

#include <glm/mat3x2.hpp>

int main() {

glm::mat3 m1 = { {1,1,-1},{0,2,0},{2,3,1} };

glm::mat3 m2 = { {1,0,0},{0,-1,1},{0,1,2} };

glm::mat3 m3 = m1 * m2;

glm::mat3 m4 = m2 * m1;

std::cout << to_string(m3) << std::endl;

std::cout << to_string(m4) << std::endl;

return 0;

}

# data[].attributes.body
#define GLM_ENABLE_EXPERIMENTAL

#define GLM_SWIZZLE

#include <iostream>

#include <glm/glm.hpp>

#include <glm/gtx/string_cast.hpp>

#include <glm/gtc/constants.hpp>

#include <glm/mat3x3.hpp>

int main()

{

glm::mat3x3 a = { {1, 1, -1}, {0, 2, 0}, {2, 3, 1} };

glm::mat3x3 b = { {1, 0, 0}, {0, -1, 1}, {0, 1, 2} };

glm::mat3x3 c = a * b;

glm::mat3x3 d = b * a;

std::cout << to_string(c) << std::endl;

std::cout << to_string(d) << std::endl;

return 0;

}

# data[].attributes.body
#define GLM_ENABLE_EXPERIMENTAL

#include <iostream>

#include <glm/glm.hpp>

#include <glm/gtx/string_cast.hpp>

using namespace std;

int main()

{

glm::vec3 a1(1, 1, -1);

glm::vec3 a2(0, 2, 0);

glm::vec3 a3(2, 3, 1);

glm::vec3 b1(1, 0, 0);

glm::vec3 b2(0, -1, 1);

glm::vec3 b3(0, 1, 2);

glm::mat3 A(a1, a2, a3);

glm::mat3 B(b1, b2, b3);

glm::mat3 C = A * B;

glm::mat3 D = B * A;

cout << "A * B = :\n" << glm::to_string(C) << endl;

cout << "B * A = :\n" << glm::to_string(D) << endl;

return 0;

}

# data[].attributes.body
#define GLM_ENABLE_EXPERIMENTAL

#include <glm/gtx/dual_quaternion.hpp>

#include<iostream>

#include<glm/glm.hpp>

#include<glm/gtx/string_cast.hpp>

#include <glm/mat4x4.hpp>

#include <glm/mat2x2.hpp>

#include <glm/mat3x2.hpp>

int main()

{

glm::mat3 m1 = { { 1, 1, -1 },{0, 2, 0} , {2, 3, 1} };

glm::mat3 m2 = { {1, 0, 0} , {0, -1, 0} , {0, 1, 2} };

glm::mat3 m3 = m1 * m2;

glm::mat3 m4 = m2 * m1;

std::cout << to_string(m3) << std::endl;

std::cout << to_string(m4) << std::endl;

return 0;

}

# data[].attributes.body
#define GLM_ENABLE_EXPERIMENTAL

#define GLM_SWIZZLE

#include <iostream>

#include <glm/gtx/string_cast.hpp>

#include <glm/mat3x3.hpp>

int main()

{

glm::mat3 a = { {1,1,-1},{0,2,0},{2,3,1} };

glm::mat3 b = { {1,0,0}, {0,-1,1}, {0,1,2} };

glm::mat3 ab = a * b;

glm::mat3 ba = b * a;

std::cout << to_string(ab) << std::endl;

std::cout << to_string(ba) << std::endl;

return 0;

}

# data[].attributes.body
#define GLM_ENABLE_EXPERIMENTAL

#define GLM_SWIZZLE

#include <iostream>

#include <glm/glm.hpp>

#include <glm/gtx/string_cast.hpp>

#include <glm/gtc/constants.hpp>

#include <glm/mat3x3.hpp>

int main()

{

glm::mat3x3 a = {{1, 1, -1}, {0, 2, 0}, {2, 3, 1}};

glm::mat3x3 b = {{1, 0, 0}, {0, -1, 1}, {0, 1, 2}};

glm::mat3x3 c = a * b;

glm::mat3x3 d = b * a;

std::cout << to_string(c) << std::endl;

std::cout << to_string(d) << std::endl;

return 0;

}

# data[].attributes.body
glm::mat3 m6 = { {1,1,-1},{0,2,0},{2,3,1} };

glm::mat3 m7 = { {1,0,0},{0,-1,1},{0,1,2} };

glm::mat3 m8 = m6 * m7;

glm::mat3 m9 = m7 * m6;

for (int i = 0; i < 3; i++)std::cout << glm::to_string(m8[i]) << std::endl;

std::cout << std::endl;

for (int i = 0; i < 3; i++)std::cout << glm::to_string(m9[i]) << std::endl;

# data[].attributes.body
#define GLM_ENABLE_EXPERIMENTAL

#include <iostream>

#include <glm/glm.hpp>

#include <glm/gtx/transform.hpp>

#include <glm/gtx/matrix_transform_2d.hpp>

#include <glm/gtx/string_cast.hpp>

int main()

{

glm::mat3x3 mt1 = { {1,0,0}, {0,1,0}, {0,0,1} };

glm::mat3x3 mt2 = { {3,3,3}, {2,2,2}, {1,1,1} };

std::cout << to_string(mt1) << std::endl;

std::cout << to_string(mt2) << std::endl;

std::cout << to_string(mt1* mt2) << std::endl;

return 0;

}

# data[].attributes.body
#define GLM_ENABLE_EXPERIMENTAL

#include<iostream>

#include<glm/glm.hpp>

#include<glm/gtx/string_cast.hpp>

#include<glm/mat4x4.hpp>

#include<glm/mat2x2.hpp>

#include<glm/mat3x2.hpp>

int main() {

glm::mat3 A = { {1,1,-1}, {0,2,0}, {2,3,1} };

glm::mat3 B = { {1,0,0}, {0,-1,1}, {0,1,2} };

glm::mat3 AB = A * B;

glm::mat3 BA = B * A;

std::cout << "A * B : " << glm::to_string(AB) << std::endl;

std::cout << "B * A : " << glm::to_string(BA) << std::endl;

return 0;

}

# data[].attributes.body
#define GLM_ENABLE_EXPERIMENTAL

#define GLM_SWIZZLE

#include <iostream>

#include <glm/glm.hpp>

#include <glm/gtx/string_cast.hpp>

#include <glm/mat4x4.hpp>

#include <glm/mat2x2.hpp>

#include <glm/mat3x2.hpp>

int main()

{

glm::mat3 m1 = { {1, 1, -1},{0,2,0},{2, 3, 1} };

glm::mat3 m2 = { {1, 0, 0}, {0, -1, 1}, {0, 1, 2} };

glm::mat3 m3 = m1 * m2;

glm::mat3 m4 = m2 * m1;

std::cout << to_string(m3) << std::endl;

std::cout << to_string(m4) << std::endl;

return 0;

}

# data[].attributes.body
#define GLM_ENABLE_EXPERIMENTAL

#define GLM_SWIZZLE

#include <iostream>

#include <glm/glm.hpp>

#include <glm/gtx/string_cast.hpp>

#include <glm/gtc/constants.hpp>

#include <glm/mat4x4.hpp>

#include <glm/mat3x2.hpp>

#include <glm/mat3x3.hpp>

int main()

{

glm::mat3 m = { {1,1,-1}, {0,2,0}, {2,3,1} };

glm::mat3 n = { {1, 0, 0}, {0, -1, 1}, {0, 1, 2} };

glm::mat3 mn = m * n;

glm::mat3 nm = n * m;

std::cout << to_string(mn) << std::endl;

std::cout << to_string(nm) << std::endl;

return 0;

}

# data[].attributes.body
#define GLM_ENABLE_EXPERIMENTAL

#include <iostream>

#include <glm/glm.hpp>

#include <glm/gtx/string_cast.hpp>

#include <glm/mat4x4.hpp>

#include <glm/mat2x2.hpp>

#include <glm/mat3x2.hpp>

int main()

{

glm::mat3 m1 = { {1.0f, 1.0f, -1.0f}, {0.0f, 2.0f, 0.0f}, {2.0f, 3.0f, 1.0f} };

glm::mat3 m2 = { {1.0f, 0.0f, 0.0f}, {0.0f, -1.0f, 1.0f}, {0.0f, 1.0f, 2.0f} };

std::cout << glm::to_string(m1 * m2) << std::endl;

std::cout << glm::to_string(m2 * m1) << std::endl;

return 0;

}

# data[].attributes.body
#define GLM_ENABLE_EXPERIMENTAL

#define GLM_SWIZZLE

#include <iostream>

#include <glm/glm.hpp>

#include <glm/gtx/string_cast.hpp>

#include <glm/gtc/constants.hpp>

#include <glm/mat4x4.hpp>

#include <glm/mat2x2.hpp>

#include <glm/mat3x2.hpp>

#include <glm/mat3x3.hpp>

int main() {

glm::mat3x3 a = { {1, 1, -1}, { 0, 2, 0 }, { 2, 3, 1 } };

glm::mat3x3 b = { { 1, 0, 0 }, { 0, -1, 1 }, {0, 1, 2} };

glm::mat3x3 m1 = a * b;

glm::mat3x3 m2 = b * a;

std::cout << "a * b : \n" << glm::to_string(m1) << std::endl;

std::cout << "b * a : \n" << glm::to_string(m2) << std::endl;

return 0;

}

# data[].attributes.body
#define GLM_ENABLE_EXPERIMENTAL

#define GLM_SWIZZLE

#include<iostream>

#include<glm/glm.hpp>

#include<glm/gtx/string_cast.hpp>

#include<glm/mat4x4.hpp>

#include<glm/mat2x2.hpp>

#include<glm/mat3x2.hpp>

int main() {

glm::mat3 A = { {1,1,-1 },{0,2,0},{2,3,1} };

glm::mat3 B = { {1,0,0},{0,-1,1},{0,1,2} };

glm::mat3 AB = A * B;

glm::mat3 BA = B * A;

std::cout << "AB: " << glm::to_string(AB) << '\n' << "BA: " << glm::to_string(BA) << '\n';

return 0;

}

# data[].attributes.body
#define GLM_ENABLE_EXPERIMENTAL

#include <glm/gtx/dual_quaternion.hpp>

#include<iostream>

#include<glm/glm.hpp>

#include<glm/gtx/string_cast.hpp>

#include <glm/gtc/constants.hpp>

#include<glm/mat4x4.hpp>

#include<glm/mat2x2.hpp>

#include<glm/mat3x2.hpp>

#include<glm/mat3x3.hpp>

int main()

{

glm::mat3 m1{ {1,1,-1},{0,2,0},{2,3,1} };

glm::mat3 m2{ {1,0,0},{0,-1,1},{0,1,2} };

glm::mat3 m12 = m1 * m2;

glm::mat3 m21 = m2 * m1;

std::cout << to_string(m12) << std::endl;

std::cout << to_string(m21) << std::endl;

return 0;

}

# data[].attributes.body
glm::mat3 a = { { 1,1,-1 }, { 0,2,0 }, { 2,3,1 } };

glm::mat3 b = { { 1,0,0}, {0,-1,1}, {0,1,2} };

glm::mat2 m3 = a * b;

glm::mat2 m4 = b * a;

std::cout << "a * b = " << to_string(m3) << std::endl;

std::cout << "b * a = " << to_string(m4) << std::endl;

return 0;

# data[].attributes.body
#define GLM_ENABLE_EXPERIMENTAL

#include <iostream>

#include <glm/glm.hpp>

#include <glm/gtx/string_cast.hpp>

#include <glm/gtc/constants.hpp>

#include <glm/mat4x4.hpp>

#include <glm/mat2x2.hpp>

#include <glm/mat2x3.hpp> //개념적으론 2x3임

int main()

{

glm::mat3 m1 = { { 1,1,-1 }, { 0,2,0}, { 2,3,1 } };

glm::mat3 m2 = { {1,0,0},{0,-1,1},{0,1,2} };

std::cout <<"A*B\n" << to_string(m1 * m2) << std::endl;

std::cout <<"B*A\n" << to_string(m2 * m1) << std::endl;

}

# data[].attributes.body
#define GLM_ENABLE_EXPERIMENTAL

#define GLM_SWIZZLE

#include <iostream>

#include <glm/glm.hpp>

#include <glm/gtx/string_cast.hpp>

#include <glm/gtc/constants.hpp>

#include <glm/matrix.hpp>

const double DEGREES_TO_RADIANS = glm::pi<float>() / 180.0f; //glm::radians()

const double RADIANS_TO_DEGREES = 180.0 / glm::pi<float>(); //glm::degrees()

int main()

{

glm::mat3 a = { {1,1,-1},{0,2,0},{2,3,1} };

glm::mat3 b = { {1,0,0},{0,-1,1},{0,1,2} };

std::cout << "a*b " << glm::to_string(a b) << std::endl << "b*a " << glm::to_string(b * a) << std::endl;

return 0;

}

# data[].attributes.body
#define GLM_ENABLE_EXPERIMENTAL

#define GLM_SWIZZLE

#include <iostream>

#include <glm/glm.hpp>

#include <glm/gtx/string_cast.hpp>

#include <glm/mat4x4.hpp>

#include <glm/mat2x2.hpp>

#include <glm/mat3x2.hpp>

int main()

{

glm::mat3 m1 = { {1, 1, -1},{0,2,0},{2, 3, 1} };

glm::mat3 m2 = { {1, 0, 0}, {0, -1, 1}, {0, 1, 2} };

glm::mat3 m3 = m1 * m2;

glm::mat3 m4 = m2 * m1;

std::cout << to_string(m3) << std::endl;

std::cout << to_string(m4) << std::endl;

return 0;

}

# data[].attributes.body
#define GLM_ENABLE_EXPERIMENTAL

#define GLM_SWIZZLE

#include <iostream>

#include <glm/glm.hpp>

#include <glm/gtx/string_cast.hpp>

#include <glm/gtc/constants.hpp>

#include <glm/mat4x4.hpp>

#include <glm/mat2x2.hpp>

#include <glm/mat3x2.hpp> //개념적으로는 2x3

int main()

{

glm::mat3 m1 = { {1,1,-1},{0,2,0},{2,3,1} };

glm::mat3 m2 = { {1,0,0,},{0,-1,1}, {0,1,2} };

glm::mat3 m3 = m1 * m2;

glm::mat3 m4 = m2 * m1;

std::cout << to_string(m3) << std::endl;

std::cout << to_string(m4) << std::endl;

return 0;

}

# data[].attributes.body
#define GLM_ENABLE_EXPERIMENTAL

#include <iostream>

#include <glm/glm.hpp>

#include <glm/gtx/string_cast.hpp>

#include <glm/mat4x4.hpp>

#include <glm/mat2x2.hpp>

#include <glm/mat3x2.hpp>

int main()

{

glm::mat3 m1 = { {1, 1, -1}, {0, 2, 0}, {2, 3, 1} };

glm::mat3 m2 = { {1, 0, 0}, {0, -1, 1}, {0, 1, 2} };

std::cout << "A x B:" << glm::to_string(m1 * m2) << std::endl;

std::cout << "B x A:" << glm::to_string(m2 * m1) << std::endl;

return 0;

}

# data[].attributes.body
// main.cpp

// 5820658 전형진, 2025-09-22

#define GLM_ENABLE_EXPERIMENTAL

#include <iostream>

#include <glm/gtx/string_cast.hpp>

#include <glm/mat3x3.hpp>

glm::mat3 A, B;

int main()

{

// Q1, multiply of two matrix

A = { 1,1,-1, 0,2,0, 2,3,1 };

B = { 1,0,0, 0,-1,1, 0,1,2 };

std::cout << "\nQ1 ANSWER, A*B : " << glm::to_string(A*B); // Q1 ANSWER

std::cout << "\nQ1 ANSWER, B*A : " << glm::to_string(B*A); // Q1 ANSWER

// END OF PROGRAM

std::cout << "\n5820658 전형진 과제 끝." << std::endl;

return 0; // end program

}

# data[].attributes.body
#define GLM_ENABLE_EXPERIMENTAL

#define GLM_SWIZZLE

#include <iostream>

#include <glm/glm.hpp>

#include <glm/gtx/string_cast.hpp>

#include <glm/gtc/constants.hpp>

#include <glm/mat4x4.hpp>

#include <glm/mat2x2.hpp>

#include <glm/mat3x2.hpp>

int main() {

glm::mat3 A = { {1,1,-1},{0,2,0},{2,3,1} };

glm::mat3 B = { {1,0,0},{0,-1,1},{0,1,2 } };

glm::mat3 AB = A * B;

glm::mat3 BA = B * A;

std::cout << glm::to_string(AB) << std::endl;

std::cout << glm::to_string(BA) << std::endl;

return 0;

}

# data[].attributes.body
#define GLM_ENABLE_EXPERIMENTAL

#define GLM_SWIZZLE

#include <iostream>

#include <glm/glm.hpp>

#include <glm/gtx/string_cast.hpp>

#include <glm/gtc/constants.hpp>

#include <glm/mat4x4.hpp>

#include <glm/mat2x2.hpp>

#include <glm/mat3x2.hpp>

const double DEGREES_TO_RADIANS = glm::pi<float>() / 180.0;

const double RADIANS_TO_DEGREES = 180.0 / glm::pi<float>();

int main()

{

glm::mat3 m1 = { (1, 1, -1), (0, 2, 0), (2, 3, 1) };

glm::mat3 m2 = { (1, 0 ,0), (0, -1, 1), (0, 1, 2) };

glm::mat3 m3 = m1 * m2;

glm::mat3 m4 = m2 * m1;

std::cout << to_string(m3) << std::endl;

std::cout << to_string(m4) << std::endl;

return 0;

}

# data[].attributes.body
#define GLM_ENABLE_EXPERIMENTAL

#define GLM_SWIZZLE

#include <iostream>

#include <glm/glm.hpp>

#include <glm/gtx/string_cast.hpp>

using namespace std;

int main()

{

glm::mat3 A = { {1, 1, -1},{0, 2, 0},{2, 3, 1} };

glm::mat3 B = { {1,0,0},{0,-1,1},{0,1,2 } };

glm::mat3 AB = A * B;

glm::mat3 BA = B * A;

cout << glm::to_string(AB) << endl;

cout << glm::to_string(BA) << endl;

return 0;

}

# data[].attributes.body
#define GLM_ENABLE_EXPERIMENTAL

#include <iostream>

#include <glm/glm.hpp>

#include <glm/gtx/string_cast.hpp>

#include <glm/gtc/constants.hpp>

int main()

{

glm::vec3 v1 = { 1,1,-1};

glm::vec3 v2 = { 0,2,0};

glm::vec3 v3 = { 2,3,1 };

glm::vec3 u1 = { 1,0,0};

glm::vec3 u2 = { 0,-1,1};

glm::vec3 u3 = { 0,1,2 };

glm::mat3 a;

a[0] = v1;

a[1] = v2;

a[2] = v3;

glm::mat3 b;

b[0] = u1;

b[1] = u2;

b[2] = u3;

std::cout << glm::to_string(a*b)<<std::endl;

std::cout << glm::to_string(b*a);

return 0;

}

# data[].attributes.body
#define GLM_ENABLE_EXPERIMENTAL

#define GLM_SWIZZLE

#include <iostream>

#include <glm/mat4x4.hpp>

#include <glm/gtx/string_cast.hpp>

#include <glm/mat2x2.hpp>

int main()

{

glm::mat3 A =

{

{1, 1, -1},

{0, 2, 0},

{2, 3, 1}

};

glm::mat3 B =

{

{1, 0, 0},

{0, -1, 1},

{0, 1, 2}

};

std::cout << glm::to_string(A * B) << "\n" <<

glm::to_string(B * A) << std::endl;

return 0;

}

# data[].attributes.body
#define GLM_ENABLE_EXPERIMENTAL

#include <iostream>

#include <glm/glm.hpp>

#include <glm/gtx/string_cast.hpp>

#include <glm/mat4x4.hpp>

#include <glm/mat2x2.hpp>

#include <glm/mat3x2.hpp>

int main()

{

glm::mat3 A = { {1,1,-1}, {0,2,0}, {2,3,1} };

glm::mat3 B = { {1,0,0}, {0,-1,1}, {0,1,2} };

glm::mat3 AB = A * B;

glm::mat3 BA = B * A;

std::cout << "A*B =" << glm::to_string(AB) << std::endl;

std::cout << "B*A =" << glm::to_string(BA) << std::endl;

return 0;

}

# data[].attributes.body
#define GLM_ENABLE_EXPERIMENTAL
#define GLM_SWIZZLE
#include <iostream>
#include <glm/glm.hpp>
#include <glm/gtx/string_cast.hpp>
#include <glm/mat4x4.hpp>
#include <glm/mat2x2.hpp>
#include <glm/mat3x2.hpp>
//using namespace glm;


int main(){
    glm::mat3 m1 = { {1, 0, 2}, {1, 2, 3}, {-1, 0, 1} };
    glm::mat3 m2 = { {1, 0, 0}, {0, -1, 1}, {0, 1, 2} };
    glm::mat3 m3 = m2 * m1;
    std::cout << to_string(m3) << std::endl;
    m3 = m1 * m2;
    std::cout << to_string(m3) << std::endl;
}

# data[].attributes.body
#define GLM_ENABLE_EXPERIMENTAL

#include <iostream>

#include <glm/glm.hpp>

#include <glm/gtx/string_cast.hpp>

#include <glm/mat4x4.hpp>

#include <glm/mat2x2.hpp>

#include <glm/mat2x3.hpp>

int main()

{

glm::vec3 v1 = { 1,1,-1 };

glm::vec3 v2 = { 0,2,0 };

glm::vec3 v3 = { 2,3,1 };

glm::mat3 m;

m[0] = v1;

m[1] = v2;

m[2] = v3;

glm::vec3 v4 = { 1,0,0};

glm::vec3 v5 = { 0,-1,1 };

glm::vec3 v6 = { 0,1,2 };

glm::mat3 m2;

m2[0] = v4;

m2[1] = v5;

m2[2] = v6;

glm::mat3 z1 = m * m2;

glm::mat3 z2 = m2 * m;

std::cout << to_string(z1) << std::endl;

std::cout << to_string(z2) << std::endl;

return 0;

}

# data[].attributes.body
#define GLM_ENABLE_EXPERIMENTAL

#define GLM_SWIZZLE

#include<iostream>

#include<glm/glm.hpp>

#include<glm/gtx/string_cast.hpp>

#include<glm/mat4x4.hpp>

#include<glm/mat2x2.hpp>

#include<glm/mat3x2.hpp>

int main() {

glm::mat3 A = { {1,1,-1 },{0,2,0},{2,3,1} };

glm::mat3 B = { {1,0,0},{0,-1,1},{0,1,2} };

glm::mat3 AB = A * B;

glm::mat3 BA = B * A;

std::cout << "AB: " << glm::to_string(AB) << '\n' << "BA: " << glm::to_string(BA) << '\n';

return 0;

}

# data[].attributes.body
#define GLM_ENABLE_EXPERIMENTAL

#include <glm/gtx/dual_quaternion.hpp>

#include<iostream>

#include<glm/glm.hpp>

#include<glm/gtx/string_cast.hpp>

#include <glm/gtc/constants.hpp>

#include<glm/mat4x4.hpp>

#include<glm/mat2x2.hpp>

#include<glm/mat3x2.hpp>

#include<glm/mat3x3.hpp>

int main()

{

glm::mat3 m1 { {1,1,-1},{0,2,0},{2,3,1} };

glm::mat3 m2{ {1,0,0},{0,-1,1},{0,1,2} };

glm::mat3 m12 = m1 * m2;

glm::mat3 m21 = m2 * m1;

std::cout << to_string(m12) << std::endl;

std::cout << to_string(m21) << std::endl;

return 0;

}