Module Hugin_gg.Box2
Axis-aligned boxes.
A box is a closed rectangle of the plane with sides parallel to the axes, possibly of zero width or height. There is no empty box: a function whose result may enclose nothing, such as Hugin_gg.Path.bounds, returns an option. Boxes are what bounds report and what layout places panels in.
Types
type tThe type for boxes. Invariant: the corners are finite, minx <= maxx and miny <= maxy.
Constructors
v x y w h is the box with corner (x, y), width w and height h: it spans [x;x +. w] by [y;y +. h].
Raises Invalid_argument if w or h is negative, or if x, y, x +. w or y +. h is not finite.
of_pts p q is the smallest box containing p and q, which are any two opposite corners.
Raises Invalid_argument if a coordinate of p or q is not finite.
Accessors
Combining and transforming
inter a b is the box of the points in both a and b, or None if they have none. Boxes that touch along an edge or at a corner meet in a box of zero width or height.
grow d b is b with each side moved outwards by d, inwards if d is negative.
Raises Invalid_argument if a corner of the result is not finite or if d shrinks a side past the opposite one.
transform m b is the smallest box containing the images of b's four corners under m. Under a rotation it is larger than the rotated box.
Raises Invalid_argument if an image is not finite.
Comparing and formatting
compare a b orders boxes lexicographically by minx, miny, maxx and maxy.