Module Gg.Box3
val dim : int
dim
is the dimension of the boxes of typebox3
.
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.
Constructors, accessors and constants
val empty : box3
empty
is the empty box.
val ox : box3 -> float
ox b
isV3.x (o b)
.
val oy : box3 -> float
oy b
isV3.y (o b)
.
val oz : box3 -> float
oz b
isV3.z (o b)
.
val w : box3 -> float
w b
isSize3.w (size b)
.
val h : box3 -> float
h b
isSize3.h (size b)
.
val d : box3 -> float
d b
isSize3.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.
Functions
val minx : box3 -> float
minx b
isV3.x (min b)
.
val miny : box3 -> float
miny b
isV3.y (min b)
.
val minz : box3 -> float
minz b
isV3.z (min b)
.
val max : box3 -> p3
max b
is the greatest point ofb
(its size added to the origin).- raises Invalid_argument
on
empty
val maxx : box3 -> float
maxx b
isV3.x (max b)
.
val maxy : box3 -> float
maxy b
isV3.y (max b)
.
val maxz : box3 -> float
maxz b
isV3.z (max b)
.
val midx : box3 -> float
midx b
isV3.x (mid b)
.
val midy : box3 -> float
midy b
isV3.y (mid b)
.
val midz : box3 -> float
midz b
isV3.z (mid b)
.
val fbr_pt : box3 -> p3
fbl_pt b
is the far-bottom-right corner ofb
.- raises Invalid_argument
on
empty
.
val nbl_pt : box3 -> p3
nbl_pt b
is the near-bottom-left corner ofb
.- raises Invalid_argument
on
empty
.
val nbr_pt : box3 -> p3
nbl_pt b
is the near-bottom-right corner ofb
.- raises Invalid_argument
on
empty
.
val area : box3 -> float
area b
is the surface area ofb
.
val volume : box3 -> float
volume b
is the volume ofb
.
val inter : box3 -> box3 -> box3
inter b b'
is a box whose space is the intersection of S(b
) and S(b'
).
val inset : v3 -> box3 -> box3
inset d b
isb
whose edges are inset in each dimension according to amounts ind
. Negative values ind
outset. If the resulting size is negative returnsempty
. Returnsempty
onempty
.
val round : box3 -> box3
round b
is the smallest box containingb
with integer valued corners. Returnsempty
onempty
.
val ltr : m3 -> box3 -> box3
ltr m b
is the smallest box containing the corners ofb
transformed bym
. Returnsempty
onempty
.
Predicates and comparisons
val is_pt : box3 -> bool
is_pt b
istrue
iffb
is notempty
and its size is equal to 0 in every dimension.
val is_plane : box3 -> bool
is_plane b
istrue
iff the size ofb
is equal to 0 in exactly one dimension.
val is_seg : box3 -> bool
is_seg b
istrue
iffb
is notempty
and its size is equal to 0 in exactly two dimensions.
Printers
val pp : Stdlib.Format.formatter -> box3 -> unit
pp ppf b
prints a textual representation ofb
onppf
.
val pp_f : (Stdlib.Format.formatter -> float -> unit) -> Stdlib.Format.formatter -> box3 -> unit
pp_f pp_fl ppf b
printsb
likepp
but usespp_fl
to print floating point values.