Module provides means to deal with simple structures called bounds.
Each such bound contain description of a two-dimensional bounding box.
bound() = {number(), number(), number(), number()}
area/1 | Computes area of a bound. |
center/1 | Returns effective coordinates of the center of a bound. |
dimensions/1 | Returns effective dimensions of a bound. |
empty/0 | Creates an empty bound, with no position and dimensions. |
intersect/2 | Returns new bound comprised of all common points of two specified bound. |
lowerleft/1 | Returns coordinates of the lower left point of a bound. |
margin/1 | Computes margin of a bound. |
new/2 | Creates bound with position and no dimensions, effectively a point. |
new/4 | Creates bound with well-defined position and dimensions. |
overlap/2 | Computes area covered by the intersection of two specified bounds. |
unify/2 | Returns new bound containing each one of specified bounds. |
upperright/1 | Returns coordinates of the upper right point of a bound. |
x1/1 | Returns lower coordinate of a bound on the X axis. |
x2/1 | Returns upper coordinate of a bound on the X axis. |
y1/1 | Returns lower coordinate of a bound on the Y axis. |
y2/1 | Returns upper coordinate of a bound on the Y axis. |
area(X1::empty | bound()) -> number()
center(X1::bound()) -> {number(), number()}
Returns effective coordinates of the center of a bound.
dimensions(X1::bound()) -> {number(), number()}
Returns effective dimensions of a bound.
empty() -> empty
Creates an empty bound, with no position and dimensions.
Returns new bound comprised of all common points of two specified bound. The resulting bound can be empty, in case there are no common points at all.
lowerleft(X1::bound()) -> {number(), number()}
Returns coordinates of the lower left point of a bound.
margin(X1::empty | bound()) -> number()
Computes margin of a bound. Margin is equal to the half of perimeter.
new(X::number(), Y::number()) -> bound()
Creates bound with position and no dimensions, effectively a point.
new(X::number(), Y::number(), W::number(), H::number()) -> bound()
Creates bound with well-defined position and dimensions. Negative dimensions are not allowed.
Computes area covered by the intersection of two specified bounds. If these bounds have no intersection, the result will be 0.
Returns new bound containing each one of specified bounds. The resulting bound is optimal one in terms of area.
upperright(X1::bound()) -> {number(), number()}
Returns coordinates of the upper right point of a bound.
x1(X1::bound()) -> number()
Returns lower coordinate of a bound on the X axis.
x2(X1::bound()) -> number()
Returns upper coordinate of a bound on the X axis.
y1(X1::bound()) -> number()
Returns lower coordinate of a bound on the Y axis.
y2(X1::bound()) -> number()
Returns upper coordinate of a bound on the Y axis.