12 constexpr Point() =
default;
13 constexpr Point(
float x_,
float y_) : x(x_), y(y_) {}
15 [[nodiscard]]
Point operator+(
const Point& other)
const noexcept {
16 return {x + other.x, y + other.y};
18 [[nodiscard]]
Point operator-(
const Point& other)
const noexcept {
19 return {x - other.x, y - other.y};
21 [[nodiscard]]
Point operator*(
float s)
const noexcept {
22 return {x * s, y * s};
25 [[nodiscard]]
bool operator==(
const Point& other)
const noexcept {
26 return x == other.x && y == other.y;
28 [[nodiscard]]
bool operator!=(
const Point& other)
const noexcept {
29 return !(*
this == other);
40 constexpr Rect() =
default;
41 constexpr Rect(
float x_,
float y_,
float w_,
float h_)
42 : x(x_), y(y_), w(w_), h(h_) {}
45 [[nodiscard]]
float Right() const noexcept {
return x + w; }
48 [[nodiscard]]
float Bottom() const noexcept {
return y + h; }
52 return {x + w * 0.5F, y + h * 0.5F};
56 [[nodiscard]]
bool Contains(
float px,
float py)
const noexcept {
57 return px >= x && px <=
Right() && py >= y && py <=
Bottom();
60 [[nodiscard]]
bool operator==(
const Rect& other)
const noexcept {
61 return x == other.x && y == other.y && w == other.w && h == other.h;
63 [[nodiscard]]
bool operator!=(
const Rect& other)
const noexcept {
64 return !(*
this == other);
73 constexpr Size() =
default;
74 constexpr Size(
float w_,
float h_) : w(w_), h(h_) {}
76 [[nodiscard]]
bool operator==(
const Size& other)
const noexcept {
77 return w == other.w && h == other.h;
79 [[nodiscard]]
bool operator!=(
const Size& other)
const noexcept {
80 return !(*
this == other);
2B nokta — float koordinatlar.
Definition geometry.h:8
2B dikdörtgen — sol üst köşe + genişlik/yükseklik.
Definition geometry.h:34
float Bottom() const noexcept
Dikdörtgenin alt kenarının y koordinatı.
Definition geometry.h:48
float Right() const noexcept
Dikdörtgenin sağ kenarının x koordinatı.
Definition geometry.h:45
Point Center() const noexcept
Merkez noktası.
Definition geometry.h:51
bool Contains(float px, float py) const noexcept
Verilen nokta dikdörtgen içinde mi?
Definition geometry.h:56
2B boyut — genişlik ve yükseklik.
Definition geometry.h:69