- if (fon[1]) {
- x = x * var[1]; y = y * var[1];
- }
- if (fon[2]) {
- nx=x*cos(var[2])+y*sin(var[2]);
- ny=-x*sin(var[2])+y*cos(var[2]);
- x=nx;
- y=ny;
- }
- if (fon[3]) {
- y=y*var[3];
- }
- if (fon[4]) {
- x=(x-1.0)*var[3]+1.0;
- }
- if (fon[5]) {
- x=x+var[5]*x;
- }
- if (fon[6]) {
- x = mysgn(x) * pow(fabs(x),var[6]);
- y = mysgn(y) * pow(fabs(y),var[6]);
- }
- if (fon[7]) {
- if (fon[0]) {
- if (fon[9]) {
- x=x+var[7]*(-1.0+2.0*(float)(p%2));
- } else {
- x=x+var[7]*(-1.0+2.0*(float)((p%50)/49.0));
- }
- }
- }
- if (fon[8]) {
- if (fon[0]) {
- if (fon[9]) {
- y=y+var[8]*(-1.0+2.0*(float)(p%2));
- } else {
- y=y+var[8]*(-1.0+2.0*(float)((p%50)/49.0));
- }
- }
- }
+
+ /* In theory all these if checks are unneccessary,
+ since each forcefield effect should do nothing when its var = op.
+ But the if's are good for efficiency because this function
+ is called once for every point.
+
+ Squirge towards edges (makes a leaf shape, previously split the screen in 4 but now only 1 :)
+ These ones must go first, to avoid x+1.0 < 0
+ */
+ if (fon[6]) {
+ /* x = mysgn(x) * pow(fabs(x),var[6]);
+ y = mysgn(y) * pow(fabs(y),var[6]);*/
+ x = -1.0 + 2.0*pow((x + 1.0)/2.0,var[6]);
+ }
+ if (fon[7]) {
+ y = -1.0 + 2.0*pow((y + 1.0)/2.0,var[7]);
+ }
+
+ /* Warping in/out */
+ if (fon[1]) {
+ x = x * var[1]; y = y * var[1];
+ }
+
+ /* Rotation */
+ if (fon[2]) {
+ nx=x*cos(1.1*var[2])+y*sin(1.1*var[2]);
+ ny=-x*sin(1.1*var[2])+y*cos(1.1*var[2]);
+ x=nx;
+ y=ny;
+ }
+
+ /* Asymptotes (looks like a plane with a horizon; equivalent to 1D warp) */
+ if (fon[3]) { /* Horizontal asymptote */
+ y=y*var[3];
+ }
+ if (fon[4]) { /* Vertical asymptote */
+ x=x+var[4]*x; /* this is the same maths as the last, but with op=0 */
+ }
+ if (fon[5]) { /* Vertical asymptote at right of screen */
+ x=(x-1.0)*var[5]+1.0;
+ }
+
+ /* Splitting (whirlwind effect): */
+ #define num_splits ( 2 + (int) (fabs(var[0]) * 1000) )
+ /* #define thru ( (float)(p%num_splits)/(float)(num_splits-1) ) */
+ #define thru ( (float)((int)(num_splits*(float)(p)/(float)(ps)))/(float)(num_splits-1) )
+ if (fon[8]) {
+ x=x+0.5*var[8]*(-1.0+2.0*thru);
+ }
+ if (fon[9]) {
+ y=y+0.5*var[9]*(-1.0+2.0*thru);
+ }
+
+ /* Waves */
+ if (fon[10]) {
+ y = y + 0.4*var[10]*sin(300.0*var[12]*x + 600.0*var[11]);
+ }
+ if (fon[13]) {
+ x = x + 0.4*var[13]*sin(300.0*var[15]*y + 600.0*var[14]);
+ }
+