github ↗
docs menu

Module Hugin_gg_kit.Pgon2

Polygons.

A polygon is a list of Ring2 rings. Its surface is the set of points around which the rings together wind a non-zero number of times, as the conventions state. Outer boundaries are positively oriented and holes negatively: a square with a hole is a positively oriented square and, inside it, a negatively oriented ring. Field2.isoband returns polygons of this form, whose rings neither cross nor overlap.

Types

#type t

The type for polygons.

Constructors

#val v : Ring2.t list -> t

v rs is the polygon of the rings rs, in order.

Accessors

#val rings : t -> Ring2.t list

rings p is the rings of p, in order.

Measures

#val area : t -> float

area p is the signed area of the rings of p, the sum of their Ring2.areas. It is the area of the surface of p, up to rounding, when the rings of p wind 0 or 1 times around every point off them, as those of Field2.isoband do.

#val bounds : t -> Hugin_gg.Box2.t option

bounds p is the smallest box containing the points of the rings of p, or None if they have no point.

Converting

#val to_path : t -> Hugin_gg.Path.t

to_path p is the subpaths Ring2.to_path gives for the rings of p, in order. Filled with the nonzero rule, it paints the surface of p.

Comparing and formatting

#val equal : t -> t -> bool

equal p p' is true iff p and p' have Ring2.equal rings in the same order.

#val pp : Stdlib.Format.formatter -> t -> unit

pp ppf p formats the rings of p in order as Ring2.pp does, separated by spaces.