packages feed

diagrams-lib 1.3.0.9 → 1.3.1.0

raw patch · 5 files changed

+80/−5 lines, 5 filesdep +diagrams-libdep +tastydep +tasty-hunitdep ~basePVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependencies added: diagrams-lib, tasty, tasty-hunit

Dependency ranges changed: base

API changes (from Hackage documentation)

- Diagrams.Segment: oeEnvelope :: Lens' (OffsetEnvelope v_aGp3 n_aGp4) (Envelope v_aGp3 n_aGp4)
+ Diagrams.Segment: oeEnvelope :: Lens' (OffsetEnvelope v_aTWU n_aTWV) (Envelope v_aTWU n_aTWV)
- Diagrams.Segment: oeOffset :: Lens' (OffsetEnvelope v_aGp3 n_aGp4) (TotalOffset v_aGp3 n_aGp4)
+ Diagrams.Segment: oeOffset :: Lens' (OffsetEnvelope v_aTWU n_aTWV) (TotalOffset v_aTWU n_aTWV)
- Diagrams.ThreeD.Camera: horizontalFieldOfView :: Lens' (PerspectiveLens n_aukH) (Angle n_aukH)
+ Diagrams.ThreeD.Camera: horizontalFieldOfView :: Lens' (PerspectiveLens n_aAIZ) (Angle n_aAIZ)
- Diagrams.ThreeD.Camera: orthoHeight :: Lens' (OrthoLens n_aumL) n_aumL
+ Diagrams.ThreeD.Camera: orthoHeight :: Lens' (OrthoLens n_aAL3) n_aAL3
- Diagrams.ThreeD.Camera: orthoWidth :: Lens' (OrthoLens n_aumL) n_aumL
+ Diagrams.ThreeD.Camera: orthoWidth :: Lens' (OrthoLens n_aAL3) n_aAL3
- Diagrams.ThreeD.Camera: verticalFieldOfView :: Lens' (PerspectiveLens n_aukH) (Angle n_aukH)
+ Diagrams.ThreeD.Camera: verticalFieldOfView :: Lens' (PerspectiveLens n_aAIZ) (Angle n_aAIZ)
- Diagrams.Transform.ScaleInv: scaleInvDir :: Lens' (ScaleInv t_azMv) (Vn t_azMv)
+ Diagrams.Transform.ScaleInv: scaleInvDir :: Lens' (ScaleInv t_aJ6W) (Vn t_aJ6W)
- Diagrams.Transform.ScaleInv: scaleInvLoc :: Lens' (ScaleInv t_azMv) (Point (V t_azMv) (N t_azMv))
+ Diagrams.Transform.ScaleInv: scaleInvLoc :: Lens' (ScaleInv t_aJ6W) (Point (V t_aJ6W) (N t_aJ6W))
- Diagrams.Transform.ScaleInv: scaleInvObj :: Lens' (ScaleInv t_azMv) t_azMv
+ Diagrams.Transform.ScaleInv: scaleInvObj :: Lens' (ScaleInv t_aJ6W) t_aJ6W
- Diagrams.TwoD: _LG :: Prism' (Texture n_a1JMB) (LGradient n_a1JMB)
+ Diagrams.TwoD: _LG :: Prism' (Texture n_a2EQs) (LGradient n_a2EQs)
- Diagrams.TwoD: _RG :: Prism' (Texture n_a1JMB) (RGradient n_a1JMB)
+ Diagrams.TwoD: _RG :: Prism' (Texture n_a2EQs) (RGradient n_a2EQs)
- Diagrams.TwoD: _SC :: Prism' (Texture n_a1JMB) SomeColor
+ Diagrams.TwoD: _SC :: Prism' (Texture n_a2EQs) SomeColor
- Diagrams.TwoD: eColor :: Lens' (EnvelopeOpts n_a1VvZ) (Colour Double)
+ Diagrams.TwoD: eColor :: Lens' (EnvelopeOpts n_a2Yf8) (Colour Double)
- Diagrams.TwoD: eLineWidth :: Lens (EnvelopeOpts n_a1VvZ) (EnvelopeOpts n_a1Vyb) (Measure n_a1VvZ) (Measure n_a1Vyb)
+ Diagrams.TwoD: eLineWidth :: Lens (EnvelopeOpts n_a2Yf8) (EnvelopeOpts n_a2Yhk) (Measure n_a2Yf8) (Measure n_a2Yhk)
- Diagrams.TwoD: ePoints :: Lens' (EnvelopeOpts n_a1VvZ) Int
+ Diagrams.TwoD: ePoints :: Lens' (EnvelopeOpts n_a2Yf8) Int
- Diagrams.TwoD: oColor :: Lens' (OriginOpts n_a1Vvd) (Colour Double)
+ Diagrams.TwoD: oColor :: Lens' (OriginOpts n_a2Yem) (Colour Double)
- Diagrams.TwoD: oMinSize :: Lens' (OriginOpts n_a1Vvd) n_a1Vvd
+ Diagrams.TwoD: oMinSize :: Lens' (OriginOpts n_a2Yem) n_a2Yem
- Diagrams.TwoD: oScale :: Lens' (OriginOpts n_a1Vvd) n_a1Vvd
+ Diagrams.TwoD: oScale :: Lens' (OriginOpts n_a2Yem) n_a2Yem
- Diagrams.TwoD: radiusBL :: Lens' (RoundedRectOpts d_a1orb) d_a1orb
+ Diagrams.TwoD: radiusBL :: Lens' (RoundedRectOpts d_a25fk) d_a25fk
- Diagrams.TwoD: radiusBR :: Lens' (RoundedRectOpts d_a1orb) d_a1orb
+ Diagrams.TwoD: radiusBR :: Lens' (RoundedRectOpts d_a25fk) d_a25fk
- Diagrams.TwoD: radiusTL :: Lens' (RoundedRectOpts d_a1orb) d_a1orb
+ Diagrams.TwoD: radiusTL :: Lens' (RoundedRectOpts d_a25fk) d_a25fk
- Diagrams.TwoD: radiusTR :: Lens' (RoundedRectOpts d_a1orb) d_a1orb
+ Diagrams.TwoD: radiusTR :: Lens' (RoundedRectOpts d_a25fk) d_a25fk
- Diagrams.TwoD: tColor :: Lens' (TraceOpts n_a1VyA) (Colour Double)
+ Diagrams.TwoD: tColor :: Lens' (TraceOpts n_a2YhJ) (Colour Double)
- Diagrams.TwoD: tMinSize :: Lens' (TraceOpts n_a1VyA) n_a1VyA
+ Diagrams.TwoD: tMinSize :: Lens' (TraceOpts n_a2YhJ) n_a2YhJ
- Diagrams.TwoD: tPoints :: Lens' (TraceOpts n_a1VyA) Int
+ Diagrams.TwoD: tPoints :: Lens' (TraceOpts n_a2YhJ) Int
- Diagrams.TwoD: tScale :: Lens' (TraceOpts n_a1VyA) n_a1VyA
+ Diagrams.TwoD: tScale :: Lens' (TraceOpts n_a2YhJ) n_a2YhJ
- Diagrams.TwoD.Attributes: _LG :: Prism' (Texture n_a1JMB) (LGradient n_a1JMB)
+ Diagrams.TwoD.Attributes: _LG :: Prism' (Texture n_a2EQs) (LGradient n_a2EQs)
- Diagrams.TwoD.Attributes: _RG :: Prism' (Texture n_a1JMB) (RGradient n_a1JMB)
+ Diagrams.TwoD.Attributes: _RG :: Prism' (Texture n_a2EQs) (RGradient n_a2EQs)
- Diagrams.TwoD.Attributes: _SC :: Prism' (Texture n_a1JMB) SomeColor
+ Diagrams.TwoD.Attributes: _SC :: Prism' (Texture n_a2EQs) SomeColor
- Diagrams.TwoD.Model: eColor :: Lens' (EnvelopeOpts n_a1VvZ) (Colour Double)
+ Diagrams.TwoD.Model: eColor :: Lens' (EnvelopeOpts n_a2Yf8) (Colour Double)
- Diagrams.TwoD.Model: eLineWidth :: Lens (EnvelopeOpts n_a1VvZ) (EnvelopeOpts n_a1Vyb) (Measure n_a1VvZ) (Measure n_a1Vyb)
+ Diagrams.TwoD.Model: eLineWidth :: Lens (EnvelopeOpts n_a2Yf8) (EnvelopeOpts n_a2Yhk) (Measure n_a2Yf8) (Measure n_a2Yhk)
- Diagrams.TwoD.Model: ePoints :: Lens' (EnvelopeOpts n_a1VvZ) Int
+ Diagrams.TwoD.Model: ePoints :: Lens' (EnvelopeOpts n_a2Yf8) Int
- Diagrams.TwoD.Model: oColor :: Lens' (OriginOpts n_a1Vvd) (Colour Double)
+ Diagrams.TwoD.Model: oColor :: Lens' (OriginOpts n_a2Yem) (Colour Double)
- Diagrams.TwoD.Model: oMinSize :: Lens' (OriginOpts n_a1Vvd) n_a1Vvd
+ Diagrams.TwoD.Model: oMinSize :: Lens' (OriginOpts n_a2Yem) n_a2Yem
- Diagrams.TwoD.Model: oScale :: Lens' (OriginOpts n_a1Vvd) n_a1Vvd
+ Diagrams.TwoD.Model: oScale :: Lens' (OriginOpts n_a2Yem) n_a2Yem
- Diagrams.TwoD.Model: tColor :: Lens' (TraceOpts n_a1VyA) (Colour Double)
+ Diagrams.TwoD.Model: tColor :: Lens' (TraceOpts n_a2YhJ) (Colour Double)
- Diagrams.TwoD.Model: tMinSize :: Lens' (TraceOpts n_a1VyA) n_a1VyA
+ Diagrams.TwoD.Model: tMinSize :: Lens' (TraceOpts n_a2YhJ) n_a2YhJ
- Diagrams.TwoD.Model: tPoints :: Lens' (TraceOpts n_a1VyA) Int
+ Diagrams.TwoD.Model: tPoints :: Lens' (TraceOpts n_a2YhJ) Int
- Diagrams.TwoD.Model: tScale :: Lens' (TraceOpts n_a1VyA) n_a1VyA
+ Diagrams.TwoD.Model: tScale :: Lens' (TraceOpts n_a2YhJ) n_a2YhJ
- Diagrams.TwoD.Shapes: radiusBL :: Lens' (RoundedRectOpts d_a1orb) d_a1orb
+ Diagrams.TwoD.Shapes: radiusBL :: Lens' (RoundedRectOpts d_a25fk) d_a25fk
- Diagrams.TwoD.Shapes: radiusBR :: Lens' (RoundedRectOpts d_a1orb) d_a1orb
+ Diagrams.TwoD.Shapes: radiusBR :: Lens' (RoundedRectOpts d_a25fk) d_a25fk
- Diagrams.TwoD.Shapes: radiusTL :: Lens' (RoundedRectOpts d_a1orb) d_a1orb
+ Diagrams.TwoD.Shapes: radiusTL :: Lens' (RoundedRectOpts d_a25fk) d_a25fk
- Diagrams.TwoD.Shapes: radiusTR :: Lens' (RoundedRectOpts d_a1orb) d_a1orb
+ Diagrams.TwoD.Shapes: radiusTR :: Lens' (RoundedRectOpts d_a25fk) d_a25fk

Files

CHANGELOG.md view
@@ -1,3 +1,9 @@+## [v1.3.1.0](https://github.com/diagrams/diagrams-lib/tree/v1.3.0.9) (2016-02-14)++- improve path offset calculations++[Full Changelog](https://github.com/diagrams/diagrams-lib/compare/v1.3.0.9...v1.3.1.0)+ ## [v1.3.0.9](https://github.com/diagrams/diagrams-lib/tree/v1.3.0.9) (2016-01-14)  - allow `unordered-containers-0.2.6`
diagrams-lib.cabal view
@@ -1,5 +1,5 @@ Name:                diagrams-lib-Version:             1.3.0.9+Version:             1.3.1.0 Synopsis:            Embedded domain-specific language for declarative graphics Description:         Diagrams is a flexible, extensible EDSL for creating                      graphics of many types.  Graphics can be created@@ -140,3 +140,14 @@     RankNTypes, ScopedTypeVariables, StandaloneDeriving, TemplateHaskell,     TypeOperators, TypeSynonymInstances, UndecidableInstances, ViewPatterns,     LambdaCase++test-suite tests+  type: exitcode-stdio-1.0+  main-is: Test.hs+  other-modules: Diagrams.TwoD.OffsetTest+  hs-source-dirs: test+  build-depends:       base >= 4.2 && < 4.9,+                       tasty >= 0.10,+                       tasty-hunit >= 0.9.2,+                       diagrams-lib+  default-language:    Haskell2010
src/Diagrams/TwoD/Offset.hs view
@@ -280,8 +280,8 @@     where       eps = opts^.offsetEpsilon       offset = map (bindLoc (offsetSegment eps r)) . locatedTrailSegments-      ends | isLoop    = (\(a:as) -> as ++ [a]) . trailVertices $ t-           | otherwise = tail . trailVertices $ t+      ends | isLoop    = (\(a:as) -> as ++ [a]) . trailPoints $ t+           | otherwise = tail . trailPoints $ t       j = fromLineJoin (opts^.offsetJoin)        isLoop = withTrail (const False) (const True) (unLoc t)@@ -375,7 +375,7 @@       offset r' = map (bindLoc (offsetSegment eps r')) . locatedTrailSegments       f r' = joinSegments eps (fromLineJoin (opts^.expandJoin)) False (opts^.expandMiterLimit) r' ends            . offset r' $ t-      ends = tail . trailVertices $ t+      ends = tail . trailPoints $ t       s = atStart t       e = atEnd t       cap = fromLineCap (opts^.expandCap)@@ -387,7 +387,7 @@       offset r' = map (bindLoc (offsetSegment eps r')) . locatedTrailSegments       f r' = joinSegments eps (fromLineJoin (opts^.expandJoin)) True (opts^.expandMiterLimit) r' ends            . offset r' $ t-      ends = (\(a:as) -> as ++ [a]) . trailVertices $ t+      ends = (\(a:as) -> as ++ [a]) . trailPoints $ t  -- | Expand a 'Trail' with the given radius and default options.  See 'expandTrail''. expandTrail :: RealFloat n => n -> Located (Trail V2 n) -> Path V2 n
+ test/Diagrams/TwoD/OffsetTest.hs view
@@ -0,0 +1,48 @@+module Diagrams.TwoD.OffsetTest+    (+      tests+    ) where++import Test.Tasty (TestTree)+import Test.Tasty.HUnit++import Diagrams.Prelude+import Diagrams.TwoD.Offset++tests :: [TestTree]+tests =+    [ testCase "line"+          (offsetTrailVertices+              [p2 (0, 0), p2 (1, 0)]+              [p2 (0, -1), p2 (1, -1)])+    , testCase "square"+          (offsetTrailVertices+              [p2 (0, 0), p2 (1, 0), p2 (1, 1), p2 (0, 1), p2 (0, 0)]+              [p2 (0, -1), p2 (2, -1), p2 (2, 2), p2 (-1, 2), p2 (-1, 0)])+    , testCase "square loop"+          (offsetTrailLoopVertices+              [p2 (0, 0), p2 (1, 0), p2 (1, 1), p2 (0, 1), p2 (0, 0)]+              [p2 (2, -1), p2 (2, 2), p2 (-1, 2), p2 (-1, -1)])+    , testCase "redundant line"+          (offsetTrailVertices+              [p2 (0, 0), p2 (0.5, 0), p2 (1, 0)]+              [p2 (0, -1), p2 (1, -1)])+    , testCase "redundant square"+          (offsetTrailVertices+              [p2 (0, 0), p2 (1, 0), p2 (1, 0.5), p2 (1, 1), p2 (0, 1), p2 (0, 0)]+              [p2 (0, -1), p2 (2, -1), p2 (2, 2), p2 (-1, 2), p2 (-1, 0)])+    , testCase "redundant square loop"+          (offsetTrailLoopVertices+              [p2 (0, 0), p2 (1, 0), p2 (1, 0.5), p2 (1, 1), p2 (0, 1), p2 (0, 0)]+              [p2 (2, -1), p2 (2, 2), p2 (-1, 2), p2 (-1, -1)])+    ]++offsetTrailVertices :: [Point V2 Double] -> [Point V2 Double] -> Assertion+offsetTrailVertices orig off =+    (trailVertices . offsetTrail 1 . fromVertices $ orig) @?= off++offsetTrailLoopVertices :: [Point V2 Double] -> [Point V2 Double] -> Assertion+offsetTrailLoopVertices orig off =+    (trailVertices . offsetTrail 1 . loopTrailFromVertices $ orig) @?= off+  where+    loopTrailFromVertices = (`at` origin) . wrapTrail . glueLine . lineFromVertices
+ test/Test.hs view
@@ -0,0 +1,10 @@+import Test.Tasty (defaultMain, testGroup, TestTree)++import qualified Diagrams.TwoD.OffsetTest as TwoD.OffsetTest++tests :: TestTree+tests = testGroup "unit tests"+    [ testGroup "TwoD.Offset" TwoD.OffsetTest.tests ]++main :: IO ()+main = defaultMain tests