mars-0.2.0.0: Generates mountainous terrain using a random walk algorithm.

Maintainerch.howard@zoho.com
Safe HaskellNone

Graphics.Mars.Example

Description

Run an example function to view an image, or study the function source code for to see how the library can be used.

Synopsis

Documentation

example2D :: IO ()Source

Generates an example random walk array and displays it as a 2-dimensional intensity graph

 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
         walkfactor = 30
         seed = 9484
         hue = 272
         iterations = 200
         scalefactor = 1
         startingpoint = (0, 0)

examplePly :: IO ()Source

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 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)

examplePly5 :: IO ()Source

Warning: Large output file with 1 million vertices! May take a while to complete, with 40000 iterations.