Copyright | (c) Chris Reade 2021 |
---|---|
License | BSD-style |
Maintainer | chrisreade@mac.com |
Stability | experimental |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
This module includes the main composition operations compose, partCompose, tryPartCompose but also exposes getDartWingInfo (and type DartWingInfo) and composedFaceGroups for debugging and experimenting.
Synopsis
- compose :: Tgraph -> Tgraph
- partCompose :: Tgraph -> ([TileFace], Tgraph)
- tryPartCompose :: Tgraph -> Try ([TileFace], Tgraph)
- uncheckedCompose :: Tgraph -> Tgraph
- uncheckedPartCompose :: Tgraph -> ([TileFace], Tgraph)
- partComposeFaces :: Tgraph -> ([TileFace], [TileFace])
- composedFaces :: Tgraph -> [TileFace]
- data DartWingInfo = DartWingInfo {
- largeKiteCentres :: [Vertex]
- largeDartBases :: [Vertex]
- unknowns :: [Vertex]
- faceMap :: IntMap [TileFace]
- getDartWingInfo :: Tgraph -> DartWingInfo
- composedFaceGroups :: DartWingInfo -> [(TileFace, [TileFace])]
Documentation
compose :: Tgraph -> Tgraph Source #
The main compose 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)
partCompose :: Tgraph -> ([TileFace], Tgraph) Source #
partCompose g produces 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.
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.
uncheckedCompose :: Tgraph -> Tgraph Source #
This does the same as compose but without checks for connectedness and no crossing boundaries in the result. It is intended for use on forced Tgraphs where we have a proof that the checks are not needed.
uncheckedPartCompose :: Tgraph -> ([TileFace], Tgraph) Source #
uncheckedPartCompose g produces a pair of the remainder faces (faces from g which will not compose) and a Tgraph made from the composed faces without checking that the Tgraph is valid. I.e. it does NOT check the composition Tgraph for connectedness and no crossing boundaries. This is intended for use when we know the check is not needed (e.g. when g is forced).
partComposeFaces :: Tgraph -> ([TileFace], [TileFace]) Source #
partComposeFaces produces a pair of the remainder faces (faces from the original which will not compose) and the composed faces (which may or may not constitute faces of a valid Tgraph).
composedFaces :: Tgraph -> [TileFace] Source #
composedFaces g produces the composed faces of g (which may or may not constitute faces of a valid Tgraph).
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.
DartWingInfo | |
|
Instances
Show DartWingInfo Source # | |
Defined in Tgraph.Compose 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.
composedFaceGroups :: DartWingInfo -> [(TileFace, [TileFace])] Source #
Auxiliary function for uncheckedPartCompose. Creates a list of new composed faces, each paired with a list of old faces (components of the new face) using dart wing information.