From 7a680efa1b5870f43dae034005407e18fa1e7d04 Mon Sep 17 00:00:00 2001 From: Erik Reckase Date: Wed, 4 May 2011 11:51:04 -0600 Subject: [PATCH 1/8] added a few more vars, also fixed waves since it was referring to precalc'd parameters --- cuburn/code/variations.py | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/cuburn/code/variations.py b/cuburn/code/variations.py index 898538c..9c31452 100644 --- a/cuburn/code/variations.py +++ b/cuburn/code/variations.py @@ -121,8 +121,13 @@ var(14, 'bent', """ var(15, 'waves', """ float c10 = {{px.get(None, 'pre_xy')}}; float c11 = {{px.get(None, 'pre_yy')}}; - ox += w * (tx + c10 + sinf(ty * {{px.get('xf.waves_dx2')}})); - oy += w * (ty + c11 + sinf(tx * {{px.get('xf.waves_dy2')}})); + float dx = {{px.get(None, 'pre_xo')}}; + float dy = {{px.get(None, 'pre_yo')}}; + float dx2 = 1.0f / (dx * dx); + float dy2 = 1.0f / (dy * dy); + + ox += w * (tx + c10 + sinf(ty * dx2)); + oy += w * (ty + c11 + sinf(tx * dy2)); """) var(16, 'fisheye', """ @@ -238,6 +243,7 @@ var(29, 'cylinder', """ ox += w * sinf(tx); oy += w * ty; """) + var(30, 'perspective', """ float pdist = {{px.get('xf.perspective_dist')}}; float pvsin = {{px.get('np.sin(xf.perspective_angle*np.pi/2)', 'pvsin')}}; @@ -249,6 +255,25 @@ var(30, 'perspective', """ oy += w * pvfcos * ty * t; """) +var(31, 'noise', """ + float tmpr = mwc_next_01(rctx) * 2.0f * M_PI; + float r = w * mwc_next_01(rctx); + ox += tx * r * cosf(tmpr); + oy += ty * r * sinf(tmpr); + """) + +var(32, 'julian', """ + float power = {{px.get('xf.julian_power')}}; + float t_rnd = truncf(mwc_next_01(rctx) * fabsf(power)); + float a = atan2f(ty, tx); + float tmpr = (a + 2.0f * M_PI * t_rnd) / power; + float cn = {{px.get('xf.julian_dist / xf.julian_power / 2', 'julian_cn')}}; + float r = w * powf(tx * tx + ty * ty, cn); + + ox += r * cosf(tmpr); + oy += r * sinf(tmpr); + """) + var(33, 'juliascope', """ float ang = atan2f(ty, tx); float power = {{px.get('xf.juliascope_power', 'juscope_power')}}; From 645222af47c8db70512395972df4bcd557f9cab8 Mon Sep 17 00:00:00 2001 From: Erik Reckase Date: Wed, 4 May 2011 12:05:51 -0600 Subject: [PATCH 2/8] added some blur variations, up to 36. --- cuburn/code/variations.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/cuburn/code/variations.py b/cuburn/code/variations.py index 9c31452..4230d73 100644 --- a/cuburn/code/variations.py +++ b/cuburn/code/variations.py @@ -290,3 +290,31 @@ var(33, 'juliascope', """ oy += r * sinf(tmpr); """) +var(34, 'blur', """ + float tmpr = mwc_next_01(rctx) * 2.0f * M_PI; + float r = w * mwc_next_01(rctx); + ox += r * cosf(tmpr); + oy += r * sinf(tmpr); + """) + +var(35, 'gaussian', """ + float ang = mwc_next_01(rctx) * 2.0f * M_PI; + float r = weight * ( mwc_next_01(rctx) + mwc_next_01(rctx) + + mwc_next_01(rctx) + mwc_next_01(rctx) - 2.0f ); + ox += r * cosf(ang); + oy += r * sinf(ang); + """) + +var(36, 'radial_blur', """ + float blur_angle = {{px.get('xf.radial_blur_angle')}} * M_PI * 0.5f; + float spinvar = sinf(blur_angle); + float zoomvar = cosf(blur_angle); + float r = weight * ( mwc_next_01(rctx) + mwc_next_01(rctx) + + mwc_next_01(rctx) + mwc_next_01(rctx) - 2.0f ); + float ra = sqrtf(tx*tx + ty*ty); + float tmpa = atan2f(ty, tx) + spinvar * r; + float rz = zoomvar * r - 1.0f; + ox += ra*cosf(tmpa) + rz*tx; + oy += ra*sinf(tmpa) + rz*ty; + """) + From d0084aab17462564115e6410b8f2543bf7f1f988 Mon Sep 17 00:00:00 2001 From: Erik Reckase Date: Wed, 4 May 2011 14:43:17 -0600 Subject: [PATCH 3/8] vars done through 49. skipping twintrian for now. --- cuburn/code/variations.py | 123 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 123 insertions(+) diff --git a/cuburn/code/variations.py b/cuburn/code/variations.py index 4230d73..dee5a81 100644 --- a/cuburn/code/variations.py +++ b/cuburn/code/variations.py @@ -318,3 +318,126 @@ var(36, 'radial_blur', """ oy += ra*sinf(tmpa) + rz*ty; """) +var(37, 'pie', """ + float slices = {{px.get('xf.pie_slices')}}; + float sl = truncf(mwc_next_01(rctx) * slices + 0.5f); + float a = {{px.get('xf.pie_rotation')}} + + 2.0f * M_PI * (sl + mwc_next_01(rctx) + {{px.get('xf.pie_thickness')}} / slices; + float r = w * mwc_next_01(rctx); + ox += r * cosf(a); + oy += r * sinf(a); + """) + +var(38, 'ngon', """ + float power = {{px.get('xf.ngon_power')}} * 0.5f + float b = 2.0f * M_PI / {{px.get('xf.ngon_sides')}} + float corners = {{px.get('xf.ngon_corners')}} + float circle = {{px.get('xf.ngon_circle')}} + + float r_factor = powf(tx*tx + ty*ty, power); + float theta = atan2f(ty, tx); + float phi = theta - b * floorf(theta/b); + if (phi > b/2.0f) phi -= b; + float amp = (corners * (1.0f / cosf(phi) - 1.0f) + circle) / r_factor; + + ox += w * tx * amp; + oy += w * ty * amp; + """} + +var(39, 'curl', """ + float c1 = {{px.get('xf.curl_c1')}}; + float c2 = {{px.get('xf.curl_c2')}}; + + float re = 1.0f + c1*tx + c2*(tx*tx - ty*ty); + float im = c1*ty + 2.0f*c2*tx*ty; + float r = w / (re*re + im*im); + + ox += r * (tx*re + ty*im); + oy += r * (ty*re + tx*im); + """) + +var(40, 'rectangles', """ + float rx = {{px.get('xf.rectangles_x')}}; + float ry = {{px.get('xf.rectangles_y')}}; + + ox += w * ( (rx==0.0f) ? tx : rx * (2.0f * floorf(tx/rx) + 1.0f) - tx); + oy += w * ( (ry==0.0f) ? ty : ry * (2.0f * floorf(ty/ry) + 1.0f) - ty); + """) + +var(41, 'arch', """ + float ang = mwc_next_01(rctx) * w * M_PI; + + ox += w * sinf(ang); + oy += w * sinf(ang) * sinf(ang) / cosf(ang); + """) + +var(42, 'tangent', """ + ox += w * sinf(tx) / cosf(ty); + oy += w * tanf(ty); + """) + +var(43, 'square', """ + ox += w * (mwc_next_01(rctx) - 0.5f); + oy += w * (mwc_next_01(rctx) - 0.5f); + """) + +var(44, 'rays', """ + float ang = w * mwc_next_01(rctx) * M_PI; + float r = w / (tx*tx + ty*ty); + float tanr = w * tanf(ang) * r; + ox += tanr * cosf(tx); + oy += tanr * sinf(ty); + """) + +var(45, 'blade', """ + float r = mwc_next_01(rctx) * w * sqrtf(tx*tx + ty*ty); + ox += w * tx * (cosf(r) + sinf(r)); + oy += w * tx * (cosf(r) - sinf(r)); + """) + +var(46, 'secant2', """ + float r = w * sqrtf(tx*tx + ty*ty); + float cr = cosf(r); + float icr = 1.0f / cr; + icr += (cr < 0 ? 1 : -1); + + ox += w * tx; + oy += w * icr; + """) + +# var 47 is twintrian, has a call to badvalue in it + +var(48, 'cross', """ + float s = tx*tx - ty*ty; + float r = w * sqrtf(1.0f / (s*s)); + + ox += r * tx; + oy += r * ty; + """) + +var(49, 'disc2', """ + float twist = {{px.get('xf.disc2_twist')}}; + float rotpi = {{px.get('xf.disc2_rot * M_PI', 'disc2_rotpi')}}; + + float sintwist = sinf(twist); + float costwist = cosf(twist) - 1.0f; + + if (twist > 2.0f * M_PI) { + float k = (1.0f + twist - 2.0f * M_PI); + sintwist *= k; + costwist *= k; + } + + if (twist < -2.0f * M_PI) { + float k = (1.0f + twist + 2.0f * M_PI); + sintwist *= k; + costwist *= k; + } + + float t = rotpi * (tx + ty); + float r = w * atan2f(tx, ty) / M_PI; + + ox += r * (sinf(t) + costwist); + oy += r * (cosf(t) + sintwist); + """) + From 9f78f5225a01a0ba17d0b966cb486b9d8d990e26 Mon Sep 17 00:00:00 2001 From: Erik Reckase Date: Wed, 4 May 2011 16:18:29 -0600 Subject: [PATCH 4/8] vars done through 57 --- cuburn/code/variations.py | 116 +++++++++++++++++++++++++++++++++++++- 1 file changed, 114 insertions(+), 2 deletions(-) diff --git a/cuburn/code/variations.py b/cuburn/code/variations.py index dee5a81..3e5ab4f 100644 --- a/cuburn/code/variations.py +++ b/cuburn/code/variations.py @@ -112,8 +112,8 @@ var(13, 'julia', """ var(14, 'bent', """ float nx = 1.0f; if (tx < 0.0f) nx = 2.0f; - float ny = 1.0; - if (ty < 0.0f) ty = 0.5f; + float ny = 1.0f; + if (ty < 0.0f) ny = 0.5f; ox += w * nx * tx; oy += w * ny * ty; """) @@ -441,3 +441,115 @@ var(49, 'disc2', """ oy += r * (cosf(t) + sintwist); """) +var(50, 'super_shape', """ + float ang = atan2f(ty, tx); + float theta = 0.25f * ({{px.get('xf.super_shape_m')}} * ang + M_PI); + float t1 = fabsf(cosf(theta)); + float t2 = fabsf(sinf(theta)); + t1 = powf(t1,{{px.get('xf.super_shape_n2')}}); + t2 = powf(t2,{{px.get('xf.super_shape_n3')}}); + float myrnd = {{px.get('xf.super_shape_rnd')}}; + float d = sqrtf(tx*tx+ty*ty); + + float r = w * ((myrnd*mwc_next_01(rctx) + (1.0f-myrnd)*d) - {{px.get('xf.super_shape_holes')}}) + * powf(t1+t2, {{px.get('-1.0 / xf.super_shape_holes', 'super_shape_pneg')}}) / d; + + ox += r * tx; + oy += r * ty; + """) + +var(51, 'flower', """ + float holes = {{px.get('xf.flower_holes')}}; + float petals = {{px.get('xf.flower_petals')}}; + + float r = w * (mwc_next_01(rctx) - holes) * cosf(petals*atan2f(ty, tx)) / sqrtf(tx*tx + ty*ty); + + ox += r * tx; + oy += r * ty; + """) + +var(52, 'conic', """ + float d = sqrtf(tx*tx + ty*ty); + float ct = tx / d; + float holes = {{px.get('xf.conic_holes')}}; + float eccen = {{px.get('xf.conic_eccentricity')}}; + + float r = w * (mwc_next_01(rctx) - holes) * eccen / (1.0f + eccen*ct) / d; + + ox += r * tx; + oy += r * ty; + """) + +var(53, 'parabola', """ + float r = sqrtf(tx*tx + ty*ty); + float sr = sinf(r); + float cr = cosf(r); + + ox += {{px.get('xf.parabola_height')}} * w * sr * sr * mwc_next_01(rctx); + oy += {{px.get('xf.parabola_width')}} * w * cr * mwc_next_01(rctx); + """) + +var(54, 'bent2', """ + float nx = 1.0f; + if (tx < 0.0f) nx = {{px.get('xf.bent2_x')}}; + float ny = 1.0f; + if (ty < 0.0f) ny = {{px.get('xf.bent2_y')}}; + ox += w * nx * tx; + oy += w * ny * ty; + """) + +var(55, 'bipolar', """ + float x2y2 = tx*tx + ty*ty; + float t = x2y2 + 1.0f; + float x2 = tx * 2.0f; + float ps = -M_PI_2 * {{px.get('xf.bipolar_shift')}} + float y = 0.5 * atan2f(2.0f * ty, x2y2 - 1.0f) + ps; + + if (y > M_PI_2) + y = -M_PI_2 + fmodf(y + M_PI_2, M_PI); + else if (y < -M_PI_2) + y = M_PI_2 - fmodf(M_PI_2 - y, M_PI); + + ox += w * 0.25f * M_2_PI * logf( (t+x2) / (t-x2) ); + oy += w * M_2_PI * y; + """) + +var(56, 'boarders', """ + float roundX = rintf(tx); + float roundY = rintf(ty); + float offsetX = tx - roundX; + float offsetY = ty - roundY; + + if (mwc_next_01(rctx) > 0.75f) { + ox += w * (offsetX*0.5f + roundX); + oy += w * (offsetY*0.5f + roundY); + } else { + if (fabsf(offsetX) >= fabsf(offsetY)) { + if (offsetX >= 0.0f) { + ox += w * (offsetX*0.5f + roundX + 0.25f); + oy += w * (offsetY*0.5f + roundY + 0.25f * offsetY / offsetX); + } else { + ox += w * (offsetX*0.5f + roundX - 0.25f); + oy += w * (offsetY*0.5f + roundY - 0.25f * offsetY / offsetX); + } + } else { + if (offsetY >= 0.0f) { + oy += w * (offsetY*0.5f + roundY + 0.25f); + ox += w * (offsetX*0.5f + roundX + offsetX / offsetY * 0.25f); + } else { + oy += w * (offsetY*0.5f + roundY - 0.25f); + ox += w * (offsetX*0.5f + roundX - offsetX / offsetY * 0.25f); + } + } + } + """) + +var(57, 'butterfly', """ + /* wx is weight*4/sqrt(3*pi) */ + float wx = w * 1.3029400317411197908970256609023f; + float y2 = ty * 2.0f + float r = wx * sqrtf(fabsf(ty * tx)/(tx*tx + y2*y2)); + ox += r * tx; + oy += r * y2; + """) + From 4f5d7efe2792da833f2418027da885e28fd0bbfa Mon Sep 17 00:00:00 2001 From: Erik Reckase Date: Thu, 5 May 2011 05:48:53 -0600 Subject: [PATCH 5/8] vars up to 67 complete --- cuburn/code/variations.py | 129 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 129 insertions(+) diff --git a/cuburn/code/variations.py b/cuburn/code/variations.py index 3e5ab4f..838af24 100644 --- a/cuburn/code/variations.py +++ b/cuburn/code/variations.py @@ -553,3 +553,132 @@ var(57, 'butterfly', """ oy += r * y2; """) +var(58, 'cell', """ + float cell_size = {{px.get('xf.cell_size')}} + float inv_cell_size = 1.0f/cell_size; + + /* calculate input cell */ + float x = floorf(tx * inv_cell_size); + float y = floorf(ty * inv_cell_size); + + /* Offset from cell origin */ + float dx = tx - x*cell_size; + float dy = ty - y*cell_size; + + /* interleave cells */ + if (y >= 0.0f) { + if (x >= 0.0f) { + y *= 2.0f; + x *= 2.0f; + } else { + y *= 2.0f; + x = -(2.0f*x+1.0f); + } + } else { + if (x >= 0.0f) { + y = -(2.0f*y+1.0f); + x *= 2.0f; + } else { + y = -(2.0f*y+1.0f); + x = -(2.0f*x+1.0f); + } + } + + ox += w * (dx + x*cell_size); + oy -= w * (dy + y*cell_size); + """) + +var(59, 'cpow', """ + float a = atan2f(ty, tx); + float lnr = 0.5f * logf(sqrtf(tx*tx+ty*ty)); + float power = {{px.get('xf.cpow_power')}} + float va = 2.0f * M_PI / power; + float vc = {{px.get('xf.cpow_r')}} / power; + float vd = {{px.get('xf.cpow_i')}} / power; + float ang = vc*a + vd*lnr + va*floorf(power*mwc_next_01(rctx)); + float m = w * expf(vc * lnr - vd * a); + ox += m * cosf(ang); + oy += m * sinf(ang); + """) + +var(60, 'curve', """ + float pc_xlen = {{px.get('xf.curve_xlength * xf.curve_xlength','pc_xlen')}}; + float pc_ylen = {{px.get('xf.curve_ylength * xf.curve_ylength','pc_ylen')}}; + + if (pc_xlen<1E-20f) pc_xlen = 1E-20f; + if (pc_ylen<1E-20f) pc_ylen = 1E-20f; + + ox += w * (tx + {{px.get('xf.curve_xamp')}} * expf(-ty*ty/pc_xlen)); + ox += w * (ty + {{px.get('xf.curve_yamp')}} * expf(-tx*tx/pc_ylen)); + """) + +var(61, 'edisc', """ + float tmp = tx*tx + ty*ty + 1.0f; + float tmp2 = 2.0f * tx; + float r1 = sqrtf(tmp+tmp2); + float r2 = sqrtf(tmp-tmp2); + float xmax = (r1+r2) * 0.5f; + float a1 = logf(xmax + sqrtf(xmax - 1.0f)); + float a2 = -acosf(tx/xmax); + float neww = w / 11.57034632f; + + float snv = sinf(a1); + float csv = cosf(a1); + if (ty > 0.0f) snv = -snv; + + ox += neww * coshf(a2) * csv; + oy += neww * sinhf(s2) * snv; + """) + +var(62, 'elliptic', """ + float tmp = tx*tx + ty*ty + 1.0f; + float x2 = 2.0f * tx; + float xmax = 0.5f * (sqrtf(tmp+x2) + sqrtf(tmp-x2)); + float a = tx / xmax; + float b = 1.0f - a*a; + float ssx = xmax - 1.0f; + float neww = w / M_PI_2; + + if (b < 0.0f) + b = 0.0f; + else + b = sqrtf(b); + + if (ssx < 0.0f) + ssx = 0.0f; + else + ssx = sqrtf(ssx); + + ox += neww * atan2f(a,b); + + if (ty > 0.0f) + oy += neww * logf(xmax + ssx); + else + oy -= neww * logf(xmax + ssx); + """) + +var(63, 'escher', """ + float a = atan2f(ty,tx); + float lnr = 0.5f * logf(tx*tx + ty*ty); + float ebeta = {{px.get('xf.escher_beta')}}; + float seb = sinf(ebeta); + float ceb = cosf(ebeta); + float vc = 0.5f * (1.0f + ceb); + float vd = 0.5f * seb; + float m = w * expf(vc*lnr - vd*a); + float n = vc*a + vd*lnr; + + ox += m * cosf(n); + oy += m * sinf(n); + """) + +var(64, 'foci', """ + float expx = expf(tx) * 0.5f; + float expnx = 0.25f / expx; + float sn = sinf(ty); + float cn = cosf(ty); + float tmp = w / (expx + expnx - cn); + ox += tmp * (expx - expnx); + oy += tmp * sn; + """) + From ec01cbfc436fe12997a06ac5707687068950d9f1 Mon Sep 17 00:00:00 2001 From: Erik Reckase Date: Thu, 5 May 2011 13:44:12 -0600 Subject: [PATCH 6/8] up through var 69! --- cuburn/code/variations.py | 84 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) diff --git a/cuburn/code/variations.py b/cuburn/code/variations.py index 838af24..6d6678f 100644 --- a/cuburn/code/variations.py +++ b/cuburn/code/variations.py @@ -682,3 +682,87 @@ var(64, 'foci', """ oy += tmp * sn; """) +var(65, 'lazysusan', """ + float lx = {{px.get('xf.lazysusan_x')}}; + float ly = {{px.get('xf.lazysusan_y')}}; + float x = tx - lx; + float y = ty + ly; + float r = sqrtf(x*x + y*y); + + if (r < w) { + float a = atan2f(y,x) + {{px.get('xf.lazysusan_spin')}} + + {{px.get('xf.lazysusan_twist')}}*(w-r); + r = w * r; + + ox += r * cosf(a) + lx; + oy += r * sinf(a) - ly; + + } else { + r = w * (1.0f + {{px.get('xf.lazysusan_space')}} / r); + + ox += r * x + lx; + oy += r * y - ly; + } + """) + +var(66, 'loonie', """ + float r2 = tx*tx + ty*ty;; + float w2 = w*w; + + if (r2 < w2) { + float r = w * sqrtf(w2/r2 - 1.0f); + ox += r * tx; + oy += r * ty; + } else { + ox += w * tx; + oy += w * ty; + } + """) + +var(67, 'pre_blur', """ + float rndG = w * (mwc_next_01(rctx) + mwc_next_01(rctx) + + mwc_next_01(rctx) + mwc_next_01(rctx) - 2.0f); + float rndA = mwc_next_01(rctx) * 2.0f * M_PI; + + /* Note: original coordinate changed */ + tx += rndG * cosf(rndA); + ty += rndG * sinf(rndA); + """) + +var(68, 'modulus', """ + float mx = {{px.get('xf.modulus_x')}} + float my = {{px.get('xf.modulus_y')}} + float xr = 2.0f*mx; + float yr = 2.0f*my; + + if (tx > mx) + ox += w * (-mx + fmodf(tx + mx, xr)); + else if (tx < -mx) + ox += w * ( mx - fmodf(mx - tx, xr)); + else + ox += w * tx; + + if (ty > my) + oy += w * (-my + fmodf(ty + my, yr)); + else if (ty < -my) + oy += w * ( my - fmodf(my - ty, yr)); + else + oy += w * ty; + """) + +var(69, 'oscope', """ + float tpf = 2.0f * M_PI * {{px.get('xf.oscope_frequency')}}; + float amp = {{px.get('xf.oscope_amplitude')}}; + float sep = {{px.get('xf.oscope_separation')}}; + float dmp = {{px.get('xf.oscope_damping')}}; + + float t = amp * expf(-fabsf(tx)*dmp) * cosf(tpf*tx) + sep; + + ox += w*tx; + if (fabsf(ty) <= t) + oy -= w*ty; + else + oy += w*ty; + """) + + From 7d46b0d1db496a6ab124d265215c32d77876a373 Mon Sep 17 00:00:00 2001 From: Erik Reckase Date: Thu, 5 May 2011 18:09:23 -0600 Subject: [PATCH 7/8] Done with 77. Will pick and choose the rest. --- cuburn/code/variations.py | 81 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) diff --git a/cuburn/code/variations.py b/cuburn/code/variations.py index 6d6678f..d9cb4bb 100644 --- a/cuburn/code/variations.py +++ b/cuburn/code/variations.py @@ -765,4 +765,85 @@ var(69, 'oscope', """ oy += w*ty; """) +var(70, 'polar2', """ + float p2v = w / M_PI; + ox += p2v * atan2f(x,y); + oy += 0.5f * p2v * logf(tx*tx + ty*ty); + """) + +var(71, 'popcorn2', """ + float c = {{px.get('xf.popcorn2_c')}}; + ox += w * (tx + {{px.get('xf.popcorn2_x')}} * sinf(tanf(ty*c))); + oy += w * (ty + {{px.get('xf.popcorn2_y')}} * sinf(tanf(tx*c))); + """) + +var(72, 'scry', """ + /* note that scry does not multiply by weight, but as the */ + /* values still approach 0 as the weight approaches 0, it */ + /* should be ok */ + float t = tx*tx + ty*ty; + float r = 1.0f / (sqrtf(t) * (t + 1.0f/w)); + ox += tx*r; + oy += ty*r; + """) + +var(73, 'separation', """ + float sx2 = {{px.get('xf.separation_x * xf.separation_x', 'sx2')}}; + float sy2 = {{px.get('xf.separation_y * xf.separation_y', 'sy2')}}; + + if (tx > 0.0f) + ox += w * (sqrtf(tx*tx + sx2) - tx*{{ps.get('xf.separation_xinside')}}); + else + ox -= w * (sqrtf(tx*tx + sx2) + tx*{{ps.get('xf.separation_xinside')}}); + + if (ty > 0.0f) + oy += w * (sqrtf(ty*ty + sy2) - ty*{{ps.get('xf.separation_yinside')}}); + else + oy -= w * (sqrtf(ty*ty + sy2) + ty*{{ps.get('xf.separation_yinside')}}); + """) + +var(74, 'split', """ + if (cosf(tx*{{px.get('xf.split_xsize')}}*M_PI) >= 0.0f) + oy += w*ty; + else + oy -= w*ty; + + if (cosf(ty*{{px.get('xf.split_ysize')}}*M_PI) >= 0.0f) + ox += w*tx; + else + ox -= w*tx; + """) + +var(75, 'splits', """ + if (tx >= 0.0f) + ox += w*(tx + {{ps.get('xf.splits_x')}}); + else + ox += w*(tx - {{ps.get('xf.splits_x')}}); + + if (f->ty >= 0) + oy += w*(ty + {{ps.get('xf.splits_y')}}); + else + oy += w*(ty - {{ps.get('xf.splits_y')}}); + """) + +var(76, 'stripes', """ + float roundx = floorf(tx + 0.5f); + float offsetx = tx - roundx; + ox += w * (offsetx * (1.0f - {{ps.get('xf.stripes_space')}}) + roundx); + oy += w * (ty + offsetx*offsetx*{{ps.get('xf.stripes_warp')}}); + """) + +var(77, 'wedge', """ + float r = sqrtf(tx*tx + ty*ty); + float a = atan2f(ty, tx) + {{ps.get('xf.wedge_swirl')}} * r; + float wc = {{ps.get('xf.wedge_count')}}; + float wa = {{ps.get('xf.wedge_angle')}}; + float c = floorf((wc * a + M_PI) * M_1_PI * 0.5f); + float comp_fac = 1 - wa * wc * M_1_PI * 0.5f; + a = a * comp_fac + c * wa; + r = w * (r + {{ps.get('xf.wedge_hole')}}); + ox += r * cosf(a); + oy += r * sinf(a); + """) + From 0d88608b166b6705f878882770fe43289ad25240 Mon Sep 17 00:00:00 2001 From: Erik Reckase Date: Thu, 5 May 2011 21:16:47 -0600 Subject: [PATCH 8/8] vars basically done. whew. a few are missing, but they're a pain and i don't feel like doing them right now ;) --- cuburn/code/variations.py | 115 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 115 insertions(+) diff --git a/cuburn/code/variations.py b/cuburn/code/variations.py index d9cb4bb..2649e14 100644 --- a/cuburn/code/variations.py +++ b/cuburn/code/variations.py @@ -846,4 +846,119 @@ var(77, 'wedge', """ oy += r * sinf(a); """) +var(81, 'waves2', """ + ox += w*(tx + {{ps.get('xf.waves2_scalex')}}*sinf(ty * {{ps.get('xf.waves2_freqx')}})); + oy += w*(ty + {{ps.get('xf.waves2_scaley')}}*sinf(tx * {{ps.get('xf.waves2_freqy')}})); + """) + +var(82, 'exp', """ + float expe = expf(f->tx); + ox += w * expe * cosf(ty); + oy += w * expe * sinf(ty); + """) + +var(83, 'log', """ + ox += w * 0.5f * logf(tx*tx + ty*ty); + oy += w * atan2f(ty, tx); + """) + +var(84, 'sin', """ + ox += w * sinf(tx) * coshf(ty); + oy += w * cosf(tx) * sinhf(ty); + """) + +var(85, 'cos', """ + ox += w * cosf(tx) * coshf(ty); + oy -= w * sinf(tx) * sinhf(ty); + """) + +var(86, 'tan', """ + float tanden = 1.0f/(cosf(2.0*tx) + coshf(2.0f*ty)); + ox += w * tanden * sinf(2.0f*tx); + oy += w * tanden * sinhf(2.0f*ty); + """) + +var(87, 'sec', """ + float secden = 2.0f/(cosf(2.0f*tx) + coshf(2.0f*ty)); + ox += w * secden * cosf(tx) * coshf(ty); + oy += w * secden * sinf(tx) * sinhf(ty); + """) + +var(88, 'csc', """ + float cscden = 2.0f/(coshf(2.0f*ty) - cosf(2.0f*tx)); + ox += w * cscden * sinf(tx) * coshf(ty); + oy -= w * cscden * cosf(tx) * sinhf(ty); + """) + +var(89, 'cot', """ + float cotden = 1.0f/(coshf(2.0f*ty) - cosf(2.0f*tx)); + ox += w * cotden * sinf(2.0f*tx); + oy += w * cotden * -1.0f * sinhf(2.0f*ty); + """) + +var(90, 'sinh', """ + ox += w * sinhf(tx) * cosf(ty); + oy += w * coshf(tx) * sinf(ty); + """) + +var(91, 'cosh', """ + ox += w * coshf(tx) * cosf(ty); + oy += w * sinhf(tx) * sinf(ty); + """) + +var(92, 'tanh', """ + float tanhden = 1.0f/(cosf(2.0f*ty) + coshf(2.0f*tx)); + ox += w * tanhden * sinhf(2.0f*tx); + oy += w * tanhden * sinf(2.0f*ty); + """) + +var(93, 'sech', """ + float sechden = 2.0f/(cosf(2.0f*ty) + coshf(2.0f*tx)); + ox += w * sechden * cosf(ty) * coshf(tx); + oy -= w * sechden * sinf(ty) * sinhf(tx); + """) + +var(94, 'csch', """ + cschden = 2.0f/(coshf(2.0f*tx) - cosf(2.0f*ty)); + ox += w * cschden * sinhf(tx) * cosf(ty); + oy -= w * cschden * coshf(tx) * sinf(ty); + """) + +var(95, 'coth', """ + cothden = 1.0f/(coshf(2.0f*tx) - cosf(2.0f*ty)); + ox += w * cothden * sinhf(2.0f*tx); + oy += w * cothden * sinf(2.0f*ty); + """) + +var(97, 'flux', """ + float xpw = tx + w; + float xmw = tx - w; + float avgr = w * (2.0f + {{px.get('xf.flux_spread')}}) * sqrtf(sqrtf(ty*ty+xpw*xpw)/sqrtf(ty*ty+xmw*xmw)); + float avga = (atan2f(ty, xmw) - atan2f(ty,xpw))*0.5f; + ox += avgr * cosf(avga); + oy += avgr * sinf(avga); + """) + +var(98, 'mobius', """ + float rea = {{px.get('xf.mobius_re_a')}}; + float ima = {{px.get('xf.mobius_im_a')}}; + float reb = {{px.get('xf.mobius_re_b')}}; + float imb = {{px.get('xf.mobius_im_b')}}; + float rec = {{px.get('xf.mobius_re_c')}}; + float imc = {{px.get('xf.mobius_im_c')}}; + float red = {{px.get('xf.mobius_re_d')}}; + float imd = {{px.get('xf.mobius_im_d')}}; + + float re_u, im_u, re_v, im_v, rad_v; + + re_u = rea * tx - ima * ty + reb; + im_u = rea * ty + ima * tx + imb; + re_v = rec * tx - imc * ty + red; + im_v = rec * ty + imc * tx + imd; + + rad_v = w / (re_v*re_v + im_v*im_v); + + ox += rad_v * (re_u*re_v + im_u*im_v); + oy += rad_v * (im_u*re_v - re_u*im_v); + """)