hfractal 0.4.2.1 → 0.4.2.2
raw patch · 2 files changed
+19/−2 lines, 2 files
Files
- hfractal.cabal +2/−2
- src/PointComp.hs +17/−0
hfractal.cabal view
@@ -1,5 +1,5 @@ name: hfractal-version: 0.4.2.1+version: 0.4.2.2 cabal-version: >= 1.2 synopsis: OpenGL fractal renderer description: An OpenGL fractal browser with multicore support and the capability to output high quality png images.@@ -16,6 +16,6 @@ Executable hfractal main-is: Hfractal.hs build-depends: base >=3 && <5, array, gd < 3000.3.0 && >= 3000.2.0, data-accessor >=0.2, data-accessor-template >=0.2, OpenGL >= 2.3, OpenGLRaw < 1.1.0.0, GLUT >= 2.2.1.0, colour >=2.3.1, containers >= 0.2- other-Modules: FracComp, FracColour, FracImg, FracState, Bindings+ other-Modules: FracComp, FracColour, FracImg, FracState, Bindings, PointComp ghc-options: -O2 -threaded -fvia-C -optc-O3 -optc-ffast-math Hs-Source-Dirs: src
+ src/PointComp.hs view
@@ -0,0 +1,17 @@+{-# LANGUAGE BangPatterns #-}+module PointComp+ where+{- Module for computing fractal functions at an indivdual point -}++-- Number of iterations to escape+mandPoint :: Double -> Double -> Int -> Double+mandPoint cx cy mi | inCardiod cx cy = 0.0+ | otherwise = go 0 0.0 0.0 where+ inCardiod cx cy = q * (q + (cx - 0.25)) < 0.25 * cy * cy where+ q = (cx - 0.25) * (cx - 0.25) + cy*cy+ go !n !x !y | x2 + y2 > 4.0 = 1.0 - logBase 2 (0.5 * logBase 2 (x2 + y2)) + fromIntegral n+ | n > mi = 0.0+ | otherwise = go (n+1) (x2 - y2 + cx) (2.0*x*y + cy) where+ !x2 = x*x + !y2 = y*y --This CSE saves a few cycles+