Kaim::Box2i Class Reference
#include <box2i.h>
2d axis aligned box of 32bits integers. Very Important: CountX() returns m_max.x - m_min.x + 1.
|
| Box2i () |
| Set { {+infinite, +infinite}, {-infinite, -infinite} }. More...
|
|
| Box2i (const Vec2i &min_, const Vec2i &max_) |
|
| Box2i (KyInt32 min_x, KyInt32 min_y, KyInt32 max_x, KyInt32 max_y) |
|
bool | operator== (const Box2i &other) const |
|
bool | operator!= (const Box2i &other) const |
|
void | Clear () |
| Set { {+infinite, +infinite}, {-infinite, -infinite} }. More...
|
|
bool | IsValid () const |
|
void | MakeZero () |
| set {{0,0},{0,0}} More...
|
|
void | Set (const Vec2i &min_, const Vec2i &max_) |
|
void | Set (KyInt32 min_x, KyInt32 min_y, KyInt32 max_x, KyInt32 max_y) |
|
void | SetSafe (const Vec2i &min_, const Vec2i &max_) |
| check if values max_ - min_ does overflow More...
|
|
void | SetMin (const Vec2i &min_) |
|
void | SetMax (const Vec2i &max_) |
|
const Vec2i & | Min () const |
|
const Vec2i & | Max () const |
|
const Vec2i & | CountXY () const |
| Return { m_max.x - m_min.x + 1, m_max.y - m_min.y + 1}. More...
|
|
KyInt32 | CountX () const |
| Return m_max.x - m_min.x + 1. More...
|
|
KyInt32 | CountY () const |
| Return m_max.y - m_min.y + 1. More...
|
|
|
void | ExpandByPos (const Vec2i &pos) |
|
void | ExpandByPos (const Vec3i &pos) |
|
void | ExpandByTriangle (const Triangle3i &triangle) |
|
void | ExpandByBox (const Box2i &box) |
|
|
bool | IntersectWith (const Box2i &box) |
| Sets itself as its intersection with box, return true if itself and box do intersect. More...
|
|
bool | DoesIntersectWith (const Box2i &box) const |
|
bool | SetAsIntersection (const Box2i &box_1, const Box2i &box_2) |
| Sets itself as the intersection of box_1 and box_2, return true if box_1 and box_2 do intersect. More...
|
|
Set { {+infinite, +infinite}, {-infinite, -infinite} }.
void Kaim::Box2i::Clear |
( |
| ) |
|
|
inline |
Set { {+infinite, +infinite}, {-infinite, -infinite} }.
KyInt32 Kaim::Box2i::CountX |
( |
| ) |
const |
|
inline |
Return m_max.x - m_min.x + 1.
const Vec2i& Kaim::Box2i::CountXY |
( |
| ) |
const |
|
inline |
Return { m_max.x - m_min.x + 1, m_max.y - m_min.y + 1}.
KyInt32 Kaim::Box2i::CountY |
( |
| ) |
const |
|
inline |
Return m_max.y - m_min.y + 1.
bool Kaim::Box2i::DoesContainNeighbor |
( |
const Vec2i & |
pos, |
|
|
CardinalDir |
dir |
|
) |
| const |
|
inline |
precondition: pos is inside
KyInt32 Kaim::Box2i::GetRowMajorIndex |
( |
const Vec2i & |
pos | ) |
const |
|
inline |
Compute index of position in box, where index is incremented in a outer-loop on Y and inner-loop on X.
^Y
+---+---#########################---+--
| | # 6 | 7 | 8 | 9 | 10| 11# |
+---+---#---+---+---+---+---+---#---+--
| | # 0 | 1 | 2 | 3 | 4 | 5 # |
+---+---#########################---+--
| | | | | | | | | |
+---+---+---+---+---+---+---+---+---+-> X
KyInt32 Kaim::Box2i::GetRowMajorIndexFromLocalPos |
( |
const Vec2i & |
localPos | ) |
const |
|
inline |
Compute index of position in box, where index is incremented in a outer-loop on Y and inner-loop on X localPos is relative to m_min.
bool Kaim::Box2i::IntersectWith |
( |
const Box2i & |
box | ) |
|
|
inline |
Sets itself as its intersection with box, return true if itself and box do intersect.
void Kaim::Box2i::MakeZero |
( |
| ) |
|
|
inline |
bool Kaim::Box2i::SetAsIntersection |
( |
const Box2i & |
box_1, |
|
|
const Box2i & |
box_2 |
|
) |
| |
|
inline |
Sets itself as the intersection of box_1 and box_2, return true if box_1 and box_2 do intersect.
void Kaim::Box2i::SetSafe |
( |
const Vec2i & |
min_, |
|
|
const Vec2i & |
max_ |
|
) |
| |
|
inline |
check if values max_ - min_ does overflow
The documentation for this class was generated from the following file: