Skip to content

Instantly share code, notes, and snippets.

@LukaHorvat
Created October 18, 2015 22:21
Show Gist options
  • Save LukaHorvat/e7a989b38b74cb0aa96f to your computer and use it in GitHub Desktop.
Save LukaHorvat/e7a989b38b74cb0aa96f to your computer and use it in GitHub Desktop.
Diag.hs
box :: Bool -> Angle Double -> Diagram SVG
box on angle = ((square (sqrt 2) `clipTo` rotate angle pattern) <> base) # lwO 1.5
where base = square (sqrt 2) # fc (if on then peachpuff else turquoise)
chromosome :: [Bool] -> Angle Double -> Diagram SVG
chromosome list angle = hcat $ map (pad 1.1 . (`box` angle)) list
first :: Diagram SVG
first = chromosome [True, False, True] (1/8 @@ turn)
||| padX 1.3 (chromosome [True, False] (1/8 @@ turn))
second :: Diagram SVG
second = chromosome [True, True, False] (3/8 @@ turn)
||| padX 1.3 (chromosome [False, False] (3/8 @@ turn))
child :: Diagram SVG
child = chromosome [True, False, True] (1/8 @@ turn)
||| padX 1.3 (chromosome [False, False] (3/8 @@ turn))
jednaTocka :: Diagram SVG
jednaTocka = vcat $ map (pad 1.1) [center first, plus, center second, padY 1.3 equal, center child]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment