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

Tgraph.Compose

Description

This module includes the main composition operations compose, partCompose, tryPartCompose, composeF, and partComposeF but also exposes auxiliary functions tryGetDartWingInfo, getDartWingInfoForced (and type DartWingInfo) and partCompFacesFrom for debugging.

Synopsis

Composing forced Tgraphs

composeF :: Forced Tgraph -> Forced Tgraph Source #

composeF - produces a composed Forced Tgraph from a Forced Tgraph. Since the argument is a forced Tgraph it does not need a check for validity of the composed Tgraph. The fact that the function is total and the result is also Forced relies on theorems established for composing.

partComposeF :: Forced Tgraph -> ([TileFace], Forced Tgraph) Source #

partComposeF fg - produces a pair consisting of remainder faces (faces from fg which will not compose) and a composed (Forced) Tgraph. Since fg is a forced Tgraph it does not need a check for validity of the composed Tgraph. The fact that the result is also Forced relies on a theorem.

General compose operations

compose :: Tgraph -> Tgraph Source #

The main compose (partial) function which simply drops the remainder faces from partCompose to return just the composed Tgraph. It will raise an error if the result is not a valid Tgraph (i.e. if it fails the connectedness, no crossing boundary check). It does not assume the given Tgraph is forced. It can raise an error if the Tgraph is found to be incorrect (when getting dartwing info).

partCompose :: Tgraph -> ([TileFace], Tgraph) Source #

partCompose g is a partial function producing a pair consisting of remainder faces (faces from g which will not compose) and a composed Tgraph. It checks the composed Tgraph for connectedness and no crossing boundaries raising an error if this check fails. It does not assume the given Tgraph is forced. It can raise an error if the Tgraph is found to be incorrect (when getting dartwing info).

tryPartCompose :: Tgraph -> Try ([TileFace], Tgraph) Source #

tryPartCompose g tries to produce a Tgraph by composing faces which uniquely compose in g, It uses tryGetDartWingInfo g which can fail if g is found to be incorrect when forced. It checks the resulting new faces for connectedness and no crossing boundaries. If both the above succeed, the result is Right (remainder, g') where g' is the composed Tgraph and remainder is a list of faces from g which will not compose.

tryPartComposeFaces :: Tgraph -> Try ([TileFace], [TileFace]) Source #

Get the remainder and composed faces (without checking the composed faces make a valid Tgraph) It uses tryGetDartWingInfo g which can fail if g is found to be incorrect when forced.

Exported auxiliary functions (and type)

partComposeFacesFrom :: DartWingInfo -> ([TileFace], [TileFace]) Source #

Uses supplied dartwing info to get remainder faces and composed faces. Does not assume forced and does not check the composed faces for connected/no crossing boundaries

data DartWingInfo Source #

DartWingInfo is a record type for the result of classifying dart wings in a Tgraph. Faces at a largeKiteCentre vertex will form kite faces when composed. Faces at a largeDartBase vertex will form dart faces when composed. Faces at an unknown vertex cannot be composed. The record includes a faceMap from dart wings to faces at that vertex. and a list of any faces (necessarily kites) not included in the faceMap (unMapped)

Constructors

DartWingInfo 

Fields

Instances

Instances details
Show DartWingInfo Source # 
Instance details

Defined in Tgraph.Compose

tryGetDartWingInfo :: Tgraph -> Try DartWingInfo Source #

The given Tgraph is not assumed to be forced. Getting the dart wing information makes use of the forced version as well as the Tgraph so this uses tryForce first which can fail if the Tgraph is found to be incorrect.

getDartWingInfoForced :: Forced Tgraph -> DartWingInfo Source #

getDartWingInfoForced fg (fg an explicitly Forced Tgraph) classifies the dart wings in fg and calculates a faceMap for each dart wing, returning as DartWingInfo. The classification is much simplified knowing that the Tgraph is forced.

Older versions (for debugging/comparison)

oldGetDartWingInfo :: Tgraph -> DartWingInfo Source #

oldGetDartWingInfo g, classifies the dart wings in g and calculates a faceMap for each dart wing, returning as DartWingInfo. If only uses local information to classify each dart wing and can therefore sometimes classify a dart wing as unknown unnecessarily. In contrast tryGetDartWingInfo is accurate using information from forcing (so is not local)

oldPartCompose :: Tgraph -> ([TileFace], Tgraph) Source #

partCompose g is a partial function producing a pair consisting of remainder faces (faces from g which will not compose) and a composed Tgraph. It checks the composed Tgraph for connectedness and no crossing boundaries raising an error if this check fails. It does not assume the given Tgraph is forced. It can raise an error if the Tgraph is found to be incorrect (when getting dartwing info).