Cuberite
A lightweight, fast and extensible game server for Minecraft
|
#include <Cuboid.h>
Public Member Functions | |
void | Assign (const cCuboid &a_SrcCuboid) |
void | Assign (Vector3i a_Point1, Vector3i a_Point2) |
cCuboid (int a_X1, int a_Y1, int a_Z1) | |
cCuboid (Vector3i a_p1, Vector3i a_p2) | |
cCuboid (void) | |
void | Clamp (const cCuboid &a_Limits) |
Clamps this cuboid, so that it doesn't reach outside of a_Limits in any direction. More... | |
void | ClampSize (Vector3i a_MaxSize) |
Clamps this cuboid's p2 so that the cuboid's size doesn't exceed the specified max size. More... | |
void | ClampX (int a_MinX, int a_MaxX) |
Clamps both X coords to the specified range. More... | |
void | ClampY (int a_MinY, int a_MaxY) |
Clamps both Y coords to the specified range. More... | |
void | ClampZ (int a_MinZ, int a_MaxZ) |
Clamps both Z coords to the specified range. More... | |
int | DifX (void) const |
int | DifY (void) const |
int | DifZ (void) const |
bool | DoesIntersect (const cCuboid &a_Other) const |
Returns true if the cuboids have at least one voxel in common. More... | |
void | Engulf (Vector3i a_Point) |
If needed, expands the cuboid so that it contains the specified point. More... | |
void | Expand (int a_SubMinX, int a_AddMaxX, int a_SubMinY, int a_AddMaxY, int a_SubMinZ, int a_AddMaxZ) |
Expands the cuboid by the specified amount in each direction. More... | |
int | GetVolume (void) const |
Returns the volume of the cuboid, in blocks. More... | |
bool | IsCompletelyInside (const cCuboid &a_Outer) const |
Returns true if this cuboid is completely inside the specified cuboid (in all 6 coords). More... | |
bool | IsInside (Vector3d v) const |
bool | IsInside (Vector3i v) const |
bool | IsSorted (void) const |
Returns true if the coords are properly sorted (lesser in p1, greater in p2) More... | |
void | Move (Vector3i a_Offset) |
Moves the cuboid by the specified offset. More... | |
bool | operator!= (const cCuboid &aOther) const |
bool | operator== (const cCuboid &aOther) const |
Checks the two cuboids for equality. More... | |
void | Sort (void) |
Public Attributes | |
Vector3i | p1 |
Vector3i | p2 |
Static Private Member Functions | |
static bool | DoIntervalsIntersect (int a_Min1, int a_Max1, int a_Min2, int a_Max2) |
Returns true if the two specified intervals have a non-empty union. More... | |
Definition at line 13 of file Cuboid.cpp.
void cCuboid::Clamp | ( | const cCuboid & | a_Limits | ) |
Clamps this cuboid, so that it doesn't reach outside of a_Limits in any direction.
Assumes both this and a_Limits are sorted.
Definition at line 124 of file Cuboid.cpp.
void cCuboid::ClampSize | ( | Vector3i | a_MaxSize | ) |
Clamps this cuboid's p2 so that the cuboid's size doesn't exceed the specified max size.
Assumes this cuboid is sorted.
Definition at line 141 of file Cuboid.cpp.
void cCuboid::ClampX | ( | int | a_MinX, |
int | a_MaxX | ||
) |
Clamps both X coords to the specified range.
Works on unsorted cuboids, too.
Definition at line 163 of file Cuboid.cpp.
void cCuboid::ClampY | ( | int | a_MinY, |
int | a_MaxY | ||
) |
Clamps both Y coords to the specified range.
Works on unsorted cuboids, too.
Definition at line 173 of file Cuboid.cpp.
void cCuboid::ClampZ | ( | int | a_MinZ, |
int | a_MaxZ | ||
) |
Clamps both Z coords to the specified range.
Works on unsorted cuboids, too.
Definition at line 183 of file Cuboid.cpp.
|
inline |
|
inlinestaticprivate |
void cCuboid::Engulf | ( | Vector3i | a_Point | ) |
If needed, expands the cuboid so that it contains the specified point.
Assumes sorted. Doesn't contract.
Definition at line 206 of file Cuboid.cpp.
void cCuboid::Expand | ( | int | a_SubMinX, |
int | a_AddMaxX, | ||
int | a_SubMinY, | ||
int | a_AddMaxY, | ||
int | a_SubMinZ, | ||
int | a_AddMaxZ | ||
) |
Expands the cuboid by the specified amount in each direction.
Works on unsorted cuboids as well. Note that this function doesn't check for underflows when using negative amounts.
Definition at line 84 of file Cuboid.cpp.
int cCuboid::GetVolume | ( | void | ) | const |
Returns the volume of the cuboid, in blocks.
Note that the volume considers both coords inclusive. Works on unsorted cuboids, too.
Definition at line 43 of file Cuboid.cpp.
bool cCuboid::IsCompletelyInside | ( | const cCuboid & | a_Outer | ) | const |
Returns true if this cuboid is completely inside the specified cuboid (in all 6 coords).
Assumes both cuboids are sorted.
Definition at line 55 of file Cuboid.cpp.
bool cCuboid::IsSorted | ( | void | ) | const |
Returns true if the coords are properly sorted (lesser in p1, greater in p2)
Definition at line 193 of file Cuboid.cpp.
void cCuboid::Move | ( | Vector3i | a_Offset | ) |
Moves the cuboid by the specified offset.
Exported in ManualBindings to support the old deprecated coord-based overload.
Definition at line 74 of file Cuboid.cpp.
|
inline |
|
inline |
void cCuboid::Sort | ( | void | ) |
Definition at line 23 of file Cuboid.cpp.