Skip to content

Commit

Permalink
Add LineSegment2d.intersectionWithAxis documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
ianmackenzie committed Aug 22, 2018
1 parent 0c19da9 commit 9af2d12
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/LineSegment2d.elm
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,23 @@ intersectionPoint lineSegment1 lineSegment2 =
Nothing


{-| Attempt to find the unique intersection point of a line segment with an
axis. If there is no such point (the line segment does not touch the axis, or
lies perfectly along it), returns `Nothing`.
lineSegment =
LineSegment2d.fromEndpoints
( Point2d.fromCoordinates ( 1, -1 )
, Point2d.fromCoordinates ( 4, 1 )
)
LineSegment2d.intersectionWithAxis Axis2d.x lineSegment
--> Just (Point2d.fromCoordinates ( 2.5, 0 ))
LineSegment2d.intersectionWithAxis Axis2d.y lineSegment
--> Nothing
-}
intersectionWithAxis : Axis2d -> LineSegment2d -> Maybe Point2d
intersectionWithAxis axis lineSegment =
let
Expand Down

0 comments on commit 9af2d12

Please sign in to comment.