package gg

  1. Overview
  2. Docs

Sizes in 2D space.

In 2D space, width is the extent along the x-axis and height the extent along the y-axis.

type t = size2

The type for 2D sizes.

val dim : int

dim is the dimension of sizes of type size2.

Constructors, accessors and constants

val v : float -> float -> size2

v w h is a size of width w and height h.

val w : size2 -> float

w s is the width of s.

val h : size2 -> float

h s is the height of s.

val zero : size2

zero is the zero size, zero width and height.

val unit : size2

unit is the unit size, one width and height.

Functions

val aspect : size2 -> float

aspect s is w s /. h s.

val of_w : float -> aspect:float -> size2

of_w w aspect is v w (w /. aspect).

val of_h : float -> aspect:float -> size2

of_h h aspect is v (h *. aspect) h.