mars 0.1.0.4 → 0.2.0.0
raw patch · 4 files changed
+41/−14 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
- Graphics.Mars.Graph: graph :: Int -> Int -> Float -> Float -> Int -> Int -> Float -> IO (UArray (Int, Int) Float)
+ Graphics.Mars.Graph: graph :: Int -> Int -> Float -> Float -> Int -> Int -> Float -> (Float, Float) -> IO (UArray (Int, Int) Float)
Files
- Graphics/Mars/Example.hs +26/−11
- Graphics/Mars/Graph.hs +3/−2
- changelog.md +9/−0
- mars.cabal +3/−1
Graphics/Mars/Example.hs view
@@ -22,9 +22,9 @@ -- intensity graph -- -- @--- example2D :: IO()--- example2D = do a <- graph height width radius walkfactor seed iterations scalefactor--- displayWindow (width, height) black \"Mars\"+-- example2D = do a <- graph height width radius walkfactor+-- seed iterations scalefactor startingpoint+-- displayWindow (width, height) black "Mars" -- (toImage a (lightnessInt hue (minMax (elems a)))) -- where (width, height) = (300, 300) -- radius = 30@@ -33,9 +33,11 @@ -- hue = 272 -- iterations = 200 -- scalefactor = 1+-- startingpoint = (0, 0) -- @ example2D :: IO()-example2D = do a <- graph height width radius walkfactor seed iterations scalefactor+example2D = do a <- graph height width radius walkfactor+ seed iterations scalefactor startingpoint displayWindow (width, height) black "Mars" (toImage a (lightnessInt hue (minMax (elems a)))) where (width, height) = (300, 300)@@ -45,22 +47,26 @@ hue = 272 iterations = 200 scalefactor = 1+ startingpoint = (0, 0) -- |Generates a random walk array, converts it PLY ascii format, and output the -- PLY to a file called \"out.ply\". -- -- @--- examplePly = do a <- graph height width radius walkfactor seed iterations scalefactor--- writeFile \"out.ply\" $ (toPly . surface) a+-- examplePly = do a <- graph height width radius walkfactor+-- seed iterations scalefactor startingpoint+-- writeFile "out.ply" $ (toPly . surface) a -- where (width, height) = (400, 400) -- radius = 10 -- walkfactor = 10 -- seed = 4748830300 -- iterations = 400 -- scalefactor = 1+-- startingpoint = (0, 0) -- @ examplePly :: IO ()-examplePly = do a <- graph height width radius walkfactor seed iterations scalefactor+examplePly = do a <- graph height width radius walkfactor+ seed iterations scalefactor startingpoint writeFile "out.ply" $ (toPly . surface) a where (width, height) = (400, 400) radius = 10@@ -68,9 +74,11 @@ seed = 4748830300 iterations = 400 scalefactor = 1+ startingpoint = (0, 0) examplePly2 :: IO ()-examplePly2 = do a <- graph height width radius walkfactor seed iterations scalefactor+examplePly2 = do a <- graph height width radius walkfactor+ seed iterations scalefactor startingpoint writeFile "out2.ply" $ (toPly . surface) a where (width, height) = (400, 400) radius = 10@@ -78,9 +86,11 @@ seed = 84934 iterations = 400 scalefactor = 1+ startingpoint = (0, 0) examplePly3 :: IO ()-examplePly3 = do a <- graph height width radius walkfactor seed iterations scalefactor+examplePly3 = do a <- graph height width radius walkfactor+ seed iterations scalefactor startingpoint writeFile "out3.ply" $ (toPly . surface) a where (width, height) = (400, 400) radius = 10@@ -88,9 +98,11 @@ seed = 49409484 iterations = 2000 scalefactor = 1+ startingpoint = (0, 0) examplePly4 :: IO ()-examplePly4 = do a <- graph height width radius walkfactor seed iterations scalefactor+examplePly4 = do a <- graph height width radius walkfactor+ seed iterations scalefactor startingpoint writeFile "out4.ply" $ (toPly . surface) a where (width, height) = (600, 600) radius = 10@@ -98,11 +110,13 @@ seed = 1829384 iterations = 4000 scalefactor = 1+ startingpoint = (0, 0) -- |Warning: Large output file with 1 million vertices! May take a -- while to complete, with 40000 iterations. examplePly5 :: IO ()-examplePly5 = do a <- graph height width radius walkfactor seed iterations scalefactor+examplePly5 = do a <- graph height width radius walkfactor+ seed iterations scalefactor startingpoint writeFile "out5.ply" $ (toPly . surface) a where (width, height) = (1000, 1000) radius = 15@@ -110,3 +124,4 @@ seed = 74830949937 iterations = 40000 scalefactor = 0.5+ startingpoint = ((-250), 250)
Graphics/Mars/Graph.hs view
@@ -28,11 +28,12 @@ -> Int -- ^ a seed value for the random number generator -> Int -- ^ numbers of steps to take in random walk -> Float -- ^ magnification factor+ -> (Float, Float) -- ^ Starting point -> IO (UArray (Int, Int) Float)-graph height width radius walkfactor seed iterations scalefactor+graph height width radius walkfactor seed iterations scalefactor sp = do a <- (newArray ((0, 0), (height, width)) 0.0 :: IO (IOUArray (Int, Int) Float)) stampL a (circleStamp (radius * scalefactor) :: UArray (Int, Int) Float) (take iterations [ (round (f1 + (fromIntegral height) * 0.5), round (f2 + (fromIntegral width) * 0.5))- | (f1, f2) <- walk walkfactor (0, 0) (mkStdGen seed) ])+ | (f1, f2) <- walk walkfactor sp (mkStdGen seed) ]) freeze a
+ changelog.md view
@@ -0,0 +1,9 @@+# Changelog for [`mars` package](http://hackage.haskell.org/package/mars)++## 0.2.0.0 *Aug 2016*++ * Breaking modification of parameters for `Graphics.Mars.Graph.graph`,+ allowing choice of start position.+ * Internal modifications to `Graphics.Mars.Example` examples, to adjust+ for new graph function, and to modify the appearance of one+ example.
mars.cabal view
@@ -10,7 +10,7 @@ -- PVP summary: +-+------- breaking API changes -- | | +----- non-breaking API additions -- | | | +--- code changes with no API change-version: 0.1.0.4+version: 0.2.0.0 -- A short (one-line) description of the package. synopsis: Generates mountainous terrain using a random walk algorithm.@@ -22,6 +22,8 @@ on Mars\". The data can be output as an ascii-format PLY file, or viewed \"overhead\" as an intensity graph. The PLY file can be loaded into a 3D modeling program such as Blender.++extra-source-files: changelog.md -- URL for the project homepage or repository. homepage: https://qlfiles.net