Skip to content

Commit 12cc693

Browse files
committed
Refactor centerLine
1 parent 50a55e3 commit 12cc693

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/Geometry/Core.hs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1204,10 +1204,11 @@ resizeLineSymmetric f line@(Line start end) = (centerLine . resizeLine f . trans
12041204
--
12051205
-- Useful for painting lines going through a point symmetrically.
12061206
centerLine :: Line -> Line
1207-
centerLine line@(Line start end) = transform (translate delta) line
1208-
where
1209-
middle = 0.5 *. (start +. end)
1210-
delta = start -. middle
1207+
centerLine (Line start end) =
1208+
let middle = 0.5 *. (start +. end)
1209+
end' = middle
1210+
start' = start -. end +. middle
1211+
in Line start' end'
12111212

12121213
-- | Move the end point of the line so that it has length 1.
12131214
normalizeLine :: Line -> Line

0 commit comments

Comments
 (0)