Skip to content

Commit

Permalink
steps connected
Browse files Browse the repository at this point in the history
  • Loading branch information
PiotrJustyna committed Feb 26, 2024
1 parent 1b5c049 commit 5d43078
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 19 deletions.
26 changes: 15 additions & 11 deletions HelloWorld.lhs
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,21 @@
> vectorShape :: Diagram B
> vectorShape = fromOffsets . map r2 $ [(0,0), (1,1), (-2,1), (-1,-4)]
>
> step :: Diagram B
> step = fromOffsets
> stepsOrigins :: [Point V2 Double]
> stepsOrigins = map p2 $ [(x, y) | x <- [0], y <- [0, (-1), (-2)]]
>
> step :: Int -> Diagram B
> step x = fromOffsets
> [V2 0 0,
> V2 0 0.25,
> V2 0.5 0,
> V2 0 (-0.25),
> V2 (-0.5) 0]
> # lw veryThin
> V2 0 0.5,
> V2 0.75 0,
> V2 0 (-0.5),
> V2 (-0.75) 0]
> # showOrigin
> # lw veryThin
> # named x
>
> drakonPoints :: [Point V2 Double]
> drakonPoints = map p2 $ [(x, y) | x <- [0..5], y <- [0..5]]
>
> main = mainWith $ atPoints drakonPoints (repeat step)
> main = mainWith $
> atPoints stepsOrigins [step x | x <- [0..]]
> # connectOutside (0 :: Int) (1 :: Int)
> # connectOutside (1 :: Int) (2 :: Int)
7 changes: 0 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,3 @@
* [literate programming](https://wiki.haskell.org/Literate_programming)
* [drakon](https://drakonhub.com/read/docs)
* [diagrams](https://archives.haskell.org/projects.haskell.org/diagrams/doc/quickstart.html#introduction)
* diagrams operators:
* `(#)` - `x # f = f x`
* `(|||)` - combine two diagrams horizontally
* `hcat` - combine a list of diagrams horizontally
* `===` - combine two diagrams vertically
* `vcat` - combine a list of diagrams vertically
* `atop` - combine diagrams atop each other
Loading

0 comments on commit 5d43078

Please sign in to comment.