Thu, 27 Feb 2020 23:07:40 +0200
update locales
55 | 1 | #pragma once |
2 | #include "basics.h" | |
3 | ||
4 | namespace geom | |
5 | { | |
6 | struct Plane | |
7 | { | |
8 | glm::vec3 normal; | |
9 | glm::vec3 anchor; | |
10 | }; | |
11 | ||
12 | struct Line | |
13 | { | |
14 | glm::vec3 direction; | |
15 | glm::vec3 anchor; | |
16 | }; | |
17 | ||
18 | template<int N> | |
19 | struct Polygon | |
20 | { | |
21 | glm::vec3 points[N]; | |
22 | }; | |
23 | ||
24 | inline const glm::vec3 origin = {0, 0, 0}; | |
25 | inline const Plane XY = {{0, 0, 1}, origin}; | |
26 | inline const Plane XZ = {{0, 1, 0}, origin}; | |
27 | inline const Plane YZ = {{1, 0, 0}, origin}; | |
28 | using Triangle = Polygon<3>; | |
29 | ||
30 | Line lineFromPoints(const glm::vec3& point_1, const glm::vec3 point_2); | |
31 | Plane planeFromTriangle(const Triangle& triangle); | |
32 | glm::vec3 normalVector(const Triangle& triangle); | |
58
b7841cd31fb7
use glm::project instead of figuring out the conversion manually...
Teemu Piippo <teemu@hecknology.net>
parents:
55
diff
changeset
|
33 | std::optional<glm::vec3> linePlaneIntersection(const Line& line, const Plane& plane, const float epsilon = 1e-6); |
55 | 34 | } |