diff options
Diffstat (limited to 'src/hole-cut.hpp')
| -rw-r--r-- | src/hole-cut.hpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/hole-cut.hpp b/src/hole-cut.hpp new file mode 100644 index 00000000..4ec5c168 --- /dev/null +++ b/src/hole-cut.hpp @@ -0,0 +1,25 @@ +#pragma once +#include <array> +#include <mg/Vector2.h> +#include <Magnum/DimensionTraits.h> + +namespace floormat { + +template<typename T> +struct CutResult +{ + using Vec2 = VectorTypeFor<2, T>; + struct bbox { Vec2 position; Vector2ub bbox_size; }; + struct rect { Vec2 min, max; }; + + static CutResult cut(bbox input, bbox hole) requires std::is_signed_v<T>; + static CutResult cut(Vec2 r0, Vec2 r1, Vec2 h0, Vec2 h1); + static CutResult cutʹ(Vec2 r0, Vec2 r1, Vec2 h0, Vec2 h1, uint8_t s); + + uint8_t s = (uint8_t)-1, size = 0; + std::array<rect, 8> array; + + bool found() const; +}; + +} // namespace floormat |
