package gg

  1. Overview
  2. Docs

Module Gg.Box1Source

1D axis-aligned boxes.

Sourcetype t = box1

The type for 1D boxes (closed intervals).

Sourceval dim : int

dim is the dimension of the boxes of type box2.

Sourcetype v = float

The type for 1D vectors.

Sourcetype p = float

The type for 1D points.

Sourcetype size = size1

The type for 1D sizes.

Sourcetype m = float

The type for matrices representing linear transformations of 1D space.

Constructors, accessors and constants

Sourceval v : float -> size1 -> box1

v o size is a box whose origin is o and size is size.

Sourceval v_mid : float -> size1 -> box1

v_mid mid size is a box whose mid point is mid and size is size.

Sourceval empty : box1

empty is the empty box.

Sourceval o : box1 -> float

o b is the origin of b.

Raises Invalid_argument on empty

Sourceval ox : box1 -> float

ox b is o b.

Sourceval size : box1 -> size1

size b is the size of b.

Raises Invalid_argument on empty

Sourceval w : box1 -> float

w b is size b.

Sourceval zero : box1

zero is a box whose origin and size is zero.

Sourceval unit : box1

unit is the unit box which extends from zero to one in all dimensions.

Sourceval of_pts : float -> float -> box1

of_pts p p' is the smallest box whose space contains p and p'.

Sourceval add_pt : box1 -> float -> box1

add_pt b p is the smallest box whose space contains b and p.

Functions

Sourceval min : box1 -> float

min b is the smallest point of b (its origin).

Raises Invalid_argument on empty

Sourceval minx : box1 -> float

minx b is min b.

Sourceval max : box1 -> float

max b is the greatest point of b (its size added to the origin).

Raises Invalid_argument on empty

Sourceval maxx : box1 -> float

maxx b is max b.

Sourceval mid : box1 -> float

mid b is the mid point between min and max.

Raises Invalid_argument on empty

Sourceval midx : box1 -> float

midx b is mid b.

Sourceval left : box1 -> float

left b is minx b.

Sourceval right : box1 -> float

right b is maxx b.

Sourceval area : box1 -> float

area b is the surface area of b.

Sourceval inter : box1 -> box1 -> box1

inter b b' is a box whose space is the intersection of S(b) and S(b').

Sourceval union : box1 -> box1 -> box1

union b b' is the smallest box whose space contains S(b) and S(b').

Sourceval inset : float -> box1 -> box1

inset d b is b whose edges are inset in each dimension according to amounts in d. Negative values in d outset. If the size in dimension i becomes negative it is clamped to 0 and the ith coordinate of the mid point of b is used for the ith coordinate of the resulting box's origin. Returns empty on empty.

Sourceval round : box1 -> box1

round b is the smallest box containing b with integer valued corners. Returns empty on empty.

Sourceval move : float -> box1 -> box1

move d b is b translated by d. Returns empty on empty.

Sourceval ltr : float -> box1 -> box1

ltr m b is the smallest box containing the corners of b transformed by m. Returns empty on empty.

Sourceval tr : m2 -> box1 -> box1

tr m b is the smallest box containing the corners of b transformed by m in homogenous 1D space. Returns empty on empty.

Sourceval map_f : (float -> float) -> box1 -> box1

map_f f b is the box whose origin and size are those of b with their components mapped by f. Returns empty on empty.

Predicates and comparisons

Sourceval is_empty : box1 -> bool

is_empty b is true iff b is empty.

Sourceval is_pt : box1 -> bool

is_pt b is true iff b is not empty and its size is equal to 0 in every dimension.

Sourceval isects : box1 -> box1 -> bool

isects b b' is not (is_empty (inter b b')).

Sourceval subset : box1 -> box1 -> bool

subset b b' is true iff S(b) is included in S(b').

Sourceval mem : float -> box1 -> bool

mem p b is true iff p is in S(b).

Sourceval equal : box1 -> box1 -> bool

equal b b' is b = b'.

Sourceval equal_f : (float -> float -> bool) -> box1 -> box1 -> bool

equal_f eq b b' tests b and b' like equal but uses eq to test floating point values.

Sourceval compare : box1 -> box1 -> int

compare u v is Stdlib.compare u v.

Sourceval compare_f : (float -> float -> int) -> box1 -> box1 -> int

compare_f cmp b b' compares b and b' like compare but uses cmp to compare floating point values.

Formatters

Sourceval pp : Format.formatter -> box1 -> unit

pp ppf b prints a textual representation of b on ppf.

Sourceval pp_f : (Format.formatter -> float -> unit) -> Format.formatter -> box1 -> unit

pp_f pp_fl ppf b prints b like pp but uses pp_fl to print floating point values.