A Length
represents a length in meters, feet, centimeters, miles etc. It
is stored as a number of meters.
Length
Length.Meters
meters : Basics.Float -> Length
Construct a length from a number of meters.
height : Length
height =
Length.meters 2
inMeters : Length -> Basics.Float
Convert a length to a number of meters.
Length.feet 1 |> Length.inMeters
--> 0.3048
angstroms : Basics.Float -> Length
Construct a length from a number of angstroms.
Length.angstroms 1
--> Length.meters 1e-10
inAngstroms : Length -> Basics.Float
Convert a length to a number of angstroms.
Length.nanometers 1 |> Length.inAngstroms
--> 10
nanometers : Basics.Float -> Length
Construct a length from a number of nanometers.
Length.nanometers 1
--> Length.meters 1e-9
inNanometers : Length -> Basics.Float
Convert a length to a number of nanometers.
Length.microns 1 |> Length.inNanometers
--> 1000
microns : Basics.Float -> Length
Construct a length from a number of microns (micrometers).
Length.microns 1
--> Length.meters 1e-6
inMicrons : Length -> Basics.Float
Convert a length to a number of microns (micrometers).
Length.millimeters 1 |> Length.inMicrons
--> 1000
millimeters : Basics.Float -> Length
Construct a length from number of millimeters.
inMillimeters : Length -> Basics.Float
Convert a length to number of millimeters.
centimeters : Basics.Float -> Length
Construct a length from a number of centimeters.
inCentimeters : Length -> Basics.Float
Convert a length to a number of centimeters.
kilometers : Basics.Float -> Length
Construct a length from a number of kilometers.
inKilometers : Length -> Basics.Float
Convert a length to a number of kilometers.
thou : Basics.Float -> Length
Construct a length from a number of thou (thousandths of an inch).
Length.thou 5
--> Length.inches 0.005
inThou : Length -> Basics.Float
Convert a length to a number of thou (thousandths of an inch).
Length.millimeters 1 |> Length.inThou
--> 39.37007874015748
inches : Basics.Float -> Length
Construct a length from a number of inches.
inInches : Length -> Basics.Float
Convert a length to a number of inches.
feet : Basics.Float -> Length
Construct a length from a number of feet.
inFeet : Length -> Basics.Float
Convert a length to a number of feet.
yards : Basics.Float -> Length
Construct a length from a number of yards.
inYards : Length -> Basics.Float
Convert a length to a number of yards.
miles : Basics.Float -> Length
Construct a length from a number of miles.
inMiles : Length -> Basics.Float
Convert a length to a number of miles.
cssPixels : Basics.Float -> Length
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.
inCssPixels : Length -> Basics.Float
Convert a length to a number of CSS pixels.
points : Basics.Float -> Length
Construct a length from a number of points, defined as 1/72 of an inch.
inPoints : Length -> Basics.Float
Convert a length to a number of points.
picas : Basics.Float -> Length
Construct a length from a number of picas, defined as 1/6 of an inch.
inPicas : Length -> Basics.Float
Convert a length to a number of picas.
astronomicalUnits : Basics.Float -> Length
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.
inAstronomicalUnits : Length -> Basics.Float
Convert a length to a number of astronomical units.
parsecs : Basics.Float -> Length
Construct a length from a number of parsecs.
inParsecs : Length -> Basics.Float
Convert a length to a number of parsecs.
lightYears : Basics.Float -> Length
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.
inLightYears : Length -> Basics.Float
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.
meter : Length
angstrom : Length
nanometer : Length
micron : Length
millimeter : Length
centimeter : Length
kilometer : Length
inch : Length
foot : Length
yard : Length
mile : Length
astronomicalUnit : Length
parsec : Length
lightYear : Length