Box

N-dimensional half-open interval [a, b[.

Constructors

this
this(bound_t min_, bound_t max_)

Construct a box which extends between 2 points. Boundaries: min is inside the box, max is just outside.

this
this(T min_, T max_)
Undocumented in source.
this
this(T min_x, T min_y, T max_x, T max_y)
Undocumented in source.
this
this(T min_x, T min_y, T min_z, T max_x, T max_y, T max_z)
Undocumented in source.

Members

Aliases

bound_t
alias bound_t = Vector!(T, N)
Undocumented in source.

Functions

abs
Box abs()
contains
bool contains(bound_t point)
contains
bool contains(T x, T y)
contains
bool contains(T x, T y, T z)
contains
bool contains(Box other)
distance
real distance(bound_t point)

Euclidean distance from a point.

distance
real distance(Box o)

Euclidean distance from another box.

expand
Box expand(bound_t point)

Expands the box to include point.

expand
Box expand(Box other)

Expands the box to include another box. This function deals with empty boxes correctly.

grow
Box grow(bound_t space)

Extends the area of this Box.

grow
Box grow(T space)

Extends the area of this Box.

intersection
Box intersection(Box o)

Assumes sorted boxes. This function deals with empty boxes correctly.

intersects
bool intersects(Box other)

Assumes sorted boxes. This function deals with empty boxes correctly.

isSorted
bool isSorted()
opAssign
Box opAssign(U x)

Assign with another box.

opCast
U opCast()

Cast to other box types.

opEquals
bool opEquals(U other)
scaleByFactor
Box scaleByFactor(float scale)

Scale the box by factor scale, and round the result to integer if needed.

scaleByFactor
Box scaleByFactor(float scaleX, float scaleY)

Scale the box by factor scaleX horizontally and scaleY vetically. Round the result to integer if needed.

shrink
Box shrink(bound_t space)

Shrink the area of this Box. The box might became unsorted.

shrink
Box shrink(T space)

Shrinks the area of this Box.

squaredDistance
real squaredDistance(bound_t point)

Euclidean squared distance from a point.

squaredDistance
real squaredDistance(Box o)

Euclidean squared distance from another box.

translate
Box translate(bound_t offset)

Translate this Box.

translate
Box translate(T x, T y)

Translate this Box by x, y.

translate
Box translate(T x, T y, T z)

Translate this Box by x, y.

Properties

center
bound_t center [@property getter]
depth
T depth [@property getter]
depth
T depth [@property setter]

Sets depth of the box assuming min point is the pivot.

empty
bool empty [@property getter]
height
T height [@property getter]
height
T height [@property setter]

Sets height of the box assuming min point is the pivot.

size
bound_t size [@property getter]
size
bound_t size [@property setter]

Sets size of the box assuming min point is the pivot.

volume
T volume [@property getter]
width
T width [@property getter]
width
T width [@property setter]

Sets width of the box assuming min point is the pivot.

Static functions

rectangle
Box rectangle(T x, T y, T width, T height)

Helper function to create rectangle with a given point, width and height.

Variables

max
bound_t max;
Undocumented in source.
min
bound_t min;
Undocumented in source.

Meta