Module Gg.Box2
type t= box2The type for 2D boxes (rectangles).
val dim : intdimis the dimension of the boxes of typebox2.
type v= v2The type for 2D vectors.
type p= p2The type for 2D points.
type size= size2The type for 2D sizes.
type m= m2The type for matrices representing linear transformations of 2D space.
Constructors, accessors and constants
val empty : box2emptyis the empty box.
val ox : box2 -> floatox bisV2.x (o b).
val oy : box2 -> floatoy bisV2.y (o b).
val w : box2 -> floatw bisSize2.w (size b).
val h : box2 -> floath bisSize2.h (size b).
val zero : box2zerois a box whose origin and size is zero.
val unit : box2unitis the unit box which extends from zero to one in all dimensions.
Functions
val minx : box2 -> floatminx bisV2.x (min b).
val miny : box2 -> floatminy bisV2.y (min b).
val max : box2 -> p2max bis the greatest point ofb(its size added to the origin).- raises Invalid_argument
on
empty
val maxx : box2 -> floatmaxx bisV2.x (max b).
val maxy : box2 -> floatmaxy bisV2.y (max b).
val midx : box2 -> floatmidx bisV2.x (mid b).
val midy : box2 -> floatmidy bisV2.y (mid b).
val area : box2 -> floatarea bis the surface area ofb.
val inter : box2 -> box2 -> box2inter b b'is a box whose space is the intersection of S(b) and S(b').
val inset : v2 -> box2 -> box2inset d bisbwhose edges are inset in each dimension according to amounts ind. Negative values indoutset. If the resulting size is negative returnsempty. Returnsemptyonempty.
val round : box2 -> box2round bis the smallest box containingbwith integer valued corners. Returnsemptyonempty.
val ltr : m2 -> box2 -> box2ltr m bis the smallest box containing the corners ofbtransformed bym. Returnsemptyonempty.
Predicates and comparisons
val is_pt : box2 -> boolis_pt bistrueiffbis notemptyand its size is equal to 0 in every dimension.
val is_seg : box2 -> boolis_seg bistrueiffbis notemptyand its size is equal to 0 in exactly one dimension.
Printers
val pp : Stdlib.Format.formatter -> box2 -> unitpp ppf bprints a textual representation ofbonppf.
val pp_f : (Stdlib.Format.formatter -> float -> unit) -> Stdlib.Format.formatter -> box2 -> unitpp_f pp_fl ppf bprintsblikeppbut usespp_flto print floating point values.