diff --git a/cuburn/code/variations.py b/cuburn/code/variations.py index 5952dbb..708a652 100644 --- a/cuburn/code/variations.py +++ b/cuburn/code/variations.py @@ -29,14 +29,14 @@ var(2, 'spherical', """ var(3, 'swirl', """ float r2 = tx*tx + ty*ty; - float c1 = sin(r2); - float c2 = cos(r2); + float c1 = sinf(r2); + float c2 = cosf(r2); ox += w * (c1*tx - c2*ty); oy += w * (c2*tx + c1*ty); """) var(4, 'horseshoe', """ - float r = w / sqrt(tx*tx + ty*ty); + float r = w / sqrtf(tx*tx + ty*ty); ox += r * (tx - ty) * (tx + ty); oy += 2.0f * tx * ty * r; """) @@ -48,53 +48,53 @@ var(5, 'polar', """ var(6, 'handkerchief', """ float a = atan2f(tx, ty); - float r = sqrt(tx*tx + ty*ty); - ox += w * r * sin(a+r); - oy += w * r * cos(a-r); + float r = sqrtf(tx*tx + ty*ty); + ox += w * r * sinf(a+r); + oy += w * r * cosf(a-r); """) var(7, 'heart', """ - float sq = sqrt(tx*tx + ty*ty); + float sq = sqrtf(tx*tx + ty*ty); float a = sq * atan2f(tx, ty); float r = w * sq; - ox += r * sin(a) - oy -= r * cos(a) + ox += r * sinf(a) + oy -= r * cosf(a) """) var(8, 'disc', """ float a = w * atan2f(tx, ty) * M_1_PI; - float r = M_PI * sqrt(tx*tx + ty*ty); - ox += sin(r) * a - oy += cos(r) * a + float r = M_PI * sqrtf(tx*tx + ty*ty); + ox += sinf(r) * a + oy += cosf(r) * a """) var(9, 'spiral', """ float a = atan2f(tx, ty); - float r = sqrt(tx*tx + ty*ty); + float r = sqrtf(tx*tx + ty*ty); float r1 = w / r; - ox += r1 * (cos(a) + sin(r)); - oy += r1 * (sin(a) - cos(r)); + ox += r1 * (cosf(a) + sinf(r)); + oy += r1 * (sinf(a) - cosf(r)); """) var(10, 'hyperbolic', """ float a = atan2f(tx, ty); - float r = sqrt(tx*tx + ty*ty); + float r = sqrtf(tx*tx + ty*ty); ox += w * sinf(a) / r; oy += w * cosf(a) * r; """) var(11, 'diamond', """ float a = atan2f(tx, ty); - float r = sqrt(tx*tx + ty*ty); - ox += w * sin(a) * cos(r); - oy += w * cos(a) * sin(r); + float r = sqrtf(tx*tx + ty*ty); + ox += w * sinf(a) * cosf(r); + oy += w * cosf(a) * sinf(r); """) var(12, 'ex', """ float a = atan2f(tx, ty); - float r = sqrt(tx*tx + ty*ty); - float n0 = sin(a+r); - float n1 = cos(a-r); + float r = sqrtf(tx*tx + ty*ty); + float n0 = sinf(a+r); + float n1 = cosf(a-r); float m0 = n0*n0*n0*r; float m1 = n1*n1*n1*r; ox += w * (m0 + m1); @@ -104,9 +104,9 @@ var(12, 'ex', """ var(13, 'julia', """ float a = 0.5f * atan2f(tx, ty) if (mwc_next(rctx) & 1) a += M_PI; - float r = w * sqrt(tx*tx + ty*ty); - ox += r * cos(a); - oy += r * sin(a); + float r = w * sqrtf(tx*tx + ty*ty); + ox += r * cosf(a); + oy += r * sinf(a); """) var(14, 'bent', """ @@ -119,19 +119,41 @@ var(14, 'bent', """ """) var(15, 'waves', """ - float c10 = {{px.get(None, 'pre_yx')}}; + float c10 = {{px.get(None, 'pre_xy')}}; float c11 = {{px.get(None, 'pre_yy')}}; - ox += w * (tx + c10 + sin(ty * {{px.get('xf.waves_dx2')}})); - oy += w * (ty + c11 + sin(tx * {{px.get('xf.waves_dy2')}})); + ox += w * (tx + c10 + sinf(ty * {{px.get('xf.waves_dx2')}})); + oy += w * (ty + c11 + sinf(tx * {{px.get('xf.waves_dy2')}})); """) var(16, 'fisheye', """ - float r = sqrt(tx*tx + ty*ty); + float r = sqrtf(tx*tx + ty*ty); r = 2.0f * w / (r + 1.0f); ox += r * ty; oy += r * tx; """) +var(17, 'popcorn', """ + float dx = tanf(3.0f*ty); + float dy = tanf(3.0f*tx); + ox += w * (tx + {{px.get(None, 'pre_xo')}} * sinf(dx)); + oy += w * (ty + {{px.get(None, 'pre_yo')}} * sinf(dy)); + """) + +var(18, 'exponential', """ + float dx = w * expf(tx - 1.0f); + float dy = M_PI * ty; + ox += dx * cosf(dy); + oy += dx * sinf(dy); + """) + +var(19, 'power', """ + float a = atan2f(tx, ty); + float sa = sinf(a); + float r = w * powf(sqrtf(tx*tx + ty*ty),sa); + ox += r * cosf(a); + oy += r * sa; + """) + var(33, 'juliascope', """ float ang = atan2f(ty, tx); float power = {{px.get('xf.juliascope_power', 'juscope_power')}};