module Box1: sig
.. end
type
t
val dim : int
dim
is the dimension of the boxes of type
Gg.box2
.
type
v = float
The type for 1D vectors.
type
p = float
The type for 1D points.
type
size = Gg.size1
The type for 1D sizes.
type
m = float
Constructors, accessors and constants
val v : float -> Gg.size1 -> Gg.box1
v o size
is a box whose origin is o
and size is size
.
val v_mid : float -> Gg.size1 -> Gg.box1
v_mid mid size
is a box whose
Gg.Box1.mid
point is
mid
and
size is
size
.
val empty : Gg.box1
empty
is the empty box.
val o : Gg.box1 -> float
val ox : Gg.box1 -> float
ox b
is o b
.
val size : Gg.box1 -> Gg.size1
size b
is the size of
b
.
Raises Invalid_argument
on
Gg.Box1.empty
val w : Gg.box1 -> float
w b
is size b
.
val zero : Gg.box1
zero
is a box whose origin and size is zero.
val unit : Gg.box1
unit
is the unit box which extends from zero to
one in all dimensions.
val of_pts : float -> float -> Gg.box1
of_pts p p'
is the smallest box whose space contains p
and p'
.
Functions
val min : Gg.box1 -> float
min b
is the smallest point of
b
(its origin).
Raises Invalid_argument
on
Gg.Box1.empty
val minx : Gg.box1 -> float
minx b
is min b
.
val max : Gg.box1 -> float
max b
is the greatest point of
b
(its size added to the origin).
Raises Invalid_argument
on
Gg.Box1.empty
val maxx : Gg.box1 -> float
maxx b
is max b
.
val mid : Gg.box1 -> float
mid b
is the mid point between
min
and
max
.
Raises Invalid_argument
on
Gg.Box1.empty
val midx : Gg.box1 -> float
midx b
is mid b
.
val left : Gg.box1 -> float
left b
is minx b
.
val right : Gg.box1 -> float
right b
is maxx b
.
val area : Gg.box1 -> float
area b
is the surface area of b
.
val inter : Gg.box1 -> Gg.box1 -> Gg.box1
inter b b'
is a box whose space is the intersection of S(b
)
and S(b'
).
val union : Gg.box1 -> Gg.box1 -> Gg.box1
union b b'
is the smallest box whose space contains
S(b
) and S(b'
).
val inset : float -> Gg.box1 -> Gg.box1
inset d b
is
b
whose edges are inset in each dimension
according to amounts in
d
. Negative values in
d
outset. If
the resulting size is negative returns
Gg.Box1.empty
. Returns
Gg.Box1.empty
on
Gg.Box1.empty
.
val round : Gg.box1 -> Gg.box1
val move : float -> Gg.box1 -> Gg.box1
val ltr : float -> Gg.box1 -> Gg.box1
val tr : Gg.m2 -> Gg.box1 -> Gg.box1
tr m b
is the smallest box containing the corners of
b
transformed
by
m
in homogenous 1D space. Returns
Gg.Box1.empty
on
Gg.Box1.empty
.
val map_f : (float -> float) -> Gg.box1 -> Gg.box1
map_f f b
is the box whose origin and size are those of
b
with
their components mapped by
f
. Returns
Gg.Box1.empty
on
Gg.Box1.empty
.
Predicates and comparisons
val is_empty : Gg.box1 -> bool
val is_pt : Gg.box1 -> bool
is_pt b
is
true
iff
b
is not
Gg.Box1.empty
and its size is equal
to 0 in every dimension.
val isects : Gg.box1 -> Gg.box1 -> bool
isects b b'
is not (is_empty (inter b b'))
.
val subset : Gg.box1 -> Gg.box1 -> bool
subset b b'
is true
iff S(b
) is included in S(b'
).
val mem : float -> Gg.box1 -> bool
mem p b
is true
iff p
is in S(b
).
val equal : Gg.box1 -> Gg.box1 -> bool
equal b b'
is b = b'
.
val equal_f : (float -> float -> bool) -> Gg.box1 -> Gg.box1 -> bool
equal_f eq b b'
tests
b
and
b'
like
Gg.Box1.equal
but uses
eq
to test floating point values.
val compare : Gg.box1 -> Gg.box1 -> int
compare u v
is Pervasives.compare u v
.
val compare_f : (float -> float -> int) -> Gg.box1 -> Gg.box1 -> int
compare_f cmp b b'
compares
b
and
b'
like
Gg.Box1.compare
but uses
cmp
to compare floating point values.
Printers
val pp : Format.formatter -> Gg.box1 -> unit
pp ppf b
prints a textual representation of b
on ppf
.
val pp_f : (Format.formatter -> float -> unit) -> Format.formatter -> Gg.box1 -> unit
pp_f pp_fl ppf b
prints
b
like
Gg.Box1.pp
but uses
pp_fl
to print floating point values.