Skip to content

Commit

Permalink
Merge pull request #132 from mmachenry/bugfix-getDist2-polygon
Browse files Browse the repository at this point in the history
Reorder getDist2 pattern match to allow it to reach currently dead code.
  • Loading branch information
mmachenry committed Aug 9, 2015
2 parents efb439c + 5e74579 commit 07aa678
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Graphics/Implicit/ObjectUtil/GetBox2.hs
Expand Up @@ -116,11 +116,11 @@ getDist2 p (Translate2 v obj) = getDist2 (p ^+^ v) obj

getDist2 p (Circle r) = magnitude p + r

getDist2 p (PolygonR r points) =
r + maximum [magnitude (p ^-^ p') | p' <- points]

getDist2 (x,y) symbObj =
let
((x1,y1), (x2,y2)) = getBox2 symbObj
in
sqrt ((max (abs (x1 - x)) (abs (x2 - x)))^2 + (max (abs (y1 - y)) (abs (y2 - y)))^2)

getDist2 p (PolygonR r points) =
r + maximum [magnitude (p ^-^ p') | p' <- points]

0 comments on commit 07aa678

Please sign in to comment.