44 constexpr Point() noexcept :
x(0),
y(0) {}
52 constexpr Point(std::size_t x_coord, std::size_t y_coord) noexcept :
x(x_coord),
y(y_coord) {}
61 return Point{
x + offset.
x,
y + offset.y};
67 [[nodiscard]]
constexpr auto operator==(
const Point &other)
const noexcept ->
bool {
68 return x == other.x &&
y == other.y;
74 [[nodiscard]]
constexpr auto operator!=(
const Point &other)
const noexcept ->
bool {
return !(*
this == other); }
127 [[nodiscard]]
constexpr auto area() const noexcept -> std::
size_t {
return width *
height; }
132 [[nodiscard]]
constexpr auto operator==(
const Size &other)
const noexcept ->
bool {
133 return width == other.width &&
height == other.height;
139 [[nodiscard]]
constexpr auto operator!=(
const Size &other)
const noexcept ->
bool {
return !(*
this == other); }
Definition geometry.hpp:37
std::size_t y
Y coordinate (vertical position)
Definition geometry.hpp:39
constexpr auto operator!=(const Point &other) const noexcept -> bool
Inequality comparison.
Definition geometry.hpp:74
constexpr Point() noexcept
Default constructor initializes to origin (0, 0).
Definition geometry.hpp:44
constexpr auto operator==(const Point &other) const noexcept -> bool
Equality comparison.
Definition geometry.hpp:67
constexpr Point(std::size_t x_coord, std::size_t y_coord) noexcept
Construct a point at the specified coordinates.
Definition geometry.hpp:52
std::size_t x
X coordinate (horizontal position)
Definition geometry.hpp:38
constexpr auto translate(const Point &offset) const noexcept -> Point
Translate this point by an offset.
Definition geometry.hpp:60
Definition geometry.hpp:105
constexpr auto operator!=(const Size &other) const noexcept -> bool
Inequality comparison.
Definition geometry.hpp:139
constexpr auto operator==(const Size &other) const noexcept -> bool
Equality comparison.
Definition geometry.hpp:132
constexpr auto area() const noexcept -> std::size_t
Calculate the area (width × height).
Definition geometry.hpp:127
std::size_t width
Width in pixels.
Definition geometry.hpp:106
constexpr Size() noexcept
Default constructor initializes to zero size.
Definition geometry.hpp:112
std::size_t height
Height in pixels.
Definition geometry.hpp:107
constexpr Size(std::size_t w, std::size_t h) noexcept
Construct a size with the specified dimensions.
Definition geometry.hpp:120