diff options
Diffstat (limited to 'src/rotation.cpp')
-rw-r--r-- | src/rotation.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/rotation.cpp b/src/rotation.cpp new file mode 100644 index 00000000..7c0ea021 --- /dev/null +++ b/src/rotation.cpp @@ -0,0 +1,29 @@ +#include "rotation.inl" + +namespace floormat { + +/* N 0 -32 32 16 + * E 32 0 16 32 + * S 0 32 32 16 + * W -32 0 16 32 + */ + +/* N 16 -32 32 16 + * E 32 16 16 32 + * S -16 32 32 16 + * W -32 -16 16 32 + */ + +using bbox = Pair<Vector2b, Vector2ub>; + +static_assert(rotate_bbox({ 16, -32 }, { 32, 16 }, rotation::N, rotation::E) == bbox{{ 32, 16}, {16, 32}}); +static_assert(rotate_bbox({ 16, -32 }, { 32, 16 }, rotation::N, rotation::S) == bbox{{-16, 32}, {32, 16}}); +static_assert(rotate_bbox({ 16, -32 }, { 32, 16 }, rotation::N, rotation::W) == bbox{{-32, -16}, {16, 32}}); +static_assert(rotate_bbox({ 32, 16 }, { 16, 32 }, rotation::E, rotation::S) == bbox{{-16, 32}, {32, 16}}); +static_assert(rotate_bbox({ 32, 16 }, { 16, 32 }, rotation::E, rotation::N) == bbox{{ 16, -32}, {32, 16}}); +static_assert(rotate_bbox({ -32, -16 }, { 16, 32 }, rotation::W, rotation::S) == bbox{{-16, 32}, {32, 16}}); + +static_assert(rotate_bbox({ 1, 2 }, { 3, 4 }, rotation::E, rotation::E) == bbox{{1, 2}, {3, 4}}); +static_assert(rotate_bbox({ 1, 2 }, { 3, 4 }, rotation::N, rotation::N) == bbox{{1, 2}, {3, 4}}); + +} // namespace floormat |