Kaim::Box2LL Class Reference
#include <box2ll.h>
Each instance of this class also maintains a count of the number of elements (or grid cells) contained by the box along its X and Y axes, accessible through the CountX() and CountY() methods.
For coordinate boxes, all coordinates along the edge of the box are counted, including the corners. For grid boxes, all grid cells that are contained within the box are counted.
Creates a new Box2LL with invalid extents: you must call Set() before using it.
Kaim::Box2LL::Box2LL |
( |
const Vec2LL & |
min_, |
|
|
const Vec2LL & |
max_ |
|
) |
| |
|
inline |
Creates a new Box2LL with the provided extents.
- Parameters
-
min_ | The minima of the bounding box. |
max_ | The maxima of the bounding box. |
Creates a new Box2LL with the provided extents.
- Parameters
-
min_x | The minimum position of the bounding box on the X axis. |
min_y | The minimum position of the bounding box on the Y axis. |
max_x | The maximum position of the bounding box on the X axis. |
max_y | The maximum position of the bounding box on the Y axis. |
void Kaim::Box2LL::Clear |
( |
| ) |
|
|
inline |
Clears all information maintained by this object.
This method sets the extents of the box to invalid values; you must follow this method with a call to Set() before you can use the box.
Vec2LL Kaim::Box2LL::CornerNorthEast |
( |
| ) |
const |
|
inline |
Retrieves the coordinates of the North-East corner of the bounding box.
Since North is considered to be the positive direction of the Y axis and East is considered to be the positive direction of the Y axis, this corner is equivalent to the maxima.
Vec2LL Kaim::Box2LL::CornerNorthWest |
( |
| ) |
const |
|
inline |
Retrieves the coordinates of the North-West corner of the bounding box.
Since North is considered to be the positive direction of the Y axis and East is considered to be the positive direction of the Y axis, this corner has the maximum value on the Y axis and the minimum value on the X axis.
Vec2LL Kaim::Box2LL::CornerSouthEast |
( |
| ) |
const |
|
inline |
Retrieves the coordinates of the South-East corner of the bounding box.
Since North is considered to be the positive direction of the Y axis and East is considered to be the positive direction of the Y axis, this corner has the minimum value on the Y axis and the maximum value on the X axis.
Vec2LL Kaim::Box2LL::CornerSouthWest |
( |
| ) |
const |
|
inline |
Retrieves the coordinates of the South-West corner of the bounding box.
Since North is considered to be the positive direction of the Y axis and East is considered to be the positive direction of the Y axis, this corner is equivalent to the minima.
void Kaim::Box2LL::Enlarge |
( |
KyInt64 |
enlargement | ) |
|
|
inline |
Enlarges the extents of the bounding box by the specified amount in all directions.
void Kaim::Box2LL::ExpandByBox2 |
( |
const Box2LL & |
box | ) |
|
|
inline |
Enlarges the extents of the bounding box to include the area covered by the specified bounding box.
If the bounding box already encompasses the area of box, the bounding box is not modified.
void Kaim::Box2LL::ExpandByVec2 |
( |
const Vec2LL & |
pos | ) |
|
|
inline |
Enlarges the extents of the bounding box to include the specified two-dimensional point.
If the point is already contained within the bounding box, the box is not modified.
void Kaim::Box2LL::GetEnlarged |
( |
KyInt64 |
enlargement, |
|
|
Box2LL & |
enlarged |
|
) |
| const |
|
inline |
Enlarges the extents of the bounding box by the specified amount in all directions, and stores the new dimensions in the enlarged parameter.
- Parameters
-
| enlargement | The amount to enlarge the box in each direction. |
[out] | enlarged | Stores the enlarged bounding box. |
bool Kaim::Box2LL::IntersectWith |
( |
const Box2LL & |
box | ) |
|
|
inline |
Resizes this bounding box to contain only the grid cells that are common to both it and box.
This has the following results:
- If box is entirely contained within this bounding box, this bounding box is resized to match the extents of box.
- If the edges of this bounding box cross the edges of box, the extents of this bounding box are resized to include only the area common to both bounding boxes.
- If this bounding box is entirely contained within the extents of box, this bounding box is not altered.
- If this bounding box does not intersect box at all, the extents of this bounding box are set to invalid values and this method returns false.
- Returns
- true if the boxes intersect, or false if they do not. If this method returns false, the extents of this bounding box will be set to invalid values. You must call Set() before you can use the box again.
bool Kaim::Box2LL::IsInside |
( |
const Vec2LL & |
pos | ) |
const |
|
inline |
Returns true if the specified position is contained within the extents of the bounding box or if the specified position is located on the edge of the bounding box.
bool Kaim::Box2LL::IsInsideStrictly |
( |
const Vec2LL & |
pos | ) |
const |
|
inline |
Returns true if the specified position is contained entirely within the extents of the bounding box.
bool Kaim::Box2LL::IsValid |
( |
| ) |
|
|
inline |
Indicates whether or not the extents of the bounding box are valid.
void Kaim::Box2LL::MakeZero |
( |
| ) |
|
|
inline |
Sets both the minima and maxima of the bounding box to (0,0).
const Vec2LL& Kaim::Box2LL::Max |
( |
| ) |
const |
|
inline |
Retrieves the maxima of the bounding box.
const Vec2LL& Kaim::Box2LL::Min |
( |
| ) |
const |
|
inline |
Retrieves the minima of the bounding box.
Multiplies both the minima and maxima of the box by the specified value.
Adds the specified two-dimensional vector to both the minima and maxima of the box.
Subtracts the specified two-dimensional vector from both the minima and maxima of the box.
Divides both the minima and maxima of the box by the specified value.
bool Kaim::Box2LL::operator== |
( |
const Box2LL & |
other | ) |
const |
|
inline |
void Kaim::Box2LL::Set |
( |
const Vec2LL & |
min_, |
|
|
const Vec2LL & |
max_ |
|
) |
| |
|
inline |
Sets the extents of the bounding box to the specified values.
- Parameters
-
min_ | The minima of the bounding box. |
max_ | The maxima of the bounding box. |
bool Kaim::Box2LL::SetAsIntersection |
( |
const Box2LL & |
box_1, |
|
|
const Box2LL & |
box_2 |
|
) |
| |
|
inline |
Resizes this bounding box to contain only the grid cells that are common to both box_1 and box_2.
This has the following results:
- If one box is entirely contained within the other, this bounding box is set to match the extents of the smaller box.
- If the edges of the two boxes cross, the extents of this bounding box are resized to include only the area common to both box_1 and box_2.
- Ifbox_1 and box_2 do not intersect at all, the extents of this bounding box are set to invalid values and this method returns false.
- Returns
- true ifbox_1 and box_2 intersect, or false if they do not. If this method returns false, the extents of this bounding box will be set to invalid values. You must call Set() before you can use the box again.
void Kaim::Box2LL::SetMax |
( |
const Vec2LL & |
max_ | ) |
|
|
inline |
Sets the maxima of the bounding box to the specified coordinates.
void Kaim::Box2LL::SetMin |
( |
const Vec2LL & |
min_ | ) |
|
|
inline |
Sets the minima of the bounding box to the specified coordinates.
The documentation for this class was generated from the following file: