PenroseKiteDart-1.5: Library to explore Penrose's Kite and Dart Tilings.
Copyright(c) Chris Reade 2021
LicenseBSD-style
Maintainerchrisreade@mac.com
Stabilityexperimental
Safe HaskellNone
LanguageGHC2021

TileLibP3

Description

This module introduces Penrose's P3 tilings (narrow and wide rhombuses). It includes P3_HalfTiles, P3_Pieces and P3_Patches to represent and draw rhombuses plus conversion to and from Darts and Kites (the P2 tiles). A class P3_Drawable is introduced with instance P3_Patch, Patch, VPatch, Tgraph and generalised drawing functions for drawing P3 tilings.

Synopsis

P3_HalfTiles

data P3_HalfTile a Source #

Penrose P3 Tiling uses wide and narrow rhombuses These are split into half tiles (triangles) as with kites and darts

Constructors

LW a

Left Wide Rhombus

RW a

Right Wide Rhombus

LN a

Left Narrow Rhombus

RN a

Right Narrow Rhombus

Instances

Instances details
P3_Drawable P3_Patch Source #

A P3_Patch is P3_Drawable.

Instance details

Defined in TileLibP3

Functor P3_HalfTile Source #

Make P3_Halftile a Functor

Instance details

Defined in TileLibP3

Methods

fmap :: (a -> b) -> P3_HalfTile a -> P3_HalfTile b #

(<$) :: a -> P3_HalfTile b -> P3_HalfTile a #

Show a => Show (P3_HalfTile a) Source # 
Instance details

Defined in TileLibP3

Transformable a => Transformable (P3_HalfTile a) Source #

P3_HalfTile inherits Transformable - Requires FlexibleInstances

Instance details

Defined in TileLibP3

Eq a => Eq (P3_HalfTile a) Source # 
Instance details

Defined in TileLibP3

type N (P3_HalfTile a) Source #

Needed for Transformable instance of P3_HalfTile - requires TypeFamilies

Instance details

Defined in TileLibP3

type N (P3_HalfTile a) = N a
type V (P3_HalfTile a) Source #

Needed for Transformable instance of P3_HalfTile - requires TypeFamilies

Instance details

Defined in TileLibP3

type V (P3_HalfTile a) = V a

tileRepP3 :: P3_HalfTile a -> a Source #

tileRepP3 produces the representation without the label (LW,RW,LN,RN)

P3_Pieces

type P3_Piece = P3_HalfTile (V2 Double) Source #

A P3_Piece is a P3_Halftile with a vector along its join edge. The vector for a wide rhombus is on the long diagonal, and the vector for a narrow rhombus is along the short diagonal. The choice of which vertex is the origin is derived from conversions from Darts and Kites (P2 tilings)

Converting (located) Pieces

decompPieceP2toP3 :: Located Piece -> [Located P3_Piece] Source #

Converting from P2 to P3 tilings. Half darts become half wide rhombuses (LD->RW,RD->LW). (The new origin is the dart wing, and the new join is the dart long edge.) Half kites are decomposed to a half wide and a half narrow rhombus. (For wide rhombuses, the new origin is the kite origin and the join is the kite long edge.) (For narrow rhombuses, the new origin is the kite opp and the join is toward the kite origin.)

decompPieceP3toP2 :: Located P3_Piece -> [Located Piece] Source #

Converting from P3 to P2 tilings. Half narrow rhombuses become half kites (but the origin vertex and join edge are changed). Half wide rhombuses are decomposed to a half dart and a half kite.

Converting Patches

type P3_Patch = [Located P3_Piece] Source #

a P3_Patch is analagous to a Patch (but for for P3_Pieces)

decompP2toP3 :: Patch -> P3_Patch Source #

Conversion from a Patch to a P3_Patch (Kites and Darts to Rhombuses)

decompP3toP2 :: P3_Patch -> Patch Source #

Conversion from a P3_Patch to a Patch (Rhombuses to Kites and Darts) Note this does not reverse decompP2toP3, but the combination decompP3toP2 . decompP2toP3 is equivalent to a decompose operation (decompPatch)

Drawing P3_Pieces

drawPieceP3 :: OKBackend b => P3_Piece -> Diagram b Source #

Draws the two drawn edges of a P3_Piece

drawjPieceP3 :: OKBackend b => P3_Piece -> Diagram b Source #

Draws all edges of a P3_Piece using a faint dashed line for the join edge

fillOnlyPieceP3 :: (OKBackend b, Color c) => c -> P3_Piece -> Diagram b Source #

Fills a P3_Piece with a colour (without drawn edges)

fillOnlyPieceWN :: (OKBackend b, Color cw, Color cn) => cw -> cn -> P3_Piece -> Diagram b Source #

Fills a P3_Piece with one of 2 colours (but no drawn edges). The first colour is used for wide rhombuses, and the second for narrow rhombuses. (Note the order WN)

fillPieceWN :: (OKBackend b, Color cw, Color cn) => cw -> cn -> P3_Piece -> Diagram b Source #

Fills and draws a P3_Piece with one of 2 colours The first colour is used for wide rhombuses, and the second for narrow rhombuses. (Note the order WN)

P3_Drawable Class

class P3_Drawable a where Source #

A class for things that can be turned to diagrams when given a function to draw P3_Pieces.

Methods

drawP3With :: OKBackend b => (P3_Piece -> Diagram b) -> a -> Diagram b Source #

Instances

Instances details
P3_Drawable Tgraph Source #

A Tgraph is P3_Drawable.

Instance details

Defined in TileLibP3

Methods

drawP3With :: OKBackend b => (P3_Piece -> Diagram b) -> Tgraph -> Diagram b Source #

P3_Drawable VPatch Source #

A VPatch is P3_Drawable.

Instance details

Defined in TileLibP3

Methods

drawP3With :: OKBackend b => (P3_Piece -> Diagram b) -> VPatch -> Diagram b Source #

P3_Drawable Patch Source #

A Patch is also P3_Drawable (by conversion to a P3_Patch).

Instance details

Defined in TileLibP3

Methods

drawP3With :: OKBackend b => (P3_Piece -> Diagram b) -> Patch -> Diagram b Source #

P3_Drawable P3_Patch Source #

A P3_Patch is P3_Drawable.

Instance details

Defined in TileLibP3

Drawing functions producing P3 Rhombuses

drawP3 :: (OKBackend b, P3_Drawable a) => a -> Diagram b Source #

The main drawing function for anything P3_Drawable

drawjP3 :: (OKBackend b, P3_Drawable a) => a -> Diagram b Source #

An alternative drawing function for anything P3_Drawable adding dashed lines for join edges

dashjP3 :: (OKBackend b, P3_Drawable a) => a -> Diagram b Source #

Deprecated: Replaced by drawjP3

Deprecated (renamed as drawjP3)

fillWN :: (OKBackend b, P3_Drawable a, Color cw, Color cn) => cw -> cn -> a -> Diagram b Source #

The main draw and fill function for anything P3_Drawable. The first colour is used for wide rhombuses, and the second for narrow rhombuses. (Note the order W N).

fillNW :: (OKBackend b, P3_Drawable a, Color cw, Color cn) => cw -> cn -> a -> Diagram b Source #

A variation on fillWN where the first colour is for narrow rhombuses, the second for wide rhombuses. (Note the order N W).

P3_DrawableLabelled Class

class P3_DrawableLabelled a where Source #

A class for things that can be drawn (P3 style) with labels when given a colour and a measure (size) for the labels and a a draw function (for P3_Patches). So labelColourSizeP3 c m modifies a P3_Patch drawing function to add labels (of colour c and size measure m). Measures are defined in Diagrams. In particular: tiny, verySmall, small, normal, large, veryLarge, huge.

Instances

Instances details
P3_DrawableLabelled Tgraph Source #

Tgraphs can be drawn (Rhombus/P3 style) with labels NB: the additional vertices for P3 are only added when drawing and are not part of the Tgraph or its VPatch. Thus using such a vertex for alignment will raise an error.

Instance details

Defined in TileLibP3

P3_DrawableLabelled VPatch Source #

VPatches can be drawn (Rhombus/P3 style) with labels NB: the additional vertices for P3 are only added when drawing and are not part of the VPatch. Thus using such a vertex for alignment will raise an error.

Instance details

Defined in TileLibP3

Adding labels to functions producing P3 Rhombuses

labelSizeP3 :: (OKBackend b, P3_DrawableLabelled a) => Measure Double -> (P3_Patch -> Diagram b) -> a -> Diagram b Source #

Default Version of labelColourSizeP3 with colour red. Example usage: labelSizeP3 tiny drawP3 a , labelSizeP3 normal drawjP3 a

labelledP3 :: (OKBackend b, P3_DrawableLabelled a) => (P3_Patch -> Diagram b) -> a -> Diagram b Source #

Default Version of labelColourSizeP3 using red and small (rather than normal label size). Example usage: labelledP3 drawP3 a , labelledP3 drawjP3 a