# 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 p1(3, 0, 0); //these are all points, not vector

glm::vec3 p2(1.5, 0.86, 0);

glm::vec3 p3(3, 0, -1);

glm::vec3 v1 = p2 - p1;

glm::vec3 v2 = p3 - p1;

glm::vec3 n = glm::normalize(glm::cross(v1, v2));

std::cout << "Normal: " << glm::to_string(n) << 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 p1(3, 0, 0);

glm::vec3 p2(1.5f, 0.86f, 0);

glm::vec3 p3(3, 0, -1);

glm::vec3 v1 = p2 - p1;

glm::vec3 v2 = p3 - p1;

glm::vec3 n = glm::normalize(glm::cross(v1, v2));

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

glm::vec3 p1(3.0f, 0.0f, 0.0f);

glm::vec3 p2(1.5f, 0.86f, 0.0f);

glm::vec3 p3(3.0f, 0.0f, -1.0f);

glm::vec3 v1 = p2 - p3;

glm::vec3 v2 = p1 - p3;

glm::vec3 n_v = glm::normalize(glm::cross(v2, v1));

std::cout << "normal vector: " << glm::to_string(n_v) << '\n';

return 0;

}

# data[].attributes.body
glm::vec3 p1(3.0f, 0.0f, 0.0f);

glm::vec3 p2(1.5f, 0.86f, 0.0f);

glm::vec3 p3(3.0f, 0.0f, -1.0f);

glm::vec3 v1 = p3 - p2;

glm::vec3 v2 = p1 - p2;

glm::vec3 normal = glm::cross(v1, v2);

normal = glm::normalize(normal);

std::cout << glm::to_string(normal) << 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 p1(3, 0, 0);

glm::vec3 p2(1.5f, 0.86f, 0);

glm::vec3 p3(3, 0, -1);

glm::vec3 v1 = p2 - p1;

glm::vec3 v2 = p3 - p1;

glm::vec3 n = glm::normalize(glm::cross(v1, v2));

std::cout << glm::to_string(n);

return 0;

}

# data[].attributes.body
glm::vec3 p1(3.0f, 0.0f, 0.0f);

glm::vec3 p2(1.5f, 0.86f, 0.0f);

glm::vec3 p3(3.0f, 0.0f, -1.0f);

glm::vec3 u = glm::normalize(glm::cross(p2 - p1, p3 - p1));

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

# data[].attributes.body
#define GLM_ENABLE_EXPERIMENTAL

#include <iostream>

#include <glm/glm.hpp>

#include <glm/gtx/string_cast.hpp>

int main()

{

glm::vec3 p1(3.0f, 0.0f, 0.0f); //these are all points, not vector

glm::vec3 p2(1.5f, 0.86f, 0.0f);

glm::vec3 p3(3.0f, 0.0f, -1.0f);

glm::vec3 v1 = p2 - p1;

glm::vec3 v2 = p3 - p1;

glm::cross(v1, v2);

glm::vec3 nv = glm::normalize(nv);

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

return 0;

}

# data[].attributes.body
// 코드의 일부만 복사 붙여넣기 하였습니다.

// Q7, NORMAL VECTOR OF TRIANGLE

p1 = glm::vec3(3.0f, 0.0f, 0.0f);

p2 = glm::vec3(1.5f, 0.86f, 0.0f);

p3 = glm::vec3(3.0f, 0.0f, -1.0f);

n = glm::normalize(glm::cross(p2-p1, p3-p1)); // get normal vector of triangle

std::cout << "\nQ7 ANSWER : " << glm::to_string(n); // Q7 ANSWER

# 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 p1(3, 0, 0);

glm::vec3 p2(1.5, 0.86, 0);

glm::vec3 p3(3, 0, -1);

glm::vec3 v1 = p2 - p1;

glm::vec3 v2 = p3 - p1;

glm::vec3 n = glm::normalize(glm::cross(v1, v2));

std::cout << "Normal: " << glm::to_string(n) << 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 p1(3, 0, 0);

glm::vec3 p2(1.5, 0.86, 0);

glm::vec3 p3(3, 0, -1);

glm::vec3 v1 = p2 - p1;

glm::vec3 v2 = p3 - p1;

glm::vec3 n = glm::normalize(glm::cross(v1, v2));

std::cout << glm::to_string(n);

return 0;

}

# data[].attributes.body
#define GLM_ENABLE_EXPERIMENTAL

#define GLM_SWIZZLE

#include <iostream>

#include <glm/gtx/string_cast.hpp>

int main()

{

glm::vec3 p1(3.0f, 0, 0);

glm::vec3 p2(1.5f, 0.86f, 0);

glm::vec3 p3(3.0f, 0, -1.0f);

glm::vec3 v1 = p2 - p1;

glm::vec3 v2 = p3 - p1;

glm::vec3 normal = glm::normalize(glm::cross(v1, v2));

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

{

glm::vec3 p1(3, 0, 0);

glm::vec3 p2(1.5, 0.86, 0);

glm::vec3 p3(3, 0, -1);

glm::vec3 v1 = p2 - p3;

glm::vec3 v2 = p1 - p3;

glm::vec3 vectical_vector = glm::cross(v1, v2);

glm::vec3 normal_vertical_vector = glm::normalize(vectical_vector);

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

return 0;

}

# data[].attributes.body
glm::vec3 p1(3.0f, 0.0f, 0.0f);

glm::vec3 p2(1.5f, 0.86f, 0.0f);

glm::vec3 p3(3.0f, 0.0f, -1.0f);

glm::vec3 v1 = p2 - p1;

glm::vec3 v2 = p3 - p1;

glm::vec3 N = glm::normalize(glm::cross(v1, v2));//axb의 normalize

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

# data[].attributes.body
#define GLM_ENABLE_EXPERIMENTAL

#include <iostream>

#include <glm/glm.hpp>

#include <glm/gtx/string_cast.hpp>

int main()

{

//외적 crossproduct(vector)

glm::vec3 p1(3.0f, 0.0f, 0.0f);

glm::vec3 p2(1.5f, 0.86f, 0.0f);

glm::vec3 p3(3.0f, 0.0f, -1.0f);

//p2->p3->p1

glm::vec3 v1 = p3 - p2;

glm::vec3 v2 = p1 - p2;

//p3->p1->p2

glm::vec3 v3 = p3 - p2;

glm::vec3 v4 = p1 - p2;

glm::vec3 n1 = glm::normalize(glm::cross(v1, v2));

glm::vec3 n2 = glm::normalize(glm::cross(v3, v4));

std::cout << "p2->p3->p1 = " << glm::to_string(n1) << std::endl;

std::cout << "p3->p1->p2 = " << glm::to_string(n2) << 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 p1(3, 0, 0);

glm::vec3 p2(1.5f, 0.86f, 0);

glm::vec3 p3(3, 0, -1);

glm::vec3 v1 = p2 - p1;

glm::vec3 v2 = p3 - p1;

glm::vec3 n = glm::normalize(glm::cross(v1, v2));

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

return 0;

}

# data[].attributes.body
int main()

{

glm::vec3 p1(3, 0, 0);

glm::vec3 p2(1.5, 0.86, 0);

glm::vec3 p3(3, 0, -1);

glm::vec3 v1 = p2 - p1;

glm::vec3 v2 = p3 - p1;

glm::vec3 v3 = glm::normalize(glm::cross(v1, v2));

std::cout << glm::to_string(v3) << 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 p1(3.0f, 0, 0); //these are all points, not vector

glm::vec3 p2(1.5f, 0.86f, 0);

glm::vec3 p3(3.0f, 0, -1.0f);

glm::vec3 v1 = p2 - p1;

glm::vec3 v2 = p3 - p1;

glm::vec3 normal = glm::normalize(glm::cross(v1, v2));

std::cout << to_string(normal) << 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 p1(3.0f, 0.0f, 0.0f);

glm::vec3 p2(1.5f, 0.86f, 0.0f);

glm::vec3 p3(3.0f, 0.0f, -1.0f);

glm::vec3 v1 = p2 - p1;

glm::vec3 v2 = p3 - p1;

glm::vec3 n = glm::normalize(glm::cross(v1, v2));

std::cout << "Normal Vector: " << glm::to_string(n) << 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() {

glm::vec3 p1(3.0f, 0.0f, 0.0f);

glm::vec3 p2(1.5f, 0.86f, 0.0f);

glm::vec3 p3(3.0f, 0.0f, -1.0f);

glm::vec3 v1 = p2 - p3;

glm::vec3 v2 = p1 - p3;

glm::vec3 n_v = glm::normalize(glm::cross(v2, v1));

std::cout << glm::to_string(n_v) << 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::vec3 p1(3.0f, 0.0f, 0.0f);

glm::vec3 p2(1.5f, 0.86f, 0.0f);

glm::vec3 p3(3.0f, 0.0f, -1.0f);

glm::vec3 v1 = p2 - p1;

glm::vec3 v2 = p3 - p1;

glm::vec3 n = glm::normalize(glm::cross(v1, v2));

cout << "normal: " << glm::to_string(n) << 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()

{

glm::vec3 p1(3, 0, 0);

glm::vec3 p2(1.5, 0.86, 0);

glm::vec3 p3(3, 0, -1);

glm::vec3 v1 = p3 - p2;

glm::vec3 v2 = p1 - p2;

glm::vec3 n = glm::normalize(glm::cross(v1, v2));

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

return 0;

}

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


int main(){

    glm::vec3 p1(3.f, 0.f, 0.f);
    glm::vec3 p2(1.5f, 0.86f, 0.f);
    glm::vec3 p3(3.f, 0.f, -1.f);

    glm::vec3 u4 = p2 - p1;
    glm::vec3 v4 = p3 - p1;

    glm::vec3 n = glm::normalize(glm::cross(u4, v4));

    std::cout << "Normal: " << glm::to_string(n) << "\n";
}

# 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 p1(3.0f, 0, 0);

glm::vec3 p2(1.5f, 0.86f, 0);

glm::vec3 p3(3.0f, 0, -1.0f);

glm::vec3 v1 = p2 - p1;

glm::vec3 v2 = p3 - p1;

glm::vec3 n = glm::normalize(glm::cross(v1, v2));

std::cout << glm::to_string(n) << 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 p1(3, 0, 0);

glm::vec3 p2(1.5, 0.86, 0);

glm::vec3 p3(3, 0, -1);

glm::vec3 v1 = p2 - p1;

glm::vec3 v2 = p3 - p1;

glm::vec3 n = glm::cross(v1, v2);

glm::vec3 normal = glm::normalize(glm::cross(v1, v2));

std::cout << "Normal vector = " << glm::to_string(normal) << 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 p1(3.0f, 0.0f, 0.0f);

glm::vec3 p2(1.5f, 0.86f, 0.0f);

glm::vec3 p3(3.0f, -0.0f, -1.0f);

glm::vec3 v1 = p3 - p2;

glm::vec3 v2 = p1 - p2;

glm::vec3 v3 = p3 - p2;

glm::vec3 v4 = p1 - p3;

glm::vec3 n1 = glm::normalize(glm::cross(v1, v2));

glm::vec3 n2 = glm::normalize(glm::cross(v3, v4));

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

cout << glm::to_string(n2) << 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 p1(3, 0, 0);

glm::vec3 p2(1.5, 0.86, 0);

glm::vec3 p3(3, 0, -1);

glm::vec3 v1 = p3 - p2;

glm::vec3 v2 = p1 - p2;

glm::vec3 c = glm::normalize(glm::cross(v1, v2));

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

glm::vec3 p1(3.0f, 0.0f, 0.0f);

glm::vec3 p2(1.5f, 0.86f, 0.0f);

glm::vec3 p3(3.0f, 0.0f, -1.0f);

glm::vec3 v1 = p2 - p3;

glm::vec3 v2 = p1 - p3;

glm::vec3 n_v = glm::normalize(glm::cross(v2, v1));

std::cout << glm::to_string(n_v) << 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 p1(3, 0, 0);

glm::vec3 p2(1.5, 0.86, 0);

glm::vec3 p3(3, 0, -1);

glm::vec3 v1 = p2 - p1;

glm::vec3 v2 = p3 - p1;

glm::vec3 n = glm::normalize(glm::cross(v1, v2));

std::cout << glm::to_string(n);

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>

#define GLM_SWIZZLE

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 p1(3, 0, 0);

glm::vec3 p2(1.5, 0.86, 0);

glm::vec3 p3(3, 0, -1);

glm::vec3 v1 = p2 - p1;

glm::vec3 v2 = p3 - p1;

glm::vec3 n = glm::normalize(glm::cross(v1, v2));

std::cout << "N_Vector: " << glm::to_string(n) << std::endl;

}

# data[].attributes.body
glm::vec3 p1(3, 0, 0);

glm::vec3 p2(1.5f, 0.86f, 0);

glm::vec3 p3(3, 0, -1);

glm::vec3 v1 = p2 - p1;

glm::vec3 v2 = p3 - p1;

glm::vec3 n = glm::normalize(glm::cross(v1, v2));

std::cout << "n:" + glm::to_string(n) << 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 p1(3, 0, 0);

glm::vec3 p2(1.5, 0.86, 0);

glm::vec3 p3(3, 0, -1);

glm::vec3 v1 = p2 - p1;

glm::vec3 v2 = p3 - p1;

glm::vec3 n = glm::normalize(glm::cross(v1, v2));

std::cout << glm::to_string(n);

return 0;

}