HOME | DD

FlyingMatthew — Dreams of Haunted Spirals

#fractalart #fractview
Published: 2019-04-19 13:13:45 +0000 UTC; Views: 431; Favourites: 22; Downloads: 5
Redirect to original
Description Perpendicular Mandelbrot Reciprocal

FractView  for Android 

This is a submission for the April Monthly Theme "Dreams and Nightmares" at  

{"source":["// Default Preset","// This is a good start for all kinds of fractals","// including newton sets, nova fractals and others.","var x int, y int, color int;","","","extern maxdepth int \u003d 120;","","// some further arguments","extern juliaset bool \u003d false;","extern reciprocal bool \u003d false;","extern juliapoint cplx \u003d -0.8:0.16;","","// c: coordinates, breakcondition: a function whether we should stop, ","// value: a real variable to return some kind of value","// used in 3d-types for the height.","// returns a quat representing the color","func escapetime(c, breakcondition) {"," var i int \u003d 0,"," p cplx \u003d juliapoint if juliaset else "," (/c + juliapoint) if reciprocal else"," c,"," zlast cplx \u003d 0,"," z cplx,"," znext cplx \u003d 0;",""," extern mandelinit expr \u003d \"0\";",""," z \u003d c if juliaset else mandelinit;",""," extern function expr \u003d \"mandelbrot(z, p)\";",""," var color quat;",""," while {"," znext \u003d function;"," not breakcondition(i, znext, z, zlast, c, p, color)"," } do {"," // advance to next values"," zlast \u003d z;"," z \u003d znext;"," }",""," // return color"," color","}","","// everything that is drawn must have a get_color-function.","","// c \u003d coordinates (scaled)","// value is a real variable for z-information in 3D","// but also otherwise convenient to separate drawing","// algorithm from transfer","// returns color.","func get_color(c, value) {",""," // if the fractal accumulates some values"," // like in traps or addends, here is a got place to do it.",""," func breakcondition(i, znext, z, zlast, c, p, color) {"," func bailoutcolor() {"," extern bailout real \u003d 128;"," extern max_power real \u003d 2;"," var smooth_i \u003d smoothen(znext, bailout, max_power) ;",""," // the next ones are only used in 3d-fractals"," extern bailoutvalue expr \u003d \"log(20 + i + smooth_i)\";"," value \u003d bailoutvalue ;"," "," extern bailouttransfer expr \u003d \"value\";",""," extern bailoutpalette palette \u003d ["," [#006, #26c , #fff , #fa0 , #303]];"," "," color \u003d bailoutpalette bailouttransfer"," }",""," func lakecolor() {"," extern epsilon real \u003d 1e-9;"," "," // the next ones are only used in 3d-fractals"," extern lakevalue expr \u003d \"log(1 + rad znext)\";"," value \u003d lakevalue;",""," extern laketransfer expr \u003d"," \"arcnorm znext : value\";",""," extern lakepalette palette \u003d ["," [#000, #000, #000, #000],"," [#f00 , #ff0 , #0f8 , #00f ],"," [#f88 , #ff8 , #afc , #88f ]];",""," color \u003d lakepalette laketransfer"," }",""," { lakecolor() ; true } if not next(i, maxdepth) else"," radrange(znext, z, bailout, epsilon, bailoutcolor(), lakecolor())"," }"," "," escapetime(c, breakcondition)","}","","func get_color_test(c, value) {"," // this one is just here for testing light effects"," // circle + donut + green bg"," var rc \u003d rad c;"," "," { value \u003d (circlefn rc + 5); int2lab #0000ff } if rc \u003c 1 else"," { value \u003d circlefn abs (rc - 3); int2lab #ff0000 } if rc \u003d\u003c 4 and rc \u003e\u003d 2 else"," { value \u003d -10; int2lab #00ff00 }","}","","// ******************************************","// * Next are just drawing procedures. They *","// * should be the same for all drawings. * ","// ******************************************","","extern supersampling bool \u003d false;","extern light bool \u003d false;","","// drawpixel for 2D","func drawpixel_2d(x, y) { "," var c cplx \u003d map(x, y);"," var value real;"," get_color(c, value) // value is not used","}","","// drawpixel for 3D","func drawpixel_3d(x, y) {"," var c00 cplx \u003d map(x, y),"," c10 cplx \u003d map(x + 1, y + 0.5),"," c01 cplx \u003d map(x + 0.5, y + 1);"," "," var h00 real, h10 real, h01 real; // heights"," "," // color is already kinda super-sampled"," var color \u003d (get_color(c00, h00) + get_color(c10, h10) + get_color(c01, h01)) / 3;",""," // get height out of value"," func height(value) {"," extern valuetransfer expr \u003d \"value\";"," valuetransfer"," }"," "," h00 \u003d height h00; h01 \u003d height h01; h10 \u003d height h10;",""," // get the normal vector (cross product)"," var xp \u003d c10 - c00, xz \u003d h10 - h00;"," var yp \u003d c01 - c00, yz \u003d h01 - h00;"," "," var np cplx \u003d (xp.y yz - xz yp.y) : (xz yp.x - xp.x yz);"," var nz real \u003d xp.x yp.y - xp.y yp.x;"," "," // normalize np and nz"," var nlen \u003d sqrt(rad2 np + sqr nz);"," np \u003d np / nlen; nz \u003d nz / nlen;"," "," // get light direction"," extern lightvector cplx \u003d -0.667 : -0.667; // direction from which the light is coming"," def lz \u003d sqrt(1 - sqr re lightvector - sqr im lightvector); // this is inlined",""," // Lambert\u0027s law."," var cos_a real \u003d dot(lightvector, np) + lz nz;",""," // diffuse reflexion with ambient factor"," extern lightintensity real \u003d 1;"," extern ambientlight real \u003d 0.5;",""," // if lumen is negative it is behind, "," // but I tweak it a bit for the sake of the looks:"," // cos_a \u003d -1 (which is super-behind) \u003d\u003d\u003e 0"," // cos_a \u003d 0 \u003d\u003d\u003e ambientlight"," // cos_a \u003d 1 \u003d\u003d\u003e lightintensity",""," // for a mathematically correct look use the following:"," // if cos_a \u003c 0 then cos_a \u003d 0;"," // color.a \u003d color.a * (ambientlight + lightintensity lumen);"," "," def d \u003d lightintensity / 2; // will be inlined later",""," // Change L in Lab-Color"," color.a \u003d color.a (((d - ambientlight) cos_a + d) cos_a + ambientlight);",""," // Next, specular reflection. Viewer is always assumed to be in direction (0,0,1)"," extern specularintensity real \u003d 1;",""," extern shininess real \u003d 8;",""," // r \u003d 2 n l - l; v \u003d 0:0:1"," var spec_refl \u003d 2 cos_a nz - lz;"," "," // 100 because L in the Lab-Model is between 0 and 100"," if spec_refl \u003e 0 then"," color.a \u003d color.a + 100 * specularintensity * spec_refl ^ shininess;",""," color","}","","func do_pixel(x, y) {"," // two or three dimensions?"," def drawpixel \u003d drawpixel_3d if light else drawpixel_2d;"," "," func drawaapixel(x, y) {"," 0.25 ("," drawpixel(x - 0.375, y - 0.125) + "," drawpixel(x + 0.125, y - 0.375) + "," drawpixel(x + 0.375, y + 0.125) +"," drawpixel(x - 0.125, y + 0.375) "," );"," }",""," // which function to apply?"," def fn \u003d drawpixel if not supersampling else drawaapixel;",""," color \u003d lab2int fn(x, y)","}","","// and finally call the draing procedure","do_pixel(x, y)"],"arguments":{"ints":{"maxdepth":1200},"cplxs":{"juliapoint":[-9.5E-4,2.996541]},"bools":{"reciprocal":true},"exprs":{"mandelinit":"c","function":"mandelbrot(conj rabs z, p)","bailouttransfer":"value + p^value "},"palettes":{"bailoutpalette":{"width":6,"height":4,"colors":[-16711930,-327935,-559357,-851968,-520726,-16776961,-16777216,-16777216,-16777216,-16777216,-16777216,-16777216,-16777216,-16777216,-16777216,-16777216,-16777216,-16777216,-1868,-14690,-18245,-3968834,-5721857,-5309783]},"lakepalette":{"width":8,"height":3,"colors":[-16777216,-16777216,-7470849,-459008,-7536385,-16777216,-1,-16777216,-15658736,-2634803,-470024,-16710911,-13996754,-6275691,-3224577,-9710197,-11782068,-16447739,-1031539,-15130853,-16710138,-5055847,-9631486,-15782880]}},"scales":{"Scale":[-6.387856203240984E-9,-2.7808621795913943E-9,2.7808621795913943E-9,-6.387856203240984E-9,-0.10834271732731854,0.28793998111429414]}}}
Related content
Comments: 13

ratinrage [2019-05-12 07:33:06 +0000 UTC]

  

👍: 0 ⏩: 1

FlyingMatthew In reply to ratinrage [2019-05-12 10:17:02 +0000 UTC]

I'm Glad you Enjoyed it 

👍: 0 ⏩: 0

senafoxx [2019-04-22 20:48:33 +0000 UTC]

Super...!! 🦊

👍: 0 ⏩: 1

FlyingMatthew In reply to senafoxx [2019-04-24 12:01:48 +0000 UTC]

I'm Glad you Enjoyed it 

👍: 0 ⏩: 0

GLO-HE [2019-04-20 07:13:13 +0000 UTC]

very Wonderful!!!

👍: 0 ⏩: 1

FlyingMatthew In reply to GLO-HE [2019-04-20 12:24:05 +0000 UTC]

Thank you  

👍: 0 ⏩: 1

GLO-HE In reply to FlyingMatthew [2019-04-22 20:31:40 +0000 UTC]

Always Welvome    

👍: 0 ⏩: 0

Astronomiseme--Stock [2019-04-19 13:49:57 +0000 UTC]

👍: 0 ⏩: 1

FlyingMatthew In reply to Astronomiseme--Stock [2019-04-19 13:52:00 +0000 UTC]

Thank you, I'm Glad you Enjoyed it  

👍: 0 ⏩: 0

ChasMandala [2019-04-19 13:20:37 +0000 UTC]

For me, it's definitely 'dream' rather than 'nightmare' ~ ~ great work as always, Matthew ~

👍: 0 ⏩: 1

FlyingMatthew In reply to ChasMandala [2019-04-19 13:46:47 +0000 UTC]

Thank you Charles, I'm Glad you Enjoyed it 

👍: 0 ⏩: 1

ChasMandala In reply to FlyingMatthew [2019-04-20 16:29:28 +0000 UTC]

You're very welcome, Matthew - you always give us something wonderful to gaze upon ~

👍: 0 ⏩: 1

FlyingMatthew In reply to ChasMandala [2019-04-21 12:05:48 +0000 UTC]

 

👍: 0 ⏩: 0