line-drawing 0.2.0.0 → 0.3.0.0
raw patch · 4 files changed
+11/−1 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- changes.txt +6/−0
- line-drawing.cabal +1/−1
- src/Line/Draw.hs +1/−0
- test/Line/DrawSpec.hs +3/−0
changes.txt view
@@ -1,3 +1,9 @@+0.3.0.0+-------++- fixes "returns a singleton list if start and end are the same" bug.+- Released Sun 10 Nov 2019 15:31:24 CET.+ 0.2.0.0 -------
line-drawing.cabal view
@@ -1,6 +1,6 @@ cabal-version: >=1.10 name: line-drawing-version: 0.2.0.0+version: 0.3.0.0 synopsis: raster line drawing description: Line drawing algorithms to approximate a line segment on discrete graphical media (raster).
src/Line/Draw.hs view
@@ -33,6 +33,7 @@ -- <https://en.wikipedia.org/wiki/Bresenham%27s_line_algorithm Bresenham's algorithm>. bresenham :: Integral a => (a, a) -> (a, a) -> [(a, a)] bresenham x@(x1, y1) y@(x2, y2)+ | x == y = [x] | m1Check = bresenhamBase x y | otherwise = let x' = T.swap x y' = T.swap y
test/Line/DrawSpec.hs view
@@ -33,4 +33,7 @@ it "rasterises a line, quadrant 4, m>1" $ bresenham (0 :: Int, 0) (2, -4) `shouldBe` [(0,0), (0,-1), (1,-2), (1,-3), (2,-4)]+ it "returns a singleton list if start and end are the same" $+ bresenham (2 :: Int, 2) (2, 2) `shouldBe`+ [(2,2)]