graph-rewriting-layout 0.4.2 → 0.4.3
raw patch · 3 files changed
+5/−3 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- GraphRewriting/Layout/Rotation.hs +2/−1
- GraphRewriting/Layout/Wrapper.hs +2/−1
- graph-rewriting-layout.cabal +1/−1
GraphRewriting/Layout/Rotation.hs view
@@ -33,10 +33,11 @@ momentum a impulse = Rotation . (+) (signum a * impulse (abs a)) . rotation angle ∷ Vector2 → Vector2 → Angle-angle u v = sign ⋅ (acos $ vdot a b) where+angle u v = sign ⋅ (acos $ bound $ vdot a b) where sign = signum $ v2y b ⋅ v2x a - v2y a ⋅ v2x b a = vnormalise u b = vnormalise v+ bound x = max (-1) (min 1 x) -- due to a rounding error in (vdot a b), acos might yield NaN rotate ∷ Angle → Vector2 → Vector2 rotate a (Vector2 x y) = Vector2 (x ⋅ cos a - y ⋅ sin a) (x ⋅ sin a + y ⋅ cos a)
GraphRewriting/Layout/Wrapper.hs view
@@ -46,4 +46,5 @@ wrapGraph ∷ Graph n → Graph (Wrapper n) wrapGraph = unsafeMapNodesUnique wrapNode where wrapNode k n = Wrapper {wRot = Rotation 0, wPos = Position $ genPos k, wrappee = n}- genPos k = let f = fromIntegral k in rotate f (fromScalar f)+ genPos k = rotate (fromIntegral k) (fromScalar f)+ where f = fromIntegral $ k `mod` 3
graph-rewriting-layout.cabal view
@@ -1,5 +1,5 @@ Name: graph-rewriting-layout-Version: 0.4.2+Version: 0.4.3 Copyright: (c) 2010, Jan Rochel License: BSD3 License-File: LICENSE