Module scarlet::coord

source ·
Expand description

This module contains a struct, Coord, that models a 3D coordinate space and supports limited math in 3 dimensions with scalars and other coordinates. Used to unify math with colors that is the same, just with different projections into 3D space.

Structs

  • A point in 3D space. Supports many common arithmetic operations on points. Coord has three axes, denoted x, y, and z. These are not any different in any method of Coord, so the distinction between them is completely conventional. In Scarlet, any Color that converts to and from a Coord will match its components with these axes in the order of the letters in its name: for example, CIELABColor maps to a coordinate such that l is on the x-axis, a is on the y-axis, and b is on the z-axis.

Traits

  • Represents a scalar value that can be easily converted, described using the common numeric traits in num. Anything that falls under this category can be multiplied by a Coord to scale it. This has no added functionality: it’s just for convenience.