A three-dimensional bounding box with 64-bit floating-point precision.
struct
|
Box3D
|
implements
|
IEquatable<Box3D>
|
The coordinates refer to infinitesimal points (pixel-is-point semantic).
The serialization helper object for values of Box3D.
public
static
readonly
field
|
Serializer
|
||
type
|
ITypeSerializer<Box3D>
|
An empty bounding box at the coordinate origin.
public
static
readonly
field
|
Empty
|
||
type
|
Box3D
|
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
|
Box3D
|
The largest possible box.
public
static
readonly
field
|
Max
|
||
type
|
Box3D
|
public
property
|
Center
{
get
}
|
||
type
|
Vec3D
|
||
value
|
Returns the extends of this box along the Z-axis.
public
property
|
Depth
{
get
}
|
||
type
|
float64
|
||
value
|
The box depth. |
Returns the extends of this box along the Y-axis.
public
property
|
Height
{
get
}
|
||
type
|
float64
|
||
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. |
Remarks:
The bounding box is empty if its volume is zero.
Is this bounding box a point?
public
property
|
IsPoint
{
get
}
|
||
type
|
bool
|
||
value
|
true
if
this
bounding
box
is
a
point,
false
if
not. |
Returns the size of this box.
public
property
|
Size
{
get
}
|
||
type
|
Vec3D
|
||
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
|
float64
|
||
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
|
float64
|
||
value
|
The box width. |
X-coordinate of minimum corner of bounding box.
public
readonly
field
|
X1
|
||
type
|
float64
|
X-coordinate of maximum corner of bounding box.
public
readonly
field
|
X2
|
||
type
|
float64
|
Y-coordinate of minimum corner of bounding box.
public
readonly
field
|
Y1
|
||
type
|
float64
|
Y-coordinate of maximum corner of bounding box.
public
readonly
field
|
Y2
|
||
type
|
float64
|
Z-coordinate of minimum corner of bounding box.
public
readonly
field
|
Z1
|
||
type
|
float64
|
Z-coordinate of maximum corner of bounding box.
public
readonly
field
|
Z2
|
||
type
|
float64
|
Checks the intersection between this bounding box and the given one.
[Pure]
|
||||
public
method
|
CheckIntersection
(Box3D 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
(Vec3D v)
|
|||
type
|
Vec3D
|
|||
params
|
v
|
[Pure]
|
||||
public
method
|
Clamp
(float64 x,
float64 y,
float64 z)
|
|||
type
|
Vec3D
|
|||
params
|
x
|
|||
y
|
||||
z
|
Computes the overlap of this bounding box and the given one.
[Pure]
|
||||
public
method
|
ComputeOverlap
(Box3D box)
|
|||
type
|
float64
|
|||
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
(Vec3D 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
(Box3D 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
(float64 x,
float64 y,
float64 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
(Box3D 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
(Box3D other)
|
|||
type
|
bool
|
|||
params
|
other
|
The other box. | ||
returns
|
true
if
the
boxes
are
equal,
false
if
not. |
Creates a new instance of Box3D from the given corner points.
[Pure]
|
||||
public
static
method
|
FromPoints
(Vec3D a,
Vec3D b)
|
|||
type
|
Box3D
|
|||
params
|
a
|
First corner point. | ||
b
|
Second corner point. | |||
returns
|
The bounding box. |
Creates a new instance of Box3D from the given corner points.
[Pure]
|
||||
public
static
method
|
FromPoints
(float64 x1,
float64 y1,
float64 z1,
float64 x2,
float64 y2,
float64 z2)
|
|||
type
|
Box3D
|
|||
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 Box3D from the given rectangular cuboid.
[Pure]
|
||||
public
static
method
|
FromRect
(float64 x,
float64 y,
float64 z,
float64 width,
float64 height,
float64 depth)
|
|||
type
|
Box3D
|
|||
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
(Box3D box)
|
||
type
|
Box3D
|
||
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
(Vec3D v)
|
||
type
|
Box3D
|
||
params
|
v
|
Coordinates of point to cover (can be NaN). | |
returns
|
The resulting box. |
Enlarges the extends of this box so that it covers the given point.
public
method
|
Grow
(float64 x,
float64 y,
float64 z)
|
||
type
|
Box3D
|
||
params
|
x
|
X-coordinate of point to cover (can be NaN). | |
y
|
Y-coordinate of point to cover (can be NaN). | ||
z
|
Z-coordinate of point to cover (can be NaN). | ||
returns
|
The resulting box. |
Computes the intersection of the given bounding box and this one.
[Pure]
|
||||
public
method
|
Intersect
(Box3D box)
|
|||
type
|
Box3D
|
|||
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
(float64 x,
float64 y,
float64 z)
|
|||
type
|
Box3D
|
|||
params
|
x
|
Translation amount along X-axis. | ||
y
|
Translation amount along Y-axis. | |||
z
|
Translation amount along Z-axis. | |||
returns
|
The resulting bounding box. |