373:e34d6a30b96d | 374:75efc3ba5a56 |
---|---|
54 }; | 54 }; |
55 struct LineSegment2D | 55 struct LineSegment2D |
56 { | 56 { |
57 glm::vec2 p1, p2; | 57 glm::vec2 p1, p2; |
58 }; | 58 }; |
59 | |
60 // get polygon type from amount of points | |
61 template<int N> | |
62 struct PolygonType {}; | |
63 template<> | |
64 struct PolygonType<2> { using type = LineSegment; }; | |
65 template<> | |
66 struct PolygonType<3> { using type = Triangle; }; | |
67 template<> | |
68 struct PolygonType<4> { using type = Quadrilateral; }; | |
69 template<int N> | |
70 using Polygon = typename PolygonType<N>::type; | |
71 | 59 |
72 /** | 60 /** |
73 * @brief Computes a line from two points | 61 * @brief Computes a line from two points |
74 * @param point_1 | 62 * @param point_1 |
75 * @param point_2 | 63 * @param point_2 |
129 glm::vec3 scaling; | 117 glm::vec3 scaling; |
130 glm::mat4 unscaled; | 118 glm::mat4 unscaled; |
131 }; | 119 }; |
132 unscaled_matrix unscale_matrix(const glm::mat4& matrix); | 120 unscaled_matrix unscale_matrix(const glm::mat4& matrix); |
133 | 121 |
134 struct NPolygon | |
135 { | |
136 std::vector<glm::vec3> points; | |
137 }; | |
138 | |
139 inline constexpr bool isclose(const glm::vec3& a, const glm::vec3& b) | 122 inline constexpr bool isclose(const glm::vec3& a, const glm::vec3& b) |
140 { | 123 { |
141 return qFuzzyCompare(a.x, b.x) | 124 return qFuzzyCompare(a.x, b.x) |
142 and qFuzzyCompare(a.y, b.y) | 125 and qFuzzyCompare(a.y, b.y) |
143 and qFuzzyCompare(a.z, b.z); | 126 and qFuzzyCompare(a.z, b.z); |