src/geometry.h

changeset 206
654661eab7f3
parent 201
5d201ee4a9c3
child 223
ce81db996275
equal deleted inserted replaced
205:1a4342d80de7 206:654661eab7f3
1 #pragma once 1 #pragma once
2 #include <QPolygonF> 2 #include <QPolygonF>
3 #include "basics.h" 3 #include <glm/glm.hpp>
4 #include <optional>
5
6 enum Winding
7 {
8 NoWinding,
9 Anticlockwise,
10 Clockwise,
11 };
12
13 //! \brief XOR operator for winding
14 constexpr Winding operator^(Winding one, Winding other)
15 {
16 if (one == NoWinding or other == NoWinding) {
17 return NoWinding;
18 }
19 else {
20 const int xored = static_cast<int>(one) ^ static_cast<int>(other);
21 return static_cast<Winding>(xored);
22 }
23 }
24
25 constexpr Winding& operator^=(Winding& one, Winding other)
26 {
27 one = one ^ other;
28 return one;
29 }
4 30
5 struct Plane 31 struct Plane
6 { 32 {
7 glm::vec3 normal; 33 glm::vec3 normal;
8 glm::vec3 anchor; 34 glm::vec3 anchor;

mercurial