Module Gg.Box2

module Box2: sig .. end

type t = Gg.box2 
The type for 2D boxes (rectangles).
val dim : int
dim is the dimension of the boxes of type Gg.box2.
type v = Gg.v2 
The type for 2D vectors.
type p = Gg.p2 
The type for 2D points.
type size = Gg.size2 
The type for 2D sizes.
type m = Gg.m2 
The type for matrices representing linear transformations of 2D space.

Constructors, accessors and constants


val v : Gg.p2 -> Gg.size2 -> Gg.box2
v o size is a box whose origin is o and size is size.
val v_mid : Gg.p2 -> Gg.size2 -> t
v_mid mid size is a box whose Gg.Box2.mid point is mid and size is size.
val empty : Gg.box2
empty is the empty box.
val o : Gg.box2 -> Gg.p2
o b is the origin of b.
Raises Invalid_argument on Gg.Box2.empty
val ox : Gg.box2 -> float
ox b is V2.x (o b).
val oy : Gg.box2 -> float
oy b is V2.y (o b).
val size : Gg.box2 -> size
size b is the size of b.
Raises Invalid_argument on Gg.Box2.empty
val w : Gg.box2 -> float
w b is Size2.w (size b).
val h : Gg.box2 -> float
h b is Size2.h (size b).
val zero : Gg.box2
zero is a box whose origin and size is zero.
val unit : Gg.box2
unit is the unit box which extends from zero to one in all dimensions.
val of_pts : Gg.p2 -> Gg.p2 -> Gg.box2
of_pts p p' is the smallest box whose space contains p and p'.

Functions


val min : Gg.box2 -> Gg.p2
min b is the smallest point of b (its origin).
Raises Invalid_argument on Gg.Box2.empty
val minx : Gg.box2 -> float
minx b is V2.x (min b).
val miny : Gg.box2 -> float
miny b is V2.y (min b).
val max : Gg.box2 -> Gg.p2
max b is the greatest point of b (its size added to the origin).
Raises Invalid_argument on Gg.Box2.empty
val maxx : Gg.box2 -> float
maxx b is V2.x (max b).
val maxy : Gg.box2 -> float
maxy b is V2.y (max b).
val mid : Gg.box2 -> Gg.p2
mid b is the mid point between min and max.
Raises Invalid_argument on Gg.Box2.empty
val midx : Gg.box2 -> float
midx b is V2.x (mid b).
val midy : Gg.box2 -> float
midy b is V2.y (mid b).
val bl_pt : Gg.box2 -> Gg.p2
bl b is the bottom-left corner of b.
Raises Invalid_argument on Gg.Box2.empty
val bm_pt : Gg.box2 -> Gg.p2
bm_pt b is the bottom-mid point of b.
Raises Invalid_argument on Gg.Box2.empty
val br_pt : Gg.box2 -> Gg.p2
br_pt b is the bottom-right corner of b.
Raises Invalid_argument on Gg.Box2.empty
val ml_pt : Gg.box2 -> Gg.p2
ml_pt b is the mid-left corner of b.
Raises Invalid_argument on Gg.Box2.empty
val mm_pt : Gg.box2 -> Gg.p2
ml_pt b is {!mid} b.
Raises Invalid_argument on Gg.Box2.empty
val mr_pt : Gg.box2 -> Gg.p2
mr_pt b is the mid-right point of b.
Raises Invalid_argument on Gg.Box2.empty
val tl_pt : Gg.box2 -> Gg.p2
tl_pt b is the top-left corner of b.
Raises Invalid_argument on Gg.Box2.empty
val tm_pt : Gg.box2 -> Gg.p2
tm_pt b is the top-middle corner of b.
Raises Invalid_argument on Gg.Box2.empty
val tr_pt : Gg.box2 -> Gg.p2
tr_pt b is the top-right corner of b.
Raises Invalid_argument on Gg.Box2.empty
val area : Gg.box2 -> float
area b is the surface area of b.
val inter : Gg.box2 -> Gg.box2 -> Gg.box2
inter b b' is a box whose space is the intersection of S(b) and S(b').
val union : Gg.box2 -> Gg.box2 -> Gg.box2
union b b' is the smallest box whose space contains S(b) and S(b').
val inset : Gg.v2 -> Gg.box2 -> Gg.box2
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.Box2.empty. Returns Gg.Box2.empty on Gg.Box2.empty.
val round : Gg.box2 -> Gg.box2
round b is the smallest box containing b with integer valued corners. Returns Gg.Box2.empty on Gg.Box2.empty.
val move : Gg.v2 -> Gg.box2 -> Gg.box2
move d b is b translated by d. Returns Gg.Box2.empty on Gg.Box2.empty.
val ltr : Gg.m2 -> Gg.box2 -> Gg.box2
ltr m b is the smallest box containing the corners of b transformed by m. Returns Gg.Box2.empty on Gg.Box2.empty.
val tr : Gg.m3 -> Gg.box2 -> Gg.box2
tr m b is the smallest box containing the corners of b transformed by m in homogenous 2D space. Returns Gg.Box2.empty on Gg.Box2.empty.
val map_f : (float -> float) -> Gg.box2 -> Gg.box2
map_f f b is the box whose origin and size are those of b with their components mapped by f. Returns Gg.Box2.empty on Gg.Box2.empty.

Predicates and comparisons


val is_empty : Gg.box2 -> bool
is_empty b is true iff b is Gg.Box2.empty.
val is_pt : Gg.box2 -> bool
is_pt b is true iff b is not Gg.Box2.empty and its size is equal to 0 in every dimension.
val is_seg : Gg.box2 -> bool
is_seg b is true iff b is not Gg.Box2.empty and its size is equal to 0 in exactly one dimension.
val isects : Gg.box2 -> Gg.box2 -> bool
isects b b' is not (is_empty (inter b b')).
val subset : Gg.box2 -> Gg.box2 -> bool
subset b b' is true iff S(b) is included in S(b').
val mem : Gg.p2 -> Gg.box2 -> bool
mem p b is true iff p is in S(b).
val equal : Gg.box2 -> Gg.box2 -> bool
equal b b' is b = b'.
val equal_f : (float -> float -> bool) -> Gg.box2 -> Gg.box2 -> bool
equal_f eq b b' tests b and b' like Gg.Box2.equal but uses eq to test floating point values.
val compare : Gg.box2 -> Gg.box2 -> int
compare u v is Pervasives.compare u v.
val compare_f : (float -> float -> int) -> Gg.box2 -> Gg.box2 -> int
compare_f cmp b b' compares b and b' like Gg.Box2.compare but uses cmp to compare floating point values.

Printers


val pp : Format.formatter -> Gg.box2 -> unit
pp ppf b prints a textual representation of b on ppf.
val pp_f : (Format.formatter -> float -> unit) -> Format.formatter -> Gg.box2 -> unit
pp_f pp_fl ppf b prints b like Gg.Box2.pp but uses pp_fl to print floating point values.