I want to make a rounded line with a width equal to the diameter of a circle. After much trial and error this seems to produce the wanted output.
import Diagrams.Prelude
import Diagrams.Backend.Cairo.CmdLine
main = mainWith example
path = fromVertices [p2 (0,0), p2 (3,0)] # lw 80
example :: Diagram B
example = atPoints [p2 (0,0)] n
<> (path # lineCap LineCapRound . lineJoin LineJoinRound)
<> atPoints [p2 (3,0)] n
<> square 10 # lw none # fc white
where
n =[circle 1 # fc green # lw none]
However it feels wrong. I would expect lw 2
to correspond to circle 1
because 2 is twice the radius, but certainly not lw 80
?!
Why does it work with 80?
Assumning I missed something, how does one make a rounded line as wide as a circle?