brillo-algorithms 1.13.3 → 2.0.0
raw patch · 4 files changed
+72/−78 lines, 4 filesdep −containersdep −ghc-primdep ~brilloPVP ok
version bump matches the API change (PVP)
Dependencies removed: containers, ghc-prim
Dependency ranges changed: brillo
API changes (from Hackage documentation)
- Brillo.Data.QuadTree: emptyTree :: QuadTree a
- Brillo.Algorithms.RayCast: castSegIntoCellularQuadTree :: forall a. Point -> Point -> Extent -> QuadTree a -> Maybe (Point, Extent, a)
+ Brillo.Algorithms.RayCast: castSegIntoCellularQuadTree :: Point -> Point -> Extent -> QuadTree a -> Maybe (Point, Extent, a)
- Brillo.Algorithms.RayCast: traceSegIntoCellularQuadTree :: forall a. Point -> Point -> Extent -> QuadTree a -> [(Point, Extent, a)]
+ Brillo.Algorithms.RayCast: traceSegIntoCellularQuadTree :: Point -> Point -> Extent -> QuadTree a -> [(Point, Extent, a)]
- Brillo.Data.QuadTree: flattenQuadTree :: forall a. Extent -> QuadTree a -> [(Coord, a)]
+ Brillo.Data.QuadTree: flattenQuadTree :: Extent -> QuadTree a -> [(Coord, a)]
- Brillo.Data.QuadTree: flattenQuadTreeWithExtents :: forall a. Extent -> QuadTree a -> [(Extent, a)]
+ Brillo.Data.QuadTree: flattenQuadTreeWithExtents :: Extent -> QuadTree a -> [(Extent, a)]
- Brillo.Data.QuadTree: lookupByCoord :: forall a. Extent -> Coord -> QuadTree a -> Maybe a
+ Brillo.Data.QuadTree: lookupByCoord :: Extent -> Coord -> QuadTree a -> Maybe a
Files
- Brillo/Algorithms/RayCast.hs +24/−24
- Brillo/Data/Extent.hs +10/−10
- Brillo/Data/QuadTree.hs +33/−39
- brillo-algorithms.cabal +5/−5
Brillo/Algorithms/RayCast.hs view
@@ -27,18 +27,18 @@ -- to get the one closest to P1. It'd be better to do a -- proper walk over the tree in the direction of the ray. ---castSegIntoCellularQuadTree- :: forall a- . Point- -- ^ (P1) Starting point of seg.- -> Point- -- ^ (P2) Final point of seg.- -> Extent- -- ^ Extent convering the whole tree.- -> QuadTree a- -- ^ The tree.- -> Maybe (Point, Extent, a)- -- ^ Intersection point, extent of cell, value of cell (if any).+castSegIntoCellularQuadTree ::+ forall a.+ -- | (P1) Starting point of seg.+ Point ->+ -- | (P2) Final point of seg.+ Point ->+ -- | Extent convering the whole tree.+ Extent ->+ -- | The tree.+ QuadTree a ->+ -- | Intersection point, extent of cell, value of cell (if any).+ Maybe (Point, Extent, a) castSegIntoCellularQuadTree p1 p2 extent tree | cells@(_ : _) <- traceSegIntoCellularQuadTree p1 p2 extent tree , c : _ <- sortBy ((compareDistanceTo p1) `on` (\(a, _, _) -> a)) cells =@@ -65,18 +65,18 @@ Given a line segment (P1-P2) through the tree, return the list of cells that intersect the segment. -}-traceSegIntoCellularQuadTree- :: forall a- . Point- -- ^ (P1) Starting point of seg.- -> Point- -- ^ (P2) Final point of seg.- -> Extent- -- ^ Extent covering the whole tree.- -> QuadTree a- -- ^ The tree.- -> [(Point, Extent, a)]- -- ^ Intersection point, extent of cell, value of cell.+traceSegIntoCellularQuadTree ::+ forall a.+ -- | (P1) Starting point of seg.+ Point ->+ -- | (P2) Final point of seg.+ Point ->+ -- | Extent covering the whole tree.+ Extent ->+ -- | The tree.+ QuadTree a ->+ -- | Intersection point, extent of cell, value of cell.+ [(Point, Extent, a)] traceSegIntoCellularQuadTree p1 p2 extent tree = case tree of TNil -> []
Brillo/Data/Extent.hs view
@@ -46,16 +46,16 @@ {-| Construct an extent. The north value must be > south, and east > west, else `error`. -}-makeExtent- :: Int- -- ^ y max (north)- -> Int- -- ^ y min (south)- -> Int- -- ^ x max (east)- -> Int- -- ^ x min (west)- -> Extent+makeExtent ::+ -- | y max (north)+ Int ->+ -- | y min (south)+ Int ->+ -- | x max (east)+ Int ->+ -- | x min (west)+ Int ->+ Extent makeExtent n s e w | n >= s , e >= w =
Brillo/Data/QuadTree.hs view
@@ -6,7 +6,6 @@ -} module Brillo.Data.QuadTree ( QuadTree (..),- emptyTree, emptyNode, takeQuadOfTree, liftToQuad,@@ -39,11 +38,6 @@ deriving (Show) --- | A `TNil` tree.-emptyTree :: QuadTree a-emptyTree = TNil-- -- | A node with `TNil`. for all its branches. emptyNode :: QuadTree a emptyNode = TNode TNil TNil TNil TNil@@ -52,10 +46,10 @@ {-| Get a quadrant from a node. If the tree does not have an outer node then `Nothing`. -}-takeQuadOfTree- :: Quad- -> QuadTree a- -> Maybe (QuadTree a)+takeQuadOfTree ::+ Quad ->+ QuadTree a ->+ Maybe (QuadTree a) takeQuadOfTree quad tree = case tree of TNil -> Nothing@@ -71,11 +65,11 @@ {-| Apply a function to a quadrant of a node. If the tree does not have an outer node then return the original tree. -}-liftToQuad- :: Quad- -> (QuadTree a -> QuadTree a)- -> QuadTree a- -> QuadTree a+liftToQuad ::+ Quad ->+ (QuadTree a -> QuadTree a) ->+ QuadTree a ->+ QuadTree a liftToQuad quad f tree = case tree of TNil -> tree@@ -112,10 +106,10 @@ -- | Lookup a node based on a path to it.-lookupNodeByPath- :: [Quad]- -> QuadTree a- -> Maybe (QuadTree a)+lookupNodeByPath ::+ [Quad] ->+ QuadTree a ->+ Maybe (QuadTree a) lookupNodeByPath [] tree = Just tree lookupNodeByPath (q : qs) tree =@@ -137,14 +131,14 @@ -- | Lookup a node if a tree given a coordinate which it contains.-lookupByCoord- :: forall a- . Extent- -- ^ Extent that covers the whole tree.- -> Coord- -- ^ Coordinate of the value of interest.- -> QuadTree a- -> Maybe a+lookupByCoord ::+ forall a.+ -- | Extent that covers the whole tree.+ Extent ->+ -- | Coordinate of the value of interest.+ Coord ->+ QuadTree a ->+ Maybe a lookupByCoord extent coord tree = do path <- pathToCoord extent coord@@ -152,12 +146,12 @@ -- | Flatten a QuadTree into a list of its contained values, with coordinates.-flattenQuadTree- :: forall a- . Extent- -- ^ Extent that covers the whole tree.- -> QuadTree a- -> [(Coord, a)]+flattenQuadTree ::+ forall a.+ -- | Extent that covers the whole tree.+ Extent ->+ QuadTree a ->+ [(Coord, a)] flattenQuadTree extentInit treeInit = flatten' extentInit treeInit where@@ -177,12 +171,12 @@ -- | Flatten a QuadTree into a list of its contained values, with extents.-flattenQuadTreeWithExtents- :: forall a- . Extent- -- ^ Extent that covers the whole tree.- -> QuadTree a- -> [(Extent, a)]+flattenQuadTreeWithExtents ::+ forall a.+ -- | Extent that covers the whole tree.+ Extent ->+ QuadTree a ->+ [(Extent, a)] flattenQuadTreeWithExtents extentInit treeInit = flatten' extentInit treeInit where
brillo-algorithms.cabal view
@@ -1,6 +1,6 @@ cabal-version: 3.0 name: brillo-algorithms-version: 1.13.3+version: 2.0.0 license: MIT license-file: LICENSE author: Ben Lippmeier, Adrian Sieber@@ -15,6 +15,8 @@ synopsis: Data structures and algorithms for working with 2D graphics. +tested-with: GHC ==9.4.8 || ==9.6.7 || ==9.8.4 || ==9.10.3 || ==9.12.2+ source-repository head type: git location: https://github.com/ad-si/Brillo@@ -22,10 +24,8 @@ library default-language: GHC2021 build-depends:- , base >=4.8 && <5- , brillo >=1.13.3 && <1.14- , containers >=0.5 && <0.7- , ghc-prim+ , base >=4.8 && <5+ , brillo >=2.0 && <3.0 ghc-options: -O2 -Wall exposed-modules: