6#include "structure/math/spk_vector2.hpp"
32 using Size = spk::Vector2UInt;
61 Extend2D(
const Vector2Int &p_anchor,
const Vector2UInt &p_size);
68 Extend2D(
const Vector2Int &p_anchor,
size_t p_width,
size_t p_height);
75 Extend2D(
int p_x,
int p_y,
const Vector2UInt &p_size);
83 Extend2D(
int p_x,
int p_y,
size_t p_width,
size_t p_height);
96 bool contains(
const Vector2Int &p_point)
const;
Extend2D & operator+=(const Extend2D &p_other)
In-place translation by another rectangle's anchor.
Definition spk_extend_2d.cpp:93
Extend2D & operator-=(const Extend2D &p_other)
In-place negative translation by another rectangle's anchor.
Definition spk_extend_2d.cpp:100
Extend2D()
Builds a zero-sized rectangle at the origin.
Definition spk_extend_2d.cpp:8
Extend2D intersect(const Extend2D &p_other) const
Computes the intersection of two rectangles.
Definition spk_extend_2d.cpp:67
Extend2D operator+(const Extend2D &p_other) const
Translates the rectangle by another rectangle's anchor.
Definition spk_extend_2d.cpp:83
Extend2D operator-(const Extend2D &p_other) const
Translates the rectangle negatively by another rectangle's anchor.
Definition spk_extend_2d.cpp:88
bool contains(const Vector2Int &p_point) const
Tests whether a point lies within the rectangle bounds.
Definition spk_extend_2d.cpp:43
Extend2D shrink(const Vector2Int &p_offset) const
Returns a rectangle shrunk by the provided offset on each side.
Definition spk_extend_2d.cpp:49
spk::Vector2Int Anchor
Position of the rectangle, expressed as its top-left corner.
Definition spk_extend_2d.hpp:28
Extend2D atOrigin() const
Returns a copy translated to the origin.
Definition spk_extend_2d.cpp:38
friend std::ostream & operator<<(std::ostream &p_stream, const Extend2D &p_extend)
Streams a rectangle to an output stream.
Definition spk_extend_2d.cpp:121
bool operator!=(const Extend2D &p_other) const
Inequality comparison between rectangles.
Definition spk_extend_2d.cpp:138
std::wstring toWstring() const
Converts the rectangle to a wide string.
Definition spk_extend_2d.cpp:114
bool operator==(const Extend2D &p_other) const
Equality comparison between rectangles.
Definition spk_extend_2d.cpp:133
std::string toString() const
Converts the rectangle to a readable string.
Definition spk_extend_2d.cpp:107
spk::Vector2UInt Size
Width and height of the rectangle.
Definition spk_extend_2d.hpp:32
int32_t value_type
Definition spk_vector2.hpp:39