feat: project skeleton, core types and math with transform tests
This commit is contained in:
1 parent
e4051bc6b5
commit
8a7e9e97f8
21 files changed
+515
-2
No files matched your search
@@ -0,0 +1,22 @@
|
||||
#pragma once
|
||||
#include <plot/core/types.hpp>
|
||||
|
||||
namespace plot {
|
||||
|
||||
/// Axis-aligned rectangle in pixels, origin at the top-left.
|
||||
struct Rect {
|
||||
f32 x = 0.0f;
|
||||
f32 y = 0.0f;
|
||||
f32 w = 0.0f;
|
||||
f32 h = 0.0f;
|
||||
|
||||
constexpr f32 right() const noexcept { return x + w; }
|
||||
constexpr f32 bottom() const noexcept { return y + h; }
|
||||
|
||||
/// Half-open containment: the right/bottom edges are outside the rect.
|
||||
constexpr bool contains(f32 px, f32 py) const noexcept {
|
||||
return px >= x && px < right() && py >= y && py < bottom();
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace plot
|
||||
Reference in new issue
Block a user