# Module iron_shapes::traits [−][src]

## Expand description

Common traits for geometrical objects.

## Traits

Calculate the area of a geometry.

Calculation of the ‘bounding box’, i.e. the smallest rectangle that contains the geometrical object.

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.

Transform the geometrical object by transforming each point of it.

Mirror at the x or y axis.

Rotate by a integer multiple of 90 degrees.

Scale the geometrical shape. Scaling center is the origin `(0, 0)`

.

Translate the geometrical object by a vector.

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.

This trait defines the type-casting of the coordinate types for geometrical objects.

Try to compute the bounding box while consuming the data. This is intended to be used for computing bounding boxes over iterators.

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.