reanimate 1.1.3.1 → 1.1.3.2
raw patch · 4 files changed
+65/−12 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- ChangeLog.md +6/−2
- reanimate.cabal +14/−3
- src/Reanimate/Math/Triangulate.hs +29/−0
- src/Reanimate/PolyShape.hs +16/−7
ChangeLog.md view
@@ -6,12 +6,16 @@ project adheres to the [Haskell Package Versioning Policy (PVP)](https://pvp.haskell.org) -## 1.1.3.1 -- 2020-01-04+## 1.1.3.2 -- 2021-01-14 + * Add flag for disabling the HGeometry dependency.++## 1.1.3.1 -- 2021-01-04+ * Fixed performance issue on Windows. * Fixed live viewer with Firefox. -## 1.1.3.0 -- 2020-01-04+## 1.1.3.0 -- 2021-01-04 ## Added * Reanimate.reanimateLive
reanimate.cabal view
@@ -3,7 +3,7 @@ -- see http://haskell.org/cabal/users-guide/ name: reanimate-version: 1.1.3.1+version: 1.1.3.2 -- synopsis: -- description: license: PublicDomain@@ -37,6 +37,13 @@ Type: git Location: git://github.com/lemmih/reanimate.git +flag no-hgeometry+ description:+ Disable all features that depend on hgeometry. Should only+ be used when developing new hgeometry algorithms.+ default: False+ manual: True+ library hs-source-dirs: src if os(windows)@@ -105,6 +112,12 @@ Reanimate.Scene.Object Detach autogen-modules: Paths_reanimate+ if flag(no-hgeometry)+ cpp-options: -DNO_HGEOMETRY+ else+ build-depends:+ hgeometry >=0.11.0.0,+ hgeometry-combinatorial >=0.11.0.0 build-depends: base >=4.10 && <5, JuicyPixels >=3.3.3,@@ -126,8 +139,6 @@ fsnotify >=0.3.0.1, geojson >=3.0.4, hashable >=1.3.0.0,- hgeometry >=0.11.0.0,- hgeometry-combinatorial >=0.11.0.0, lens >=4.16.1, linear >=1.20.8, matrix >=0.3.6.1,
src/Reanimate/Math/Triangulate.hs view
@@ -1,5 +1,6 @@ {-# LANGUAGE DataKinds #-} {-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE CPP #-} {-# OPTIONS_HADDOCK hide #-} module Reanimate.Math.Triangulate ( Triangulation@@ -11,6 +12,32 @@ ) where +#if NO_HGEOMETRY++import qualified Data.Vector as V+import Control.Monad.ST+import Reanimate.Math.Common++type Triangulation = V.Vector [Int]++edgesToTriangulation :: Int -> [(Int, Int)] -> Triangulation+edgesToTriangulation = error "no hgeometry"++edgesToTriangulationM :: Int -> [(Int, Int)] -> ST s (V.MVector s [Int])+edgesToTriangulationM = error "no hgeometry"++trianglesToTriangulation :: Int -> V.Vector (Int, Int, Int) -> Triangulation+trianglesToTriangulation = error "no hgeometry"++trianglesToTriangulationM+ :: Int -> V.Vector (Int, Int, Int) -> ST s (V.MVector s [Int])+trianglesToTriangulationM = error "no hgeometry"++triangulate :: forall a. (Fractional a, Ord a) => Ring a -> Triangulation+triangulate = error "no hgeometry"++#else+ import Algorithms.Geometry.PolygonTriangulation.Triangulate (triangulate') import Algorithms.Geometry.PolygonTriangulation.Types import Control.Lens@@ -83,3 +110,5 @@ [ Point2 x y :+ n | (n,V2 x y) <- zip [0..] (V.toList (ringUnpack r)) ] -- ringUnpack++#endif
src/Reanimate/PolyShape.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} {-| Module : Reanimate.PolyShape Copyright : Written by David Himmelstrup@@ -40,15 +41,8 @@ , plGroupTouching ) where -import Algorithms.Geometry.PolygonTriangulation.Triangulate (triangulate') import Control.Lens ((&), (.~), (^.))-import Data.Ext-import Data.Geometry.PlanarSubdivision (PolygonFaceData (..))-import qualified Data.Geometry.Point as Geo-import qualified Data.Geometry.Polygon as Geo import Data.List (nub, partition, sortOn)-import qualified Data.PlaneGraph as Geo-import Data.Proxy (Proxy (Proxy)) import qualified Data.Vector as V import Geom2D.CubicBezier.Linear (ClosedPath (..), CubicBezier (..),@@ -72,6 +66,17 @@ pIsCCW) import Reanimate.Svg +#if !defined(NO_HGEOMETRY)+import Algorithms.Geometry.PolygonTriangulation.Triangulate (triangulate')++import Data.Ext+import Data.Geometry.PlanarSubdivision (PolygonFaceData (..))+import qualified Data.Geometry.Point as Geo+import qualified Data.Geometry.Polygon as Geo+import qualified Data.PlaneGraph as Geo+import Data.Proxy (Proxy (Proxy))+#endif+ -- | Shape drawn by continuous line. May have overlap, may be convex. newtype PolyShape = PolyShape { unPolyShape :: ClosedPath Double } deriving (Show)@@ -201,6 +206,9 @@ -- | Split polygon into smaller, convex polygons. decomposePolygon :: [RPoint] -> [[RPoint]]+#if defined(NO_HGEOMETRY)+decomposePolygon = error "no hgeometry"+#else decomposePolygon poly = [ [ V2 x y | v <- V.toList (Geo.boundaryVertices f pg)@@ -212,6 +220,7 @@ p = Geo.fromPoints $ [ Geo.Point2 x y :+ () | V2 x y <- poly ]+#endif plPolygonify :: Double -> PolyShape -> [RPoint] plPolygonify tol shape =