lots more f's added. vars up to 19 complete.

This commit is contained in:
Erik Reckase 2011-05-03 21:34:24 -06:00
parent f599685676
commit d1137e8e89

View File

@ -29,14 +29,14 @@ var(2, 'spherical', """
var(3, 'swirl', """ var(3, 'swirl', """
float r2 = tx*tx + ty*ty; float r2 = tx*tx + ty*ty;
float c1 = sin(r2); float c1 = sinf(r2);
float c2 = cos(r2); float c2 = cosf(r2);
ox += w * (c1*tx - c2*ty); ox += w * (c1*tx - c2*ty);
oy += w * (c2*tx + c1*ty); oy += w * (c2*tx + c1*ty);
""") """)
var(4, 'horseshoe', """ 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); ox += r * (tx - ty) * (tx + ty);
oy += 2.0f * tx * ty * r; oy += 2.0f * tx * ty * r;
""") """)
@ -48,53 +48,53 @@ var(5, 'polar', """
var(6, 'handkerchief', """ var(6, 'handkerchief', """
float a = atan2f(tx, ty); float a = atan2f(tx, ty);
float r = sqrt(tx*tx + ty*ty); float r = sqrtf(tx*tx + ty*ty);
ox += w * r * sin(a+r); ox += w * r * sinf(a+r);
oy += w * r * cos(a-r); oy += w * r * cosf(a-r);
""") """)
var(7, 'heart', """ var(7, 'heart', """
float sq = sqrt(tx*tx + ty*ty); float sq = sqrtf(tx*tx + ty*ty);
float a = sq * atan2f(tx, ty); float a = sq * atan2f(tx, ty);
float r = w * sq; float r = w * sq;
ox += r * sin(a) ox += r * sinf(a)
oy -= r * cos(a) oy -= r * cosf(a)
""") """)
var(8, 'disc', """ var(8, 'disc', """
float a = w * atan2f(tx, ty) * M_1_PI; float a = w * atan2f(tx, ty) * M_1_PI;
float r = M_PI * sqrt(tx*tx + ty*ty); float r = M_PI * sqrtf(tx*tx + ty*ty);
ox += sin(r) * a ox += sinf(r) * a
oy += cos(r) * a oy += cosf(r) * a
""") """)
var(9, 'spiral', """ var(9, 'spiral', """
float a = atan2f(tx, ty); float a = atan2f(tx, ty);
float r = sqrt(tx*tx + ty*ty); float r = sqrtf(tx*tx + ty*ty);
float r1 = w / r; float r1 = w / r;
ox += r1 * (cos(a) + sin(r)); ox += r1 * (cosf(a) + sinf(r));
oy += r1 * (sin(a) - cos(r)); oy += r1 * (sinf(a) - cosf(r));
""") """)
var(10, 'hyperbolic', """ var(10, 'hyperbolic', """
float a = atan2f(tx, ty); float a = atan2f(tx, ty);
float r = sqrt(tx*tx + ty*ty); float r = sqrtf(tx*tx + ty*ty);
ox += w * sinf(a) / r; ox += w * sinf(a) / r;
oy += w * cosf(a) * r; oy += w * cosf(a) * r;
""") """)
var(11, 'diamond', """ var(11, 'diamond', """
float a = atan2f(tx, ty); float a = atan2f(tx, ty);
float r = sqrt(tx*tx + ty*ty); float r = sqrtf(tx*tx + ty*ty);
ox += w * sin(a) * cos(r); ox += w * sinf(a) * cosf(r);
oy += w * cos(a) * sin(r); oy += w * cosf(a) * sinf(r);
""") """)
var(12, 'ex', """ var(12, 'ex', """
float a = atan2f(tx, ty); float a = atan2f(tx, ty);
float r = sqrt(tx*tx + ty*ty); float r = sqrtf(tx*tx + ty*ty);
float n0 = sin(a+r); float n0 = sinf(a+r);
float n1 = cos(a-r); float n1 = cosf(a-r);
float m0 = n0*n0*n0*r; float m0 = n0*n0*n0*r;
float m1 = n1*n1*n1*r; float m1 = n1*n1*n1*r;
ox += w * (m0 + m1); ox += w * (m0 + m1);
@ -104,9 +104,9 @@ var(12, 'ex', """
var(13, 'julia', """ var(13, 'julia', """
float a = 0.5f * atan2f(tx, ty) float a = 0.5f * atan2f(tx, ty)
if (mwc_next(rctx) & 1) a += M_PI; if (mwc_next(rctx) & 1) a += M_PI;
float r = w * sqrt(tx*tx + ty*ty); float r = w * sqrtf(tx*tx + ty*ty);
ox += r * cos(a); ox += r * cosf(a);
oy += r * sin(a); oy += r * sinf(a);
""") """)
var(14, 'bent', """ var(14, 'bent', """
@ -119,19 +119,41 @@ var(14, 'bent', """
""") """)
var(15, 'waves', """ var(15, 'waves', """
float c10 = {{px.get(None, 'pre_yx')}}; float c10 = {{px.get(None, 'pre_xy')}};
float c11 = {{px.get(None, 'pre_yy')}}; float c11 = {{px.get(None, 'pre_yy')}};
ox += w * (tx + c10 + sin(ty * {{px.get('xf.waves_dx2')}})); ox += w * (tx + c10 + sinf(ty * {{px.get('xf.waves_dx2')}}));
oy += w * (ty + c11 + sin(tx * {{px.get('xf.waves_dy2')}})); oy += w * (ty + c11 + sinf(tx * {{px.get('xf.waves_dy2')}}));
""") """)
var(16, 'fisheye', """ var(16, 'fisheye', """
float r = sqrt(tx*tx + ty*ty); float r = sqrtf(tx*tx + ty*ty);
r = 2.0f * w / (r + 1.0f); r = 2.0f * w / (r + 1.0f);
ox += r * ty; ox += r * ty;
oy += r * tx; 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', """ var(33, 'juliascope', """
float ang = atan2f(ty, tx); float ang = atan2f(ty, tx);
float power = {{px.get('xf.juliascope_power', 'juscope_power')}}; float power = {{px.get('xf.juliascope_power', 'juscope_power')}};