Copyright | (c) Chris Reade 2021 |
---|---|
License | BSD-style |
Maintainer | chrisreade@mac.com |
Stability | experimental |
Safe Haskell | None |
Language | GHC2021 |
Tgraph.Compose
Description
This module includes the main composition operations compose, partCompose, tryPartCompose, composeF, and partComposeF but also exposes getDartWingInfo, getDartWingInfoForced (and type DartWingInfo) and composedFaceGroups for debugging and experimenting.
Synopsis
- compose :: Tgraph -> Tgraph
- composeF :: Forced Tgraph -> Forced Tgraph
- partCompose :: Tgraph -> ([TileFace], Tgraph)
- partComposeF :: Forced Tgraph -> ([TileFace], Forced Tgraph)
- tryPartCompose :: Tgraph -> Try ([TileFace], Tgraph)
- partComposeFaces :: Tgraph -> ([TileFace], [TileFace])
- data DartWingInfo = DartWingInfo {
- largeKiteCentres :: [Vertex]
- largeDartBases :: [Vertex]
- unknowns :: [Vertex]
- faceMap :: IntMap [TileFace]
- getDartWingInfo :: Tgraph -> DartWingInfo
- getDartWingInfoForced :: Forced Tgraph -> DartWingInfo
- composedFaceGroups :: DartWingInfo -> [(TileFace, [TileFace])]
Documentation
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.
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.
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 does not assume the given Tgraph is forced. It checks the composed Tgraph for connectedness and no crossing boundaries raising an error if this check fails.
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.
tryPartCompose :: Tgraph -> Try ([TileFace], Tgraph) Source #
tryPartCompose g tries to produce a Tgraph by composing faces which uniquely compose in g, It checks the resulting new faces for connectedness and no crossing boundaries. If the check is OK it produces Right (remainder, g') where g' is the composed Tgraph and remainder is a list of faces from g which will not compose. If the check fails it produces Left s where s is a failure report. It does not assume the given Tgraph is forced.
Exported auxiliary functions (and type)
partComposeFaces :: Tgraph -> ([TileFace], [TileFace]) Source #
partComposeFaces g - produces a pair of the remainder faces (faces from g which will not compose) and the composed faces (which may or may not constitute faces of a valid Tgraph). It does not assume that g is forced.
data DartWingInfo Source #
DartWingInfo is a record type for the result of classifying dart wings in a Tgraph. It includes a faceMap from dart wings to faces at that vertex.
Constructors
DartWingInfo | |
Fields
|
Instances
Show DartWingInfo Source # | |
Defined in Tgraph.Compose Methods showsPrec :: Int -> DartWingInfo -> ShowS # show :: DartWingInfo -> String # showList :: [DartWingInfo] -> ShowS # |
getDartWingInfo :: Tgraph -> DartWingInfo Source #
getDartWingInfo g, classifies the dart wings in g and calculates a faceMap for each dart wing, returning as DartWingInfo. It does not assume g is forced and is more expensive than getDartWingInfoForced
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.
composedFaceGroups :: DartWingInfo -> [(TileFace, [TileFace])] Source #
Creates a list of new composed faces, each paired with a list of old faces (components of the new face) using dart wing information. Auxiliary function but exported for experimenting.