A Vector2d represents a quantity such as a displacement or velocity in 2D, and
is defined by its X and Y components. This module contains a variety of
vector-related functionality, such as
Note that unlike in many other geometry packages where vectors are used as a
general-purpose data type, elm-geometry has separate data types for vectors,
directions and points. In most code it is actually more common to use Point2d
and Direction2d than Vector2d, and much code can avoid working directly with
Vector2d values at all!
Although there are no predefined constants for the vectors with components
(1, 0) and (0, 1), in most cases you will actually want their
Direction2d versions Direction2d.x and Direction2d.y.
Note that for mirrorAcross and projectOnto, only the direction of the axis
affects the result, since vectors are position-independent. Think of
mirroring/projecting a vector across/onto an axis as moving the vector so its
tail is on the axis, then mirroring/projecting its tip across/onto the axis.
Like other transformations, coordinate conversions of vectors depend only on the orientations of the relevant frames, not the positions of their origin points.