ianmackenzie/elm-geometry/1.0.0

NOTE: this package is not compatible with Elm 0.19.1

Frame3d

Frame3d

A Frame3d has an origin point and a set of X, Y and Z directions (which are always perpendicular to each other). It can be thought of as:

  • A local coordinate system: Most geometric types have associated relativeTo and placeIn functions that convert values of that type from global coordinates to local coordinates in a particular frame, and vice versa.
  • A set of axes and planes: It is often convenient to (for example) rotate around the Z axis of a frame, or mirror across its XY plane. Frames can also themselves be translated, rotated and mirrored!
  • A combined 3D position and orientation: For example, a Frame3d could be used to define the position and orientation of a spaceship in a 3D game. Movement of the ship would then be done by translating and rotating the frame.
type alias Frame3d =
Frame3d

Constants

xyz : Frame3d

Constructors

The withXDirection, withYDirection and withZDirection functions all construct a new Frame3d with the given axis direction, having the given origin point. The other two directions will be chosen arbitrarily. This can be useful when constructing 'scratch' frames where (for example) you want a particular Z direction but the specific X/Y directions are unimportant.

No guarantees are given about the other two directions other than that the three directions will be mutually perpendicular, and will be oriented so that the resulting frame is right-handed.

withXDirection : Direction3d -> Point3d -> Frame3d
withYDirection : Direction3d -> Point3d -> Frame3d
withZDirection : Direction3d -> Point3d -> Frame3d
atPoint : Point3d -> Frame3d
atCoordinates : ( Float, Float, Float ) -> Frame3d
{ originPoint : Point3d
, xDirection : Direction3d
, yDirection : Direction3d
, zDirection : Direction3d
}
-> Frame3d

Properties

originPoint : Frame3d -> Point3d
xDirection : Frame3d -> Direction3d
yDirection : Frame3d -> Direction3d
zDirection : Frame3d -> Direction3d
isRightHanded : Frame3d -> Bool

Axes

xAxis : Frame3d -> Axis3d
yAxis : Frame3d -> Axis3d
zAxis : Frame3d -> Axis3d

Planes

The following functions all return planes with the same origin point as the given frame, but with varying normal directions. In each case the normal direction of the resulting plane is given by the cross product of the two indicated basis directions (assuming a right-handed frame).

xyPlane : Frame3d -> Plane3d
yxPlane : Frame3d -> Plane3d
yzPlane : Frame3d -> Plane3d
zyPlane : Frame3d -> Plane3d
zxPlane : Frame3d -> Plane3d
xzPlane : Frame3d -> Plane3d

Sketch planes

These functions all form a SketchPlane3d from two axes of the given frame. The X and Y axes of the sketch plane will correspond to the two indicated axes.

xySketchPlane : Frame3d -> SketchPlane3d
yxSketchPlane : Frame3d -> SketchPlane3d
yzSketchPlane : Frame3d -> SketchPlane3d
zySketchPlane : Frame3d -> SketchPlane3d
zxSketchPlane : Frame3d -> SketchPlane3d
xzSketchPlane : Frame3d -> SketchPlane3d

Transformations

reverseX : Frame3d -> Frame3d
reverseY : Frame3d -> Frame3d
reverseZ : Frame3d -> Frame3d
moveTo : Point3d -> Frame3d -> Frame3d
rotateAround : Axis3d -> Float -> Frame3d -> Frame3d
rotateAroundOwn : (Frame3d -> Axis3d) -> Float -> Frame3d -> Frame3d
translateBy : Vector3d -> Frame3d -> Frame3d
translateIn : Direction3d -> Float -> Frame3d -> Frame3d
translateAlongOwn : (Frame3d -> Axis3d) -> Float -> Frame3d -> Frame3d
mirrorAcross : Plane3d -> Frame3d -> Frame3d

Coordinate conversions

relativeTo : Frame3d -> Frame3d -> Frame3d
placeIn : Frame3d -> Frame3d -> Frame3d