Skip to content

Commit

Permalink
Add link and change to convexHull
Browse files Browse the repository at this point in the history
  • Loading branch information
gampleman committed Jan 22, 2018
1 parent 2f56232 commit 00b6a0f
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ Matthieu Pizenberg <[email protected]> (intersections)
Folkert de Vries <[email protected]> (length parameterization)
Dan Fishgold <[email protected]> (interval sin/cos)
Felix Scheinost <[email protected]> (Sphere3d)
Jakub Hampl <[email protected]> (convex hull)
2 changes: 1 addition & 1 deletion media/src/ConvexHull.elm
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ view : Model -> Html Msg
view model =
let
convexHull =
Polygon2d.fromConvexHull model.points
Polygon2d.convexHull model.points
in
Html.div [ Html.Events.onClick Click ]
[ Svg.render2d renderBounds <|
Expand Down
9 changes: 5 additions & 4 deletions src/OpenSolid/Polygon2d.elm
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ module OpenSolid.Polygon2d
, clockwiseArea
, counterclockwiseArea
, edges
, fromConvexHull
, convexHull
, fromVertices
, mapVertices
, mirrorAcross
Expand Down Expand Up @@ -46,7 +46,7 @@ as
# Constructors
@docs fromVertices, fromConvexHull
@docs fromVertices, convexHull
# Properties
Expand Down Expand Up @@ -129,8 +129,9 @@ chain =

{-| Computes the [convex hull](https://en.wikipedia.org/wiki/Convex_hull) of a list of points. This is an O(n log n) operation.
-}
fromConvexHull : List Point2d -> Polygon2d
fromConvexHull points =
convexHull : List Point2d -> Polygon2d
convexHull points =
-- See http://www.algorithmist.com/index.php/Monotone_Chain_Convex_Hull for a description of the algorithm.
let
sorted =
points |> List.sortBy Point2d.coordinates
Expand Down
4 changes: 2 additions & 2 deletions tests/Polygon2d.elm
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ convexHullIsConvex =
(\points ->
let
convexHull =
Polygon2d.fromConvexHull points
Polygon2d.convexHull points

edgeVectors =
Polygon2d.edges convexHull |> List.map LineSegment2d.vector
Expand Down Expand Up @@ -66,7 +66,7 @@ convexHullContainsAllPoints =
(\points ->
let
convexHull =
Polygon2d.fromConvexHull points
Polygon2d.convexHull points

edges =
Polygon2d.edges convexHull
Expand Down

0 comments on commit 00b6a0f

Please sign in to comment.