HOME | DD

FlyingMatthew — Interdimensional Spiral

#fractalart #space #spiral #fractview
Published: 2021-05-25 11:42:16 +0000 UTC; Views: 1485; Favourites: 22; Downloads: 6
Redirect to original
Description (abs z, p.x) + zlast abs p.y 

FractView for Android 

My first entry for the  A NEW SPIRAL Contest at www.deviantart.com/xtremefract…

{"source":["// Min/Max Orbit trap: determines the minimum and maximum distance","// to the given trap. This one is in fact very similar to TwoFold","var x int, y int, color int;","","extern maxdepth int \u003d 120;","","// some further arguments","extern juliaset bool \u003d false;","extern juliapoint cplx \u003d -0.8:0.16;","","func escapetime(c, breakcondition) {"," var i int \u003d 0,"," p cplx \u003d juliapoint if juliaset 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","}","","// Here starts the script specific part","","func get_color(c, value) { ",""," var trapmin real \u003d bailout;"," var trapminpoint \u003d 0:0;"," var trapminindex \u003d -1;"," "," var trapmax real \u003d 0;"," var trapmaxpoint \u003d 0:0;"," var trapmaxindex \u003d -1;",""," // draw single pixel"," func breakcondition(i, znext, z, zlast, c, p, color) {"," // if true, color contains the lab color (quat)"," "," func bailoutcolor() {"," extern bailout real \u003d 128;"," extern max_power real \u003d 2;",""," // the next ones are only used in 3d-fractals"," extern bailoutvalue expr \u003d \"log(1 + trapmin)\";"," value \u003d bailoutvalue ;",""," extern bailouttransfer expr \u003d"," \"arcnorm trapminpoint : value\";",""," extern bailoutpalette palette \u003d ["," [#260126, #59323c , #f2eeb3 , #bfaf80 , #8c6954 ],"," [#008, #fff , #400, #ff8 , #000]];"," "," 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 \"trapmax\";"," value \u003d lakevalue;"," "," extern laketransfer expr \u003d "," \"arcnorm trapmaxpoint : value\";",""," extern lakepalette palette \u003d ["," [#260126, #59323c , #f2eeb3 , #bfaf80 , #8c6954 ],"," [#008, #fff , #400, #ff8 , #000]];",""," color \u003d lakepalette laketransfer"," }",""," // update trap"," func updatetrap() {"," extern trapfn expr \u003d \"line(0:0, 1:0, znext)\";"," "," var trapval real \u003d trapfn;",""," if trapval \u003c trapmin then {"," trapminindex \u003d i;"," trapminpoint \u003d znext;"," trapmin \u003d trapval;"," };"," "," if trapval \u003e trapmax then {"," trapmaxindex \u003d i;"," trapmaxpoint \u003d znext;"," trapmax \u003d trapval;"," };"," }",""," updatetrap();",""," { lakecolor() ; true } if not next(i, maxdepth) else"," radrange(znext, z, bailout, epsilon, bailoutcolor(), lakecolor())",""," }",""," escapetime(c, breakcondition)","}","","// ******************************************","// * 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":[0.5666,-0.5]},"bools":{"juliaset":false},"exprs":{"mandelinit":"c","trapfn":"dist(znext, floor(znext + 0.5:0.5))","function":"mandelbrot(abs z, p.x) + zlast abs p.y","bailouttransfer":"arcnorm trapminpoint : value^-p"},"palettes":{"bailoutpalette":{"width":9,"height":6,"colors":[-16777216,-1,-16777216,-16061456,-1888598,-16061456,-16777216,-1,-16777216,-16777216,-1,-16777216,-1244927,-14215947,-1244927,-16777216,-1,-16777216,-16777216,-1,-16777216,-8449,-66048,-8449,-16777216,-1,-16777216,-16777216,-1,-16777216,-2490243,-13875785,-2490243,-16777216,-1,-16777216,-16777216,-1,-16777216,-2656371,-6660358,-2656371,-16777216,-1,-16777216,-16777216,-1,-16777216,-2090510,-10122787,-2090510,-16777216,-1,-16777216]}},"scales":{"Scale":[-7.164308632786009E-6,1.2514495112690937E-5,-1.2514495112690937E-5,-7.164308632786009E-6,-1.7698953793854424,-0.008478895878872562]}}}
Related content
Comments: 2

Leanndra51 [2021-05-25 15:55:35 +0000 UTC]

👍: 0 ⏩: 1

FlyingMatthew In reply to Leanndra51 [2021-05-29 10:55:16 +0000 UTC]

👍: 1 ⏩: 0