ianmackenzie/elm-geometry/1.0.0

NOTE: this package is not compatible with Elm 0.19.1

LineSegment2d

LineSegment2d

A LineSegment2d is a line between two points in 2D. This module contains functionality such as:

  • Interpolating within a line segment or measuring its length
  • Scaling, rotating, translating, mirroring or projecting a line segment
  • Converting a line segment between local and global coordinates in different reference frames
type alias LineSegment2d =
LineSegment2d

Constructors

fromEndpoints : ( Point2d, Point2d ) -> LineSegment2d
from : Point2d -> Point2d -> LineSegment2d
along : Axis2d -> Float -> Float -> LineSegment2d

Properties

startPoint : LineSegment2d -> Point2d
endPoint : LineSegment2d -> Point2d
endpoints : LineSegment2d -> ( Point2d, Point2d )
midpoint : LineSegment2d -> Point2d
length : LineSegment2d -> Float
squaredLength : LineSegment2d -> Float
direction : LineSegment2d -> Maybe Direction2d
perpendicularDirection : LineSegment2d -> Maybe Direction2d
vector : LineSegment2d -> Vector2d
boundingBox : LineSegment2d -> BoundingBox2d

Interpolation

interpolate : LineSegment2d -> Float -> Point2d

Intersection

intersectionPoint : LineSegment2d -> LineSegment2d -> Maybe Point2d

Transformations

Transforming a line segment is equivalent to transforming its start and end points and forming a new line segment between the resulting points.

reverse : LineSegment2d -> LineSegment2d
scaleAbout : Point2d -> Float -> LineSegment2d -> LineSegment2d
rotateAround : Point2d -> Float -> LineSegment2d -> LineSegment2d
translateBy : Vector2d -> LineSegment2d -> LineSegment2d
translateIn : Direction2d -> Float -> LineSegment2d -> LineSegment2d
mirrorAcross : Axis2d -> LineSegment2d -> LineSegment2d
projectOnto : Axis2d -> LineSegment2d -> LineSegment2d
mapEndpoints : (Point2d -> Point2d) -> LineSegment2d -> LineSegment2d

Coordinate conversions

relativeTo : Frame2d -> LineSegment2d -> LineSegment2d
placeIn : Frame2d -> LineSegment2d -> LineSegment2d