ianmackenzie/elm-geometry/1.0.0

NOTE: this package is not compatible with Elm 0.19.1

Direction3d

Direction3d

A Direction3d represents a direction like 'up' or 'north' or 'forwards'. They are represented using X, Y and Z components, and can be converted to vectors if necessary, but should be thought of as conceptually different. Directions have several uses, such as:

  • Constructing a vector from a length and direction
  • Determining the component of a vector in a particular direction (for example, finding the component of velocity in the up direction to get vertical speed)
  • Determining the angle between two directions
  • Defining the orientation of an axis, plane or reference frame
type alias Direction3d =
Direction3d

Constants

x : Direction3d
y : Direction3d
z : Direction3d
positiveX : Direction3d
negativeX : Direction3d
positiveY : Direction3d
negativeY : Direction3d
positiveZ : Direction3d
negativeZ : Direction3d

Constructors

from : Point3d -> Point3d -> Maybe Direction3d
on : SketchPlane3d -> Direction2d -> Direction3d
fromAzimuthAndElevation : Float -> Float -> Direction3d
perpendicularTo : Direction3d -> Direction3d
perpendicularBasis : Direction3d -> ( Direction3d, Direction3d )
Vector3d
-> Vector3d
-> Vector3d
-> Maybe ( Direction3d, Direction3d, Direction3d )
Direction3d
-> Direction3d
-> Direction3d
-> Maybe ( Direction3d, Direction3d, Direction3d )
unsafe : ( Float, Float, Float ) -> Direction3d

Properties

components : Direction3d -> ( Float, Float, Float )
xComponent : Direction3d -> Float
yComponent : Direction3d -> Float
zComponent : Direction3d -> Float
azimuth : Direction3d -> Float
elevation : Direction3d -> Float

Comparison

equalWithin : Float -> Direction3d -> Direction3d -> Bool

Measurement

componentIn : Direction3d -> Direction3d -> Float
angleFrom : Direction3d -> Direction3d -> Float

Conversion

toVector : Direction3d -> Vector3d

Transformations

reverse : Direction3d -> Direction3d
rotateAround : Axis3d -> Float -> Direction3d -> Direction3d
mirrorAcross : Plane3d -> Direction3d -> Direction3d
projectOnto : Plane3d -> Direction3d -> Maybe Direction3d

Coordinate conversions

Like other transformations, coordinate transformations of directions depend only on the orientations of the relevant frames, not their positions.

relativeTo : Frame3d -> Direction3d -> Direction3d
placeIn : Frame3d -> Direction3d -> Direction3d
projectInto : SketchPlane3d -> Direction3d -> Maybe Direction2d