PenroseKiteDart-1.0.0 Package Release

41 views
Skip to first unread message

rea...@googlemail.com

unread,
Apr 9, 2024, 5:59:41 AM4/9/24
to diagrams-discuss
This is a Haskell  library for exploring Penrose's Kite and Dart tilings using Haskell Diagrams to draw the tilings.

It is now available on Hackage.

Chris Reade

Brent Yorgey

unread,
Apr 10, 2024, 10:54:39 AM4/10/24
to rea...@googlemail.com, diagrams-discuss
Cool!  Thanks for sharing!

--
You received this message because you are subscribed to the Google Groups "diagrams-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to diagrams-discu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/diagrams-discuss/ac41c4e2-14c7-43c6-a34a-bef77f1a5786n%40googlegroups.com.
Message has been deleted

rea...@googlemail.com

unread,
Apr 11, 2024, 12:04:32 PM4/11/24
to diagrams-discuss
I have a small art gallery https://github.com/chrisreade/PenroseKiteDart/tree/master/SVGs/ArtGallery
for PenroseKiteDart but the examples obviously require PenroseKiteDart as well as Diagrams (so maybe not suitable for the Diagrams gallery).

Anyway, here is a single sample with code  (using PKD and TgraphExamples from PenroseKiteDart)
-----
module Main (main) where
   
import Diagrams.Prelude
import Diagrams.Backend.SVG.CmdLine

-- From PenroseKiteDart package
import PKD(Tgraph,decompose,force,makeVP,colourDKG,subVP,faces)
import TgraphExamples(queenGraph)

-- Given a Tgraph, produce 7 layers, 6 by iterating (decompose . force) then a final force for the seventh.
-- Draw each layer with colourDKG and finer and finer line widths,
-- then overlay with mconcat for a final diagram.
nested :: Tgraph -> Diagram B
nested g =
  mconcat $ zipWith ($)
    [id, id, id, lw thin, lw veryThin, lw ultraThin, lw ultraThin]
    layers
  where
    graphs = iterate  (decompose . force) g
    finalgraph = force $ graphs !! 6
    vp = rotate (162@@deg) $ makeVP finalgraph
    layers = fmap (colourDKG (darkmagenta, indigo, gold) . subVP vp . faces) $
             take 6 graphs ++ [finalgraph]
       
fig::Diagram B
fig =  nested queenGraph

main :: IO ()
main = mainWith fig



nestedQueen.pdf

rea...@googlemail.com

unread,
Oct 2, 2024, 9:50:03 AM10/2/24
to diagrams-discuss
Version 1.1 of PenroseKiteDart is now available on Hackage
and the art gallery is now at https://github.com/chrisreade/PenroseKiteDart/tree/master/ArtGallery

The only significant change to the library is a simplification of some types using a class synonym
(see reason and details below).
---------
The library (built on Diagrams) needs to keep the choice of Backend open for users.
Previously this required various context constraints for types where a Backend b was involved.
In version 1.1 I have decided to use a (fallow) class synonym for a
collection of constraints that are sufficient for all the drawing tools.

class (V b ~ V2, N b ~ Double, Renderable (Path V2 Double) b, Renderable (Text Double) b) =>
      OKBackend b where {}

Now any types in the library involving a Backend b can simply use the context

 OKBackend b =>

which makes for much easier reading. The downside is that
in order for the user not to need to write 

instance OKBackend B

we need Undecidable instances enabled to declare

instance (V b ~ V2, N b ~ Double, Renderable (Path V2 Double) b, Renderable (Text Double) b) =>
         OKBackend b where {}
-----------

Reply all
Reply to author
Forward
0 new messages