Gg.Box3
3D axis-aligned boxes.
dim
is the dimension of the boxes of type box3
.
type v = v3
The type for 3D vectors.
type p = p3
The type for 3D points.
type size = size3
The type for 3D sizes.
type m = m3
The type for matrices representing linear transformations of 3D space.
val empty : box3
empty
is the empty box.
val ox : box3 -> float
ox b
is V3.x (o b)
.
val oy : box3 -> float
oy b
is V3.y (o b)
.
val oz : box3 -> float
oz b
is V3.z (o b)
.
val w : box3 -> float
w b
is Size3.w (size b)
.
val h : box3 -> float
h b
is Size3.h (size b)
.
val d : box3 -> float
d b
is Size3.d (size b)
.
val zero : box3
zero
is a box whose origin and size is zero.
val unit : box3
unit
is the unit box which extends from zero to one in all dimensions.
val minx : box3 -> float
minx b
is V3.x (min b)
.
val miny : box3 -> float
miny b
is V3.y (min b)
.
val minz : box3 -> float
minz b
is V3.z (min b)
.
max b
is the greatest point of b
(its size added to the origin).
Raises Invalid_argument
on empty
val maxx : box3 -> float
maxx b
is V3.x (max b)
.
val maxy : box3 -> float
maxy b
is V3.y (max b)
.
val maxz : box3 -> float
maxz b
is V3.z (max b)
.
val midx : box3 -> float
midx b
is V3.x (mid b)
.
val midy : box3 -> float
midy b
is V3.y (mid b)
.
val midz : box3 -> float
midz b
is V3.z (mid b)
.
fbl_pt b
is the far-bottom-left corner of b
. Raises Invalid_argument
on empty
.
fbl_pt b
is the far-bottom-right corner of b
. Raises Invalid_argument
on empty
.
nbl_pt b
is the near-bottom-left corner of b
. Raises Invalid_argument
on empty
.
nbl_pt b
is the near-bottom-right corner of b
. Raises Invalid_argument
on empty
.
nbl_pt b
is the near-top-right corner of b
. Raises Invalid_argument
on empty
.
val area : box3 -> float
area b
is the surface area of b
.
val volume : box3 -> float
volume b
is the volume of b
.
inter b b'
is a box whose space is the intersection of S(b
) and S(b'
).
inset d b
is b
whose edges are inset in each dimension according to amounts in d
. Negative values in d
outset. If the size in dimension i
becomes negative it is clamped to 0
and the i
th coordinate of the mid point of b
is used for the i
th coordinate of the resulting box's origin. Returns empty
on empty
.
val is_pt : box3 -> bool
is_pt b
is true
iff b
is not empty
and its size is equal to 0 in every dimension.
val is_plane : box3 -> bool
is_plane b
is true
iff the size of b
is equal to 0 in exactly one dimension.
val is_seg : box3 -> bool
is_seg b
is true
iff b
is not empty
and its size is equal to 0 in exactly two dimensions.
equal_f eq b b'
tests b
and b'
like equal
but uses eq
to test floating point values.
compare_f cmp b b'
compares b
and b'
like compare
but uses cmp
to compare floating point values.
val pp : Stdlib.Format.formatter -> box3 -> unit
pp ppf b
prints a textual representation of b
on ppf
.