package geoml
Library
Module
Module type
Parameter
Class
Class type
This module provides the basic operations over rectangles
type t = private Point.t * float * float
rectangle type
make p w h, returns a rectangle where p is the bottom-left corner of the rectangle, w its width and h its height
of_diagonal p1 p2, builds the rectangle where p1p2 is its diagonal (the bounding rectangle of the two points)
val area : t -> float
val perimeter : t -> float
val proj_x : t -> float * float
val proj_y : t -> float * float
returns the intersection points of a rectangle and a line. returns if they don't intersect.
returns a list of length 4 containing the segments of the rectangle
val is_square : t -> bool
tests if the sides of the rectangle have same length
given a rectangle and point, returns the smallest rectangle that contains the point and the rectangle given as parameters
given a list of point, returns the smallest rectangle that contains all the points of the list
val random_point : Random.State.t -> t -> Point.t
returns a randomly and uniformly chosen point of the rectangle
val print : Format.formatter -> t -> unit
printer