A three-dimensional bounding box with 32-bit integer precision.
struct
|
Box3I
|
implements
|
IEquatable<Box3I>
|
The coordinates refer to cubes (pixel-is-area semantic).
The serialization helper object for values of Box3I.
public
static
readonly
field
|
Serializer
|
||
type
|
ITypeSerializer<Box3I>
|
An empty bounding box at the coordinate origin.
public
static
readonly
field
|
Empty
|
||
type
|
Box3I
|
An
inverse
bounding
box
that
can
be
used
as
the
initial
value
for
computing
bounds
via
subsequent
calls
to
Grow
.
public
static
readonly
field
|
Inverse
|
||
type
|
Box3I
|
The largest possible box.
public
static
readonly
field
|
Max
|
||
type
|
Box3I
|
Remarks:
Note
that
the
dimension
of
this
box
is
2^32
(4294967296),
which
cannot
be
expressed
using
32-bits.
So
instead
0
is
returned.
public
property
|
Center
{
get
}
|
||
type
|
Vec3I
|
||
value
|
Returns the extends of this box along the Z-axis.
public
property
|
Depth
{
get
}
|
||
type
|
int32
|
||
value
|
The box depth. |
Returns the extends of this box along the Y-axis.
public
property
|
Height
{
get
}
|
||
type
|
int32
|
||
value
|
The box height. |
Is this bounding box empty?
public
property
|
IsEmpty
{
get
}
|
||
type
|
bool
|
||
value
|
true
if
this
bounding
box
is
empty,
false
if
not. |
Returns the size of this box.
public
property
|
Size
{
get
}
|
||
type
|
Vec3I
|
||
value
|
The box size: The Width is stored in X, the Height in Y, the Depth in Z. |
Returns the volume of this bounding box.
public
property
|
Volume
{
get
}
|
||
type
|
int64
|
||
value
|
The bounding box volume. |
Remarks:
The
volume
will
always
be
0
when
IsEmpty
returns
true
.
Returns the extends of this box along the X-axis.
public
property
|
Width
{
get
}
|
||
type
|
int32
|
||
value
|
The box width. |
X-coordinate of minimum corner of bounding box.
public
readonly
field
|
X1
|
||
type
|
int32
|
X-coordinate of maximum corner of bounding box.
public
readonly
field
|
X2
|
||
type
|
int32
|
Y-coordinate of minimum corner of bounding box.
public
readonly
field
|
Y1
|
||
type
|
int32
|
Y-coordinate of maximum corner of bounding box.
public
readonly
field
|
Y2
|
||
type
|
int32
|
Z-coordinate of minimum corner of bounding box.
public
readonly
field
|
Z1
|
||
type
|
int32
|
Z-coordinate of maximum corner of bounding box.
public
readonly
field
|
Z2
|
||
type
|
int32
|
Checks the intersection between this bounding box and the given one.
[Pure]
|
||||
public
method
|
CheckIntersection
(Box3I box)
|
|||
type
|
int32
|
|||
params
|
box
|
The other bounding box. | ||
returns
|
-1
if
the
bounding
boxes
do
not
overlap,
1
if
box
fully
contains
this
bounding
box
and
0
if
both
bounding
boxes
overlap
without
containing
each
other.
|
[Pure]
|
||||
public
method
|
Clamp
(Vec3I v)
|
|||
type
|
Vec3I
|
|||
params
|
v
|
[Pure]
|
||||
public
method
|
Clamp
(int32 x,
int32 y,
int32 z)
|
|||
type
|
Vec3I
|
|||
params
|
x
|
|||
y
|
||||
z
|
Computes the overlap of this bounding box and the given one.
[Pure]
|
||||
public
method
|
ComputeOverlap
(Box3I box)
|
|||
type
|
int32
|
|||
params
|
box
|
Second bounding box. | ||
returns
|
|
The amount of overlap (i.e. the volume of the intersection). |
Checks if this box contains the given point.
[Pure]
|
||||
public
method
|
Contains
(Vec3I xyz)
|
|||
type
|
bool
|
|||
params
|
xyz
|
The point coordinates. | ||
returns
|
true
if
this
box
contains
the
point,
false
if
not. |
Checks if this box contains the given box.
[Pure]
|
||||
public
method
|
Contains
(Box3I box)
|
|||
type
|
bool
|
|||
params
|
box
|
The other box. | ||
returns
|
true
if
this
box
fully
contains
the
given
box,
false
if
not.
|
Checks if this box contains the given point.
[Pure]
|
||||
public
method
|
Contains
(int32 x,
int32 y,
int32 z)
|
|||
type
|
bool
|
|||
params
|
x
|
The point X-coordinate. | ||
y
|
The point Y-coordinate. | |||
z
|
The point Z-coordinate. | |||
returns
|
true
if
this
box
contains
the
point,
false
if
not. |
Checks if this box and the given box are disjoint (i.e. do not intersect).
[Pure]
|
||||
public
method
|
Disjoint
(Box3I box)
|
|||
type
|
bool
|
|||
params
|
box
|
The other box. | ||
returns
|
true
if
this
box
and
the
given
box
are
disjoint,
false
if
not.
|
Checks if this box is equal to the given box.
[Pure]
|
||||
public
method
|
Equals
(Box3I other)
|
|||
type
|
bool
|
|||
params
|
other
|
The other box. | ||
returns
|
true
if
the
boxes
are
equal,
false
if
not. |
Creates a new instance of Box3I from the given corner points.
[Pure]
|
||||
public
static
method
|
FromPoints
(Vec3I a,
Vec3I b)
|
|||
type
|
Box3I
|
|||
params
|
a
|
First corner point. | ||
b
|
Second corner point. | |||
returns
|
The bounding box. |
Creates a new instance of Box3I from the given corner points.
[Pure]
|
||||
public
static
method
|
FromPoints
(int32 x1,
int32 y1,
int32 z1,
int32 x2,
int32 y2,
int32 z2)
|
|||
type
|
Box3I
|
|||
params
|
x1
|
X-coordinate of first corner point. | ||
y1
|
Y-coordinate of first corner point. | |||
z1
|
Z-coordinate of first corner point. | |||
x2
|
X-coordinate of second corner point. | |||
y2
|
Y-coordinate of second corner point. | |||
z2
|
Z-coordinate of second corner point. | |||
returns
|
The bounding box. |
Creates a new instance of Box3I from the given rectangular cuboid.
[Pure]
|
||||
public
static
method
|
FromRect
(int32 x,
int32 y,
int32 z,
int32 width,
int32 height,
int32 depth)
|
|||
type
|
Box3I
|
|||
params
|
x
|
X-coordinate of top-left-front corner of cuboid. | ||
y
|
Y-coordinate of top-left-front corner of cuboid. | |||
z
|
Z-coordinate of top-left-front corner of cuboid. | |||
width
|
[>=0]
|
Width of cuboid. | ||
height
|
[>=0]
|
Height of cuboid. | ||
depth
|
[>=0]
|
Depth of cuboid. | ||
returns
|
The bounding box. |
Enlarges the extends of this box so that it covers the given box.
public
method
|
Grow
(Box3I box)
|
||
type
|
Box3I
|
||
params
|
box
|
To other box. | |
returns
|
The resulting box. |
Enlarges the extends of this box so that it covers the given point.
public
method
|
Grow
(Vec3I v)
|
||
type
|
Box3I
|
||
params
|
v
|
Coordinates of point to cover. | |
returns
|
The resulting box. |
Enlarges the extends of this box so that it covers the given point.
public
method
|
Grow
(int32 x,
int32 y,
int32 z)
|
||
type
|
Box3I
|
||
params
|
x
|
X-coordinate of point to cover. | |
y
|
Y-coordinate of point to cover. | ||
z
|
Z-coordinate of point to cover. | ||
returns
|
The resulting box. |
Computes the intersection of the given bounding box and this one.
[Pure]
|
||||
public
method
|
Intersect
(Box3I box)
|
|||
type
|
Box3I
|
|||
params
|
box
|
The bounding box. | ||
returns
|
The resulting bounding box. |
Returns a simple string representation of this bounding box.
[Pure]
|
||||
public
override
method
|
ToString
()
|
|||
type
|
string
|
|||
returns
|
|
The string representation. |
Translates this bounding box.
[Pure]
|
||||
public
method
|
Translate
(int32 x,
int32 y,
int32 z)
|
|||
type
|
Box3I
|
|||
params
|
x
|
Translation amount along X-axis. | ||
y
|
Translation amount along Y-axis. | |||
z
|
Translation amount along Z-axis. | |||
returns
|
The resulting bounding box. |