A Length represents a length in meters, feet, centimeters, miles etc. It
is stored as a number of meters.
Construct a length from a number of meters.
height : Length
height =
Length.meters 2Convert a length to a number of meters.
Length.feet 1 |> Length.inMeters
--> 0.3048Construct a length from a number of angstroms.
Length.angstroms 1
--> Length.meters 1e-10Convert a length to a number of angstroms.
Length.nanometers 1 |> Length.inAngstroms
--> 10Construct a length from a number of nanometers.
Length.nanometers 1
--> Length.meters 1e-9Convert a length to a number of nanometers.
Length.microns 1 |> Length.inNanometers
--> 1000Construct a length from a number of microns (micrometers).
Length.microns 1
--> Length.meters 1e-6Convert a length to a number of microns (micrometers).
Length.millimeters 1 |> Length.inMicrons
--> 1000Construct a length from number of millimeters.
Convert a length to number of millimeters.
Construct a length from a number of centimeters.
Convert a length to a number of centimeters.
Construct a length from a number of kilometers.
Convert a length to a number of kilometers.
Construct a length from a number of thou (thousandths of an inch).
Length.thou 5
--> Length.inches 0.005Convert a length to a number of thou (thousandths of an inch).
Length.millimeters 1 |> Length.inThou
--> 39.37007874015748Construct a length from a number of inches.
Convert a length to a number of inches.
Construct a length from a number of feet.
Convert a length to a number of feet.
Construct a length from a number of yards.
Convert a length to a number of yards.
Construct a length from a number of miles.
Convert a length to a number of miles.
Construct a length from a number of CSS pixels, defined as 1/96 of an inch.
Note the difference between this function and Pixels.pixels.
Length.cssPixels 1 is equivalent to Length.inches (1 / 96) or
approximately Length.millimeters 0.264583; it returns a length in real world
units equal to the (nominal) physical size of one CSS pixel.
In contrast, Pixels.pixels 1 simply returns an abstract "1 pixel" value. You
can think of Length.cssPixels 1 as a shorthand for
Pixels.pixels 1
|> Quantity.at_
(Pixels.pixels 96
|> Quantity.per (Length.inches 1)
)That is, Length.cssPixels 1 is the size of 1 pixel at a resolution of 96 DPI.
Convert a length to a number of CSS pixels.
Convert a length to a number of points.
Convert a length to a number of picas.
Construct a length from a number of astronomical units (AU). One AU is approximately equal to the average distance of the Earth from the Sun.
Convert a length to a number of astronomical units.
Convert a length to a number of parsecs.
Construct a length from a number of light years. One light year is the distance traveled when moving at the speed of light for one Julian year.
Convert a length to a number of light years.
Shorthand for Length.meters 1, Length.feet 1 etc. Can be convenient to use
with Quantity.per.
Note that thou is omitted since it doesn't have separate singular and plural
forms.