Module Hugin_gg_kit
Planar geometry.
The kit computes shapes of the plane, below rendering. Ring2 holds closed polygonal curves and Pgon2 the polygons they bound. Field2 samples a scalar field on a grid, read from an nx tensor, and gives its isolines as paths and its isobands as polygons with holes. Rings and polygons convert to Hugin_gg.Path.t for drawing.
Conventions
- The plane is that of
hugin.gg: the x axis points right and the y axis down. Coordinates are in the caller's units. - Orientation. A closed curve is positively oriented if it turns like positive angles, from the positive x axis towards the positive y axis: clockwise on screen, counterclockwise in a frame whose y axis points up. Walking along a positively oriented curve that does not cross itself, the region it encloses is on the right on screen. The winding number of a closed curve around a point off it is the number of times the curve turns around the point, counted positively in that direction. The signed area of closed curves is the integral of their winding number over the plane: for one curve that does not cross itself, the area it encloses, positive or negative with its orientation.
- Surfaces. The surface of a polygon is the set of points around which its rings wind a non-zero number of times: the nonzero fill rule of the renderers. Outer boundaries are positively oriented and holes negatively, so a hole's winding cancels its outer boundary's. A polygon's path filled with the nonzero rule paints its surface.
- Argument order, equality and printing follow
hugin.gg: the value a function reads or transforms comes last, except that indexed reads take the value first, asArray.getdoes;equalcompares structure with floats compared byFloat.equal; andppoutput is for debugging and may change between releases. - Errors. Functions raise
Invalid_argumentonly on arguments that are programming errors, as each states.