Skip to content
geometry

geometry

Mojo module 🡭

geometry

Geometric types shared by the primitives that take more than a single (x, y) pair.

Two point types, because the package rasterizes at two precisions. Point is whole pixels, what the hard-edged primitives address. FPoint is sub-pixel, what the anti-aliased ones need: an edge crossing a pixel at x = 10.4 has to stay at 10.4 all the way to the coverage sweep.

FPoint lives here rather than in path.mojo, which still re-exports it, because canvas.shapes.arcs samples arcs at sub-pixel precision too and path.mojo imports from arcs, so the shared type has to sit below both.

Structs

  • Point: An integer 2D coordinate.
  • FPoint: A floating-point 2D coordinate: the sub-pixel counterpart of Point, and what every anti-aliased path/arc sampler carries through to the coverage sweep.
  • Transform2D: An affine map from continuous data-space coordinates to integer pixel-space coordinates: scale, then rotate, then translate.
  • Matrix2D: A general affine map of the plane.

Functions