Fix circle rendering, add filled circle
Make raster circle rendering use the Rasterific package instead of attempting desperately to hand-roll it, and add a method for generating filled circles.
This commit is contained in:
parent
1351691136
commit
6f427fe4d6
5 changed files with 124 additions and 52 deletions
|
|
@ -15,19 +15,26 @@ test = testGroup "Xanthous.Util.Graphics"
|
|||
[ testGroup "circle"
|
||||
[ testCase "radius 12, origin 0"
|
||||
$ (sort . unique @[] @[_]) (circle @Int (0, 0) 12)
|
||||
@?= (sort . unique) (
|
||||
let quadrant =
|
||||
[ (0, 12) , (1, 12) , (2, 12) , (3, 12)
|
||||
, (4, 12) , (5, 11) , (6, 11) , (7, 10)
|
||||
, (8, 9) , (9, 9) , (9, 8) , (10, 7)
|
||||
, (11, 6) , (11, 5) , (12, 4) , (12, 3)
|
||||
, (12, 2) , (12, 1) , (12, 0)
|
||||
]
|
||||
in quadrant
|
||||
<> (quadrant <&> _1 %~ negate)
|
||||
<> (quadrant <&> _2 %~ negate)
|
||||
<> (quadrant <&> both %~ negate)
|
||||
)
|
||||
@?= [ (1,12)
|
||||
, (2,12)
|
||||
, (3,12)
|
||||
, (4,12)
|
||||
, (5,12)
|
||||
, (6,11)
|
||||
, (7,10)
|
||||
, (7,11)
|
||||
, (8,10)
|
||||
, (9,9)
|
||||
, (10,7)
|
||||
, (10,8)
|
||||
, (11,6)
|
||||
, (11,7)
|
||||
, (12,1)
|
||||
, (12,2)
|
||||
, (12,3)
|
||||
, (12,4)
|
||||
, (12,5)
|
||||
]
|
||||
]
|
||||
|
||||
, testGroup "line"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue