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

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

#define GLM_ENABLE_EXPERIMENTAL

#include <iostream>

#include <glm/glm.hpp>

#include <glm/gtx/string_cast.hpp>

#include <glm/gtc/constants.hpp>

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

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

glm::vec3 v, u, q2_uv, a, b, n, p, x;

float c, d, deg;

int main()

{

// Q1, DOT PRODUCT

v = glm::vec3(2.0f, -1.0f, 1.0f);

u = glm::vec3(1.0f, 1.0f, 2.0f);

d = glm::dot(v,u);

c = ( d /(glm::length(u) *glm::length(v)) );

deg = (glm::acos(c) *RAD_TO_DEG);

std::cout << "\nQ1 ANSWER : " << deg; // Q1 ANSWER

// Q2, DOT PRODUCT WITH UNIT VECTORS

v = glm::vec3(1.0f, 2.0f, -1.0f);

q2_uv = glm::normalize( glm::vec3(0.0f, 1.0f, 0.0f) ); // unit vector

b = glm::dot(v,q2_uv) *q2_uv; // get value of vector-b

a = v -b; // get value of vector-a

std::cout << "\nQ2 ANSWER, vector a : " << glm::to_string(a); // Q2 ANSWER, VECTOR A

std::cout << "\nQ2 ANSWER, vector b : " << glm::to_string(b); // Q2 ANSWER, VECTOR B

// Q3, VECTOR DECOMPOSITION

n = glm::normalize( glm::vec3(0.0f, 1.0f, 0.0f) );

p = glm::vec3(1.0f, 0.0f, 1.0f);

x = glm::vec3(-3.0f, 3.0f, 2.0f);

v = x -p; // get vector, pointing from p to x

d = glm::dot(v,n); // get shortest distance, between plane and x

std::cout << "\nQ3 ANSWER : " << d; // Q3 ANSWER

// END OF PROGRAM

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

return 0; // end program

}

# data[].attributes.body
#define GLM_ENABLE_EXPERIMENTAL

#include <iostream>

#include <glm/glm.hpp>

#include <glm/gtx/string_cast.hpp>

int main() {

glm::vec3 v(1.0f, 2.0f, -1.0f);

glm::vec3 u(0.0f, 1.0f, 0.0f);

glm::vec3 b = glm::dot(v, u) * u;

glm::vec3 a = v - b;

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

std::cout << glm::to_string(b) << 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>

int main()

{

glm::vec3 v(1.0f, 2.0f, -1.0f);

glm::vec3 u(0.0f, 1.0f, 0.0f);

float c = glm::dot(v, u);

float c2 = glm::dot(u, u);

float x = c / c2;

glm::vec3 b = x * u;

glm::vec3 a = v - b;

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

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

}

# 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()

{

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

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

glm::vec3 v(2.0f, -1.0f, 1.0f);

glm::vec3 u(1.0f, 1.0f, 2.0f);

float d = glm::dot(v, u); //내적

float c = d / (glm::length(u) * glm::length(v)); //u,v 크기 계산

float deg = glm::acos(c) * RADIANS_TO_DEGREES; //역함수 구해서 radian으로 변환

std::cout << deg << 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>

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

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

int main()

{

glm::vec3 v(1, 2, -1);

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

float d = glm::dot(v, c);

glm::vec3 b = c * d;

glm::vec3 a = v - b;

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

return 0;

}

# data[].attributes.body
#define GLM_ENABLE_EXPERIMENTAL

#define GLM_SWIZZLE

#include <iostream>

#include <glm/glm.hpp>

#include <glm/gtx/string_cast.hpp>

int main() {

glm::vec3 v(1.0f, 2.0f, -1.0f);

glm::vec3 b;

glm::vec3 c(0.0f, 1.0f, 0.0f);

b = c * glm::dot(v, c);

glm::vec3 a = v - b;

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

std::cout << "b: " << glm::to_string(b) << 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>

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

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

int main()

{

glm::vec3 v2(1, 2, -1);

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

float l = glm::dot(v2, u2);

glm::vec3 b = u2 * l;

glm::vec3 a = v2 - b;

std::cout << glm::to_string(a)<< glm::to_string(b) << 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>

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

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

int main()

{

glm::vec3 v(1, 2, -1);

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

glm::vec3 b = glm::dot(v, u) * u;

glm::vec3 a = v - b;

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

std::cout << "b: " << glm::to_string(b) << 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>

int main()

{

glm::vec3 v(1, 2, -1);

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

float l = glm::dot(v, c);

glm::vec3 b = c * l;

glm::vec3 a = v - b;

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

std::cout << "b = " << glm::to_string(b) << 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>

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::vec3 v(7, 3, -2);

glm::vec3 u(10, 4, 2);

float d = glm::dot(v, u);

std::cout << d << std::endl;

return 0;*/

//glm::vec3 v(2, -1, 1);

//glm::vec3 u(1, 1, 2);

//내적

//float a = glm::dot(v, u);

//거리 곱

//float b = glm::length(v) * glm::length(u);

//std::cout << glm::degrees(glm::acos(a / b)) /** RADIANS_TO_DEGREES*/ << std::endl;

/*glm::vec3 v1(2, 0, 0);

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

v1 = glm::normalize(v1);

u1 = glm::normalize(u1);

float d = glm::dot(v1, u1);

std::cout << d << std::endl;*/

glm::vec3 v2(1, 2, -1);

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

glm::vec3 b = c * glm::dot(v2, c);

glm::vec3 a = v2 - b;

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

}

# 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::vec3 v(1, 2, -1);

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

float l = glm::dot(v, c);

glm::vec3 b = c * l;

glm::vec3 a = v - b;

cout << "a: " << glm::to_string(a) << endl;

cout << "b: " << glm::to_string(b) << 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(){

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

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

glm::vec3 v(1.0f, 2.0f, -1.0f);

glm::vec3 c(0.0f, 1.0f, 0.0f);

float d = glm::dot(v, c);

glm::vec3 b = c * d;

glm::vec3 a = v - b;

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

//e = glm::radians(e) * glm::acos(e);

//cout << e << 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>

int main()

{

glm::vec3 v(1.0f, 2.0f, -1.0f);

glm::vec3 u(0.0f, 1.0f, 0.0f);

float d = glm::dot(v, u);

glm::vec3 b = u * d;

glm::vec3 a = v - b;

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

return 0;

}

# data[].attributes.body
#define GLM_ENABLE_EXPERIMENTAL

#define GLM_FORCE_SWIZZLE

#include <iostream>

#include <glm/glm.hpp>

#include <glm/gtx/string_cast.hpp>

#include <glm/gtc/constants.hpp>

#include <glm/gtc/matrix_transform.hpp> // glm::radians, glm::degrees

int main() {

glm::vec3 v(1, 2, -1);

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

float vu = glm::dot(v, u);

glm::vec3 b = u * vu;

glm::vec3 a = v - b;

std::cout << "vec b = " << glm::to_string(b) << std::endl;

std::cout << "vec a = " << glm::to_string(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/gtc/constants.hpp>

int main()

{

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

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

glm::vec3 v(1.0f, 2.0f, -1.0f);

glm::vec3 u(0, 1.0f, 0);

float l = glm::dot(v, u);

glm::vec3 b = u * l;

glm::vec3 a = v - b;

std::cout << "a: " << to_string(a) << std::endl;

std::cout << "b: " << to_string(b) << std::endl;

return 0;

}

# data[].attributes.body
#define GLM_ENABLE_EXPERIMENTAL

#define GLM_SWIZZLE

#include <iostream>

#include <glm/gtx/string_cast.hpp>

int main()

{

// 벡터 분할

glm::vec3 v(1, 2, -1);

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

float l = glm::dot(v, c);

glm::vec3 b = c * l;

glm::vec3 a = v - a;

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

return 0;

}

# data[].attributes.body
#define GLM_ENABLE_EXPERIMENTAL

#include <iostream>

#include <glm/glm.hpp>

#include <glm/gtx/string_cast.hpp>

int main()

{

glm::vec3 v(1, 2, -1);

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

glm::vec3 b = glm::dot(v, u) * u;

glm::vec3 a = v - b;

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

std::cout << "b: " << glm::to_string(b) << 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>

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

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

int main()

{

// v = a + b

glm::vec3 v(1, 2, -1);

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

glm::vec3 b = unit_vector_b * dot(v, unit_vector_b);

glm::vec3 a = v - b;

std::cout << glm::to_string(a) << " = a\n"

<< glm::to_string(b) << " = b" << 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>

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

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

int main()

{

glm::vec3 v(1, 2, -1);

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

glm::vec3 b = glm::dot(v, u) * u;

glm::vec3 a = v - b;

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

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

return 0;

}

# data[].attributes.body
#define GLM_ENABLE_EXPERIMENTAL

#include <iostream>

#include <glm/glm.hpp>

#include <glm/gtx/string_cast.hpp>

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

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

int main()

{

glm::vec3 v(1, 2, 1);

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

glm::vec3 l = u * glm::dot(v, u);

//b = c * (v c)

glm::vec3 b = u * l;

glm::vec3 a = v - b;

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

std::cout << glm::to_string(b) << 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>

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

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

int main() {

glm::vec3 v(1, 2, -1);

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

glm::vec3 b = u * (glm::dot(v, u));

glm::vec3 a = v - b;

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

std::cout << "b: " << glm::to_string(b) << 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>

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

const double RADIANS_TO_DEGREES = 180.0 / glm::pi<float>(); //세타는 무조건 라디안

int main()

{

glm::vec3 v(1, 2, -1);

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

glm::vec3 b = glm::dot(c, v) * c;

glm::vec3 a = v - b;

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

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

return 0;

}

# data[].attributes.body
#define GLM_ENABLE_EXPERIMENTAL

#include <iostream>

#include <glm/glm.hpp>

#include <glm/gtx/string_cast.hpp>

int main()

{

glm::vec3 v(1, 2, -1);

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

glm::vec3 b = c * glm::dot(v, c);

glm::vec3 a = v - b;

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

return 0;

}

# data[].attributes.body
#define GLM_ENABLE_EXPERIMENTAL

#include <iostream>

#include <glm/glm.hpp>

#include <glm/gtx/string_cast.hpp>

int main()

{

glm::vec3 v(1.0f, 2.0f, -1.0f);

glm::vec3 c(0.0f, 1.0f, 0.0f);

glm::vec3 b = c * glm::dot(c, v);

glm::vec3 a = v - b;

std::cout << "a = " << glm::to_string(a) << ", b = " << glm::to_string(b) << 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>

int main() {

glm::vec3 v(1, 2, -1);

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

glm::vec3 b = glm::dot(v, u) * u;

glm::vec3 a = v - b;

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

std::cout << to_string(b) << 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>

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

const double RADIANS_TO_DEGREES = 180.0 / glm::pi<float>(); //세타는 무조건 라디안

//glm::radians(), ::degrees() 위에 꺼랑 같음

int main()

{

glm::vec3 v(1, 2, -1);

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

float d = glm::dot(v, c);

glm::vec3 b = c * d;

glm::vec3 a = v - b;

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

return 0;

}

# data[].attributes.body
#define GLM_ENABLE_EXPERIMENTAL

#define GLM_SWIZZLE

#include<iostream>

#include<glm/glm.hpp>

#include<glm/gtx/string_cast.hpp>

int main() {

glm::vec3 v(1.0f, 2.0f, -1.0f);

glm::vec3 b;

glm::vec3 c(0.0f,1.0f,0.0f);

b = c * glm::dot(v, c);

glm::vec3 a = v - b;

std::cout <<"a: "<<glm::to_string(a)<<std::endl << "b: " << glm::to_string(b) << 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>

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

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

int main()

{

glm::vec3 v(1, 2, -1);

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

glm::vec3 b = glm::dot(v, u) * u;

glm::vec3 a = v - b;

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

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

return 0;

}

# data[].attributes.body
define GLM_ENABLE_EXPERIMENTAL

#define GLM_SWIZZLE

#include <glm/glm.hpp>

#include <glm/gtc/constants.hpp>

#include <glm/gtc/type_ptr.hpp>

#include <glm/gtc/matrix_transform.hpp>

#include <iostream>

int main() {

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

glm::vec3 v(2, -1, 1);

glm::vec3 u(1, 1, 2);

float d = glm::dot(v, u);

float c = d / (glm::length(v) * glm::length(u));

float deg = glm::acos(c) * RADIANS_TO_DEGREES;

std::cout << "Angle : " << deg << " degrees\n";

}

# data[].attributes.body
#define GLM_ENABLE_EXPERIMENTAL

#define GLM_SWIZZLE

#include <iostream>

#include <glm/gtx/string_cast.hpp>

int main()

{

// 라디안 구하기

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

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

glm::vec3 v(2, -1, 1);

glm::vec3 u(1, 1, 2);

float d = glm::dot(v, u); // 벡터 내적

float rad = d / (glm::length(v) * glm::length(u));

float value = glm::acos(rad) * RADIANS_TO_DEGREES;

std::cout << value << 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>

int main()

{

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

glm::vec3 a(2.0f, -1.0f, 1.0f);

glm::vec3 b(1.0f, 1.0f, 2.0f);

float c = glm::dot(a, b);

float d = c / (glm::length(a) * glm::length(b));

float e = glm::acos(d) * RADIANS_TO_DEGREES;

std::cout << e << std::endl;

return 0;

}

# data[].attributes.body
#define GLM_ENABLE_EXPERIMENTAL

#include <iostream>

#include <glm/glm.hpp>

#include <glm/gtx/string_cast.hpp>

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

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

int main()

{

glm::vec3 v(2.0f, -1.0f, 1.0f);

glm::vec3 u(1.0f, 1.0f, 2.0f);

float d = glm::dot(v, u);

float c = d / (glm::length(u) * glm::length(v));

float degree = glm::acos(c) * RADIANS_TO_DEGREES;

std::cout << degree << std::endl;

return 0;

}

# data[].attributes.body
#define GLM_ENABLE_EXPERIMENTAL

#define GLM_FORCE_SWIZZLE

#include <iostream>

#include <glm/glm.hpp>

#include <glm/gtx/string_cast.hpp>

#include <glm/gtc/constants.hpp>

int main() {

glm::vec3 v(2, -1, 1);

glm::vec3 u(1, 1, 2);

float rma = 180 / glm::pi<float>(); // 라디안을 앵글로 바꾸는 값

float d = glm::dot(v, u); // 내적 값 v*u

float s = (glm::length(u) * glm::length(v)); // 벡터 당 스칼라값 곱

float c = d / (glm::length(u) * glm::length(v)); // 코사인 값

float ag = glm::acos(c) * rma; // 최종 계산

std::cout << "Angle = " << ag << 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>

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

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

int main()

{

glm::vec3 v(2, -1, 1);

glm::vec3 u(1, 1, 2);

float d = glm::dot(v, u);

float c = d / (glm::length(u) * glm::length(v));

float deg = glm::acos(c) * RADIANS_TO_DEGREES;

std::cout << deg << 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>

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

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

int main()

{

glm::vec3 v(2, -1, 1);

glm::vec3 u(1, 1, 2);

float d = glm::dot(v, u);

float c = d / (glm::length(u) * glm::length(v));

float res = glm::acos(c) * RADIANS_TO_DEGREES;

std::cout << res;

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>

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

const double RADIANS_TO_DEGREES = 180.0 / glm::pi<float>(); //세타는 무조건 라디안

int main()

{

glm::vec3 v(2, -1, 1);

glm::vec3 u(1, 1, 2);

float d = glm::dot(v, u); //벡터 내적

float c = d / (glm::length(u) * glm::length(v));

float res = glm::acos(c) * RADIANS_TO_DEGREES;

std::cout<<res;

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()

{

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

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

glm::vec3 v(2, -1, 1);

glm::vec3 u(1, 1, 2);

float d = glm::dot(v, u);

float c = d / (glm::length(u) * glm::length(v));

float deg = glm::acos(c) * RADIANS_TO_DEGREES;

std::cout << std::to_string(deg) << 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>

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

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

int main()

{

glm::vec3 v(2, -1, 1);

glm::vec3 u(1, 1, 2);

float d = glm::dot(v, u);

float c = d / (glm::length(u) * glm::length(v));

float deg = glm::acos(c) * RADIANS_TO_DEGREES;

std::cout << deg << std::endl;

return 0;

}

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

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

#define GLM_ENABLE_EXPERIMENTAL

#include <iostream>

#include <glm/glm.hpp>

#include <glm/gtx/string_cast.hpp>

#include <glm/gtc/constants.hpp>

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

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

glm::vec3 v, u;

float c, d, deg;

int main()

{

// DOT PRODUCT

v = glm::vec3(2.0f, -1.0f, 1.0f);

u = glm::vec3(1.0f, 1.0f, 2.0f);

d = glm::dot(v,u);

c = ( d /(glm::length(u) *glm::length(v)) );

deg = (glm::acos(c) *RAD_TO_DEG);

std::cout << "\nDOT PRODUCT ANSWER : " << deg; // print the answer

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

return 0; // end program

}

# data[].attributes.body
#define GLM_ENABLE_EXPERIMENTAL

#include <iostream>

#include <glm/glm.hpp>

#include <glm/gtx/string_cast.hpp>

int main()

{

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

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

glm::vec3 v(2.0f, -1.0f, 1.0f);

glm::vec3 u(1.0f, 1.0f, 2.0f);

float d = glm::dot(v, u);

float c = d / (glm::length(u) * glm::length(v));

float deg = glm::acos(c) * RADIANS_TO_DEGREES;

std::cout << " " << deg << 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>

int main()

{

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

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

glm::vec3 v(2.0f, -1.0f, 1.0f);

glm::vec3 u(1.0f, 1.0f, 2.0f);

float d = glm::dot(v, u);

float c = d / (glm::length(u) * glm::length(v));

float deg = glm::acos(c) * RADIANS_TO_DEGREES;

std::cout << deg << std::endl;

return 0;

}

# data[].attributes.body
#define GLM_ENABLE_EXPERIMENTAL

#include <iostream>

#include <glm/glm.hpp>

#include <glm/gtx/string_cast.hpp>

int main()

{

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

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

glm::vec3 v(2.0f, -1.0f, 1.0f);

glm::vec3 u(1.0f, 1.0f, 2.0f);

float d = glm::dot(v, u);

float c = d / (glm::length(u) * glm::length(v));

float deg = glm::acos(c) * RADIANS_TO_DEGREE;

std::cout << deg << 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>

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

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

int main()

{

/*glm::vec3 v(7, 3, -2);

glm::vec3 u(10, 4, 2);

float d = glm::dot(v, u);

std::cout << d << std::endl;

return 0;*/

glm::vec3 v(2, -1, 1);

glm::vec3 u(1, 1, 2);

//내적

float a = glm::dot(v, u);

//거리 곱

float b = glm::length(v) * glm::length(u);

std::cout << glm::acos(a/b) * RADIANS_TO_DEGREES << std::endl;

}

# 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() {

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

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

glm::vec3 v(2, -1, 1);

glm::vec3 u(1, 1, 2);

float d = glm::dot(v, u);

cout << "Dot: " << d << endl;

float c = d / (glm::length(u) * glm::length(v));

cout << "Cosine: " << c << endl;

float deg = glm::acos(c) * RADIANS_TO_DEGREES;

cout << "Degrees: " << deg << 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>

int main() {

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

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

glm::vec3 v(2, -1, 1);

glm::vec3 u(1, 1, 2);

float a = glm::dot(v, u); //벡터 v, c 내적

float b = glm::length(v) * glm::length(u); //벡터 v, c 크기 곱

float r = a / b; //코사인 값 구하기

float angle = acos(r) * RADIANS_TO_DEGREES; //코사인 값을 각도로 변환

std::cout << "cos(v,u) = " << angle << std::endl;

return 0;

}

# data[].attributes.body
#define GLM_ENABLE_EXPERIMENTAL

#define GLM_SWIZZLE

#include <iostream>

#include <glm/glm.hpp>

#include <glm/gtc/constants.hpp>

int main()

{

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

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

glm::vec3 v(2.0f, -1.0f, 1.0f);

glm::vec3 u(1.0f, 1.0f, 2.0f);

float d = glm::dot(v, u);

float c = d / (glm::length(u) * glm::length(v));

float deg = glm::acos(c) * RADIANS_TO_DEGREES;

std::cout << deg << 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(){

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

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

glm::vec3 v(2, -1, 1);

glm::vec3 u(1, 1, 2);

float d = glm::dot(v, u);

float c = glm::length(v) * glm::length(u);

float e = d / c;

e = glm::acos(e) * RADIANS_TO_DEGREES;

cout << e << endl;

return 0;

}

# data[].attributes.body
#define GLM_ENABLE_EXPERIMENTAL

#include <glm/glm.hpp>

#include <glm/gtx/string_cast.hpp>

#include <glm/gtc/constants.hpp>

#include <iostream>

int main() {

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

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

glm::vec3 v(2, -1, 1);

glm::vec3 u(1, 1, 2);

float d = glm::dot(v, u);

float c = d / (glm::length(u) * glm::length(v));

float deg = glm::acos(c) * RADIANS_TO_DEGREES;

std::cout << deg << std::endl;

return 0;

}

# data[].attributes.body
#define GLM_ENABLE_EXPERIMENTAL

#include <iostream>

#include <glm/glm.hpp>

#include <glm/gtc/constants.hpp>

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

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

int main()

{

glm::vec3 v(2, -1, 1);

glm::vec3 u(1, 1, 2);

float rad = glm::acos(glm::dot(v, u) / (glm::length(u)*glm::length(v)));

std::cout << rad * RADIANS_TO_DEGREES << std::endl;

return 0;

}

# data[].attributes.body
#define GLM_ENABLE_EXPERIMENTAL

#include <iostream>

#include <glm/glm.hpp>

#include <glm/gtx/string_cast.hpp>

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

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

int main() {

glm::vec3 v(2, -1, 1);

glm::vec3 u(1, 1, 2);

float a = glm::dot(v, u);

float b = a / (glm::length(u) * glm::length(v));

float angle = glm::acos(b) * RADIANS_TO_DEGREES;

std::cout << angle << 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>

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

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

int main() {

glm::vec3 v(2.0f, -1.0f, 1.0f);

glm::vec3 u(1.0f, 1.0f, 2.0f);

float d = glm::dot(v, u);

float e = d / (glm::length(u) * glm::length(v));

float deg = glm::acos(e) * RADIANS_TO_DEGREES;

std::cout << deg << 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>

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

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

int main()

{

glm::vec3 v(2, -1, 1);

glm::vec3 u(1, 1, 2);

float d = glm::dot(v, u);

float c = d / (glm::length(u) * glm::length(v));

float deg = glm::acos(c) * RADIANS_TO_DEGREES;

std::cout << deg << std::endl;

return 0;

}

# data[].attributes.body
//Q1

#define GLM_ENABLE_EXPERIMENTAL

#include <iostream>

#include <glm/glm.hpp>

#include <glm/gtx/string_cast.hpp>

#include <glm/gtc/constants.hpp>

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

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

int main()

{

glm::vec3 v(2, -1, 1);

glm::vec3 u(1, 1, 2);

//내적

float d = glm::dot(v, u);

//코사인세타

float c = d / (glm::length(u) * glm::length(v));

//세타

float deg = glm::acos(c) * RADIANS_TO_DEGREES;

std::cout << deg;

return 0;

}

//Q2

#include <iostream>

#include <glm/glm.hpp>

#include <glm/gtx/string_cast.hpp>

#include <glm/gtc/constants.hpp>

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

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

int main()

{

glm::vec3 v(1, 2, -1);

glm::vec3 a;

glm::vec3 b;

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

a = v - b;

b = c (v c);

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

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

retrun 0;

}

# data[].attributes.body
#define GLM_ENABLE_EXPERIMENTAL

#define GLM_SWIZZLE

#include <iostream>

#include <glm/glm.hpp>

#include <glm/gtx/string_cast.hpp>

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

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

int main()

{

glm::vec3 v(2, -1, 1);

glm::vec3 u(1, 1, 2);

float up = dot(v, u);

float down = glm::length(u) * glm::length(v);

float answer = up / down;

float degree = glm::acos(answer) * RADIAN_TO_DEGREES;

std::cout << degree << 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/vec2.hpp>

#include <glm/vec3.hpp>

#include <glm/vec4.hpp>

#include <glm/mat4x4.hpp>

#include <glm/common.hpp>

#include <glm/matrix.hpp>

#include <glm/trigonometric.hpp>

#include <glm/vector_relational.hpp>

int main()

{

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

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

glm::vec3 v(2, -1, 1);

glm::vec3 u(1, 1, 2);

float d = glm::dot(v, u);

float c = d / (glm::length(u) * glm::length(v));

float deg = glm::acos(c) * RADIANS_TO_DEGREES;

std::cout << deg << 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>

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

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

int main()

{

glm::vec3 v(2, -1, 1);

glm::vec3 u(1, 1, 2);

float d = glm::dot(v, u);

float c = d / (glm::length(u) * glm::length(v));

float deg = glm::acos(c) * RADIANS_TO_DEGREES;

std::cout << deg << 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>

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

const double RADIANS_TO_DEGREES = 180.0 / glm::pi<float>(); //세타는 무조건 라디안

int main()

{

glm::vec3 v(2, -1, 1);

glm::vec3 u(1, 1, 2);

float d = glm::dot(v, u); //벡터 내적

float c = d / (glm::length(u) * glm::length(v));

float res = glm::acos(c) * RADIANS_TO_DEGREES;

std::cout<<res;

return 0;

}

# data[].attributes.body
#define GLM_ENABLE_EXPERIMENTAL

#define GLM_SWIZZLE

#include<iostream>

#include<glm/glm.hpp>

#include<glm/gtx/string_cast.hpp>

int main() {

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

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

glm::vec3 v(2.0f, -1.0f,1.0f);

glm::vec3 u(1.0f, 1.0f, 2.0f);

float deg = glm::acos(glm::dot(v, u) / (glm::length(v) glm::length(u)))RADIANS_TO_DEGREES;

std::cout <<"v, u deg: " << deg << std::endl;

return 0;

}

# data[].attributes.body
#define GLM_ENABLE_EXPERIMENTAL

#include <iostream>

#include <glm/glm.hpp>

#include <glm/gtx/string_cast.hpp>

int main()

{

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

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

glm::vec3 v(2.0f, -1.0f, 1.0f);

glm::vec3 u(1.0f, 1.0f, 2.0f);

float d = glm::dot(v, u);

float c = d / (glm::length(u) * glm::length(v));

float deg = glm::acos(c) * RADIANS_TO_DEGREES;

std::cout << "v 와 u의 각도: "<<deg << std::endl;

return 0;

}