dia-functions 0.2.1 → 0.2.1.1
raw patch · 3 files changed
+25/−4 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
Graphics/Diagrams/FunctionGraphs.hs view
@@ -1,8 +1,9 @@--- | Display function graphs+-- | Display function graphs and arcs {-# LANGUAGE ScopedTypeVariables #-} module Graphics.Diagrams.FunctionGraphs where import Graphics.Diagrams+--import Data.List (groupBy) ------------------------- @@ -89,5 +90,23 @@ , not (i && j) ] +{- because of an SVG error we can't do this more compact rendering:+joinPoints points = union segments+ where+ vectors = zipWith (\(a1,a2) (b1,b2) -> (b1-a1, b2-a2)) points (drop 1 points) + cont = zipWith f vectors (drop 1 vectors) where + (a1,a2) `f` (b1,b2) + = (a1*b1 + a2*b2) / sqrt ((a1*a1 + a2*a2)*(b1*b1 + b2*b2)) > 0.5++ join = True : zipWith (||) cont (drop 1 cont)++ segments+ = map (mkSegment . map snd) $ groupBy (const fst) $ zip join $ drop 1 points++ mkSegment [z] = dot z+ mkSegment l = polyline l <|> dot (head l) <|> dot (last l)++ dot z = circle 0.1 `move` z +-}
Graphics/Diagrams/SVG.hs view
@@ -15,6 +15,7 @@ import Data.Char (intToDigit, showLitChar, ord) import Data.List (intercalate, groupBy, sortBy) import Data.Function (on)+import Numeric (showFFloat) ------------------------- @@ -42,7 +43,7 @@ showF :: Double -> String-showF x = show (realToFrac x :: Float)+showF x = showFFloat (Just 3) x "" showColor :: Color -> String showColor (Color s) = s
dia-functions.cabal view
@@ -1,13 +1,14 @@ name: dia-functions-version: 0.2.1+version: 0.2.1.1 category: Graphics, Education synopsis: An EDSL for teaching Haskell with diagrams - functions description: This package contains diagram manipulating functions and an SVG backend. .- For exaples see <http://pnyf.inf.elte.hu/fp/Diagrams_en.xml>+ For exaples see <http://pnyf.inf.elte.hu/fp/Diagrams_en.xml> and <http://pnyf.inf.elte.hu/fp/FunctionGraphs_en.xml> .+ Changes since 0.2: Emit smaller floating point literals in SVG render; export more functions. Changes since 0.1: Reimplement the Graphics.Diagrams.FunctionGraphs module. stability: alpha license: BSD3