Module traits

Source
Expand description

Common traits for geometrical objects.

Traits§

Area
Calculate the area of a geometry.
BoundingBox
Calculation of the ‘bounding box’, i.e. the smallest rectangle that contains the geometrical object.
DoubledOrientedArea
Calculate the doubled oriented area of a geometry. Using the doubled area allows to compute the area without using fractions. This is especially helpful when computing in integer coordinates.
MapPointwise
Transform the geometrical object by transforming each point of it.
Mirror
Mirror at the x or y axis.
RotateOrtho
Rotate by a integer multiple of 90 degrees.
Scale
Scale the geometrical shape. Scaling center is the origin (0, 0).
Translate
Translate the geometrical object by a vector.
TryBoundingBox
Try the calculation of the ‘bounding box’, i.e. the smallest rectangle that contains the geometrical object. In some cases this is not always possible, so the try might fail. For instance a set of polygons does not have a bounding box if the set is empty.
TryCastCoord
This trait defines the type-casting of the coordinate types for geometrical objects.
TryIntoBoundingBox
Try to compute the bounding box while consuming the data. This is intended to be used for computing bounding boxes over iterators.
WindingNumber
Compute the winding number of a geometrical object around a point. The winding number is used to check if a point is contained in a shape.