Module Hugin_gg_kit.Ring2
Linear rings.
A ring is a closed polygonal curve: points in order, each joined to the next by a straight segment and the last to the first. A ring may cross or touch itself. A ring of fewer than three points encloses nothing: its winding number is 0 around every point off it. Orientation, winding numbers and signed areas follow the conventions. Rings store their coordinates in two float arrays, without a block per point.
Types
type tThe type for rings. Invariant: coordinates are finite.
Constructors
v xs ys is the ring through the points (xs.(i), ys.(i)) in order. The arrays are copied.
Raises Invalid_argument if xs and ys differ in length or a coordinate is not finite.
Accessors
Functions that take a point index raise Invalid_argument if it is not in [0;length r - 1].
Measures
area r is the signed area of r, computed with rounding: positive if r is positively oriented and negative if negatively, unless the area is within rounding error of zero, and 0. if r has fewer than three points. It overflows to an infinity or NaN if r spans more than about 10154.
val bounds : t -> Hugin_gg.Box2.t optionbounds r is the smallest box containing the points of r, or None if r has no point.
Transforming and converting
reverse r is r with its points in reverse order: point i of reverse r is point length r - 1 - i of r. Its orientation, signed area and winding numbers are those of r negated.
val to_path : t -> Hugin_gg.Path.tto_path r is the closed subpath through the points of r in order, Hugin_gg.Path.polygon of its coordinates. It is Hugin_gg.Path.empty if r has fewer than two points.
Comparing and formatting
equal r r' is true iff r and r' have equal points in the same order from the same first point. A ring and its rotation, which draw the same curve, are not equal.