import Control.Monad (replicateM_)
import Diagrams.Prelude
import Diagrams.TwoD.Path.Turtle
import Text.Groom
main = putStrLn . groom $ mount 7 10
f d = forward (72 * d / 6)
r = right 90
draw p = sketchTurtle $ do
setPenWidth 0.1
p
closeCurrent
mount w h = draw $ replicateM_ 2 $ do
f (fromIntegral w * 6 + 1) ; r
f (fromIntegral h * 6 + 1) ; r
produces this output:
Path{pathTrails =
[Loc{loc = P (0.0 & 0.0),
obj =
Trail
(Loop
(SegTree{getSegTree =
fromList
[Linear (OffsetClosed (516.0 & 0.0)),
Linear (OffsetClosed (4.482207284879313e-14 & (-732.0))),
Linear (OffsetClosed ((-516.0) & (-6.319177483600342e-14))),
Linear (OffsetClosed ((-1.3446621854637937e-13) & 732.0))]})
(Linear OffsetOpen))},
Loc{loc = P (0.0 & 0.0),
obj =
Trail
(Line
(SegTree{getSegTree =
fromList
[Linear (OffsetClosed (516.0 & 0.0)),
Linear (OffsetClosed (4.482207284879313e-14 & (-732.0))),
Linear (OffsetClosed ((-516.0) & (-6.319177483600342e-14))),
Linear (OffsetClosed ((-1.3446621854637937e-13) & 732.0))]}))}]}
As you can see this consists of a line and a loop tracing the same path.
This code:
produces this output:
As you can see this consists of a line and a loop tracing the same path.