1 /*
2 FLAM3 - cosmic recursive fractal flames
3 Copyright (C) 1992-2009 Spotworks LLC
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 3 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19 #include "variations.h"
20 #include "interpolation.h"
21
22 #define badvalue(x) (((x)!=(x))||((x)>1e10)||((x)<-1e10))
23
24 /* Wrap the sincos function for Macs */
25 #if defined(__APPLE__) || defined(_MSC_VER)
26 #define sincos(x,s,c) *(s)=sin(x); *(c)=cos(x);
27 #else
28 extern void sincos(double x, double *s, double *c);
29 #endif
30
31 #ifdef _MSC_VER
32 #define trunc (int)
33 #endif
34
35 char *flam3_variation_names[1+flam3_nvariations] = {
36 "linear",
37 "sinusoidal",
38 "spherical",
39 "swirl",
40 "horseshoe",
41 "polar",
42 "handkerchief",
43 "heart",
44 "disc",
45 "spiral",
46 "hyperbolic",
47 "diamond",
48 "ex",
49 "julia",
50 "bent",
51 "waves",
52 "fisheye",
53 "popcorn",
54 "exponential",
55 "power",
56 "cosine",
57 "rings",
58 "fan",
59 "blob",
60 "pdj",
61 "fan2",
62 "rings2",
63 "eyefish",
64 "bubble",
65 "cylinder",
66 "perspective",
67 "noise",
68 "julian",
69 "juliascope",
70 "blur",
71 "gaussian_blur",
72 "radial_blur",
73 "pie",
74 "ngon",
75 "curl",
76 "rectangles",
77 "arch",
78 "tangent",
79 "square",
80 "rays",
81 "blade",
82 "secant2",
83 "twintrian",
84 "cross",
85 "disc2",
86 "super_shape",
87 "flower",
88 "conic",
89 "parabola",
90 "bent2",
91 "bipolar",
92 "boarders",
93 "butterfly",
94 "cell",
95 "cpow",
96 "curve",
97 "edisc",
98 "elliptic",
99 "escher",
100 "foci",
101 "lazysusan",
102 "loonie",
103 "pre_blur",
104 "modulus",
105 "oscilloscope",
106 "polar2",
107 "popcorn2",
108 "scry",
109 "separation",
110 "split",
111 "splits",
112 "stripes",
113 "wedge",
114 "wedge_julia",
115 "wedge_sph",
116 "whorl",
117 "waves2",
118 "exp",
119 "log",
120 "sin",
121 "cos",
122 "tan",
123 "sec",
124 "csc",
125 "cot",
126 "sinh",
127 "cosh",
128 "tanh",
129 "sech",
130 "csch",
131 "coth",
132 "auger",
133 "flux",
134 "mobius",
135 0
136 };
137
138 /*
139 * VARIATION FUNCTIONS
140 * must be of the form void (void *, double)
141 */
var0_linear(flam3_iter_helper * f,double weight)142 void var0_linear (flam3_iter_helper *f, double weight) {
143 /* linear */
144 /* nx = tx;
145 ny = ty;
146 p[0] += v * nx;
147 p[1] += v * ny; */
148
149 f->p0 += weight * f->tx;
150 f->p1 += weight * f->ty;
151 }
152
var1_sinusoidal(flam3_iter_helper * f,double weight)153 void var1_sinusoidal (flam3_iter_helper *f, double weight) {
154 /* sinusoidal */
155 /* nx = sin(tx);
156 ny = sin(ty);
157 p[0] += v * nx;
158 p[1] += v * ny; */
159
160 f->p0 += weight * sin(f->tx);
161 f->p1 += weight * sin(f->ty);
162 }
163
var2_spherical(flam3_iter_helper * f,double weight)164 void var2_spherical (flam3_iter_helper *f, double weight) {
165 /* spherical */
166 /* double r2 = tx * tx + ty * ty + 1e-6;
167 nx = tx / r2;
168 ny = ty / r2;
169 p[0] += v * nx;
170 p[1] += v * ny; */
171
172 double r2 = weight / ( f->precalc_sumsq + EPS);
173
174 f->p0 += r2 * f->tx;
175 f->p1 += r2 * f->ty;
176 }
177
var3_swirl(flam3_iter_helper * f,double weight)178 void var3_swirl (flam3_iter_helper *f, double weight) {
179 /* swirl */
180 /* double r2 = tx * tx + ty * ty; /k here is fun
181 double c1 = sin(r2);
182 double c2 = cos(r2);
183 nx = c1 * tx - c2 * ty;
184 ny = c2 * tx + c1 * ty;
185 p[0] += v * nx;
186 p[1] += v * ny; */
187
188 double r2 = f->precalc_sumsq;
189 double c1,c2;
190 double nx,ny;
191
192 sincos(r2,&c1,&c2);
193 // double c1 = sin(r2);
194 // double c2 = cos(r2);
195 nx = c1 * f->tx - c2 * f->ty;
196 ny = c2 * f->tx + c1 * f->ty;
197
198 f->p0 += weight * nx;
199 f->p1 += weight * ny;
200 }
201
var4_horseshoe(flam3_iter_helper * f,double weight)202 void var4_horseshoe (flam3_iter_helper *f, double weight) {
203 /* horseshoe */
204 /* a = atan2(tx, ty);
205 c1 = sin(a);
206 c2 = cos(a);
207 nx = c1 * tx - c2 * ty;
208 ny = c2 * tx + c1 * ty;
209 p[0] += v * nx;
210 p[1] += v * ny; */
211
212 double r = weight / (f->precalc_sqrt + EPS);
213
214 f->p0 += (f->tx - f->ty) * (f->tx + f->ty) * r;
215 f->p1 += 2.0 * f->tx * f->ty * r;
216 }
217
var5_polar(flam3_iter_helper * f,double weight)218 void var5_polar (flam3_iter_helper *f, double weight) {
219 /* polar */
220 /* nx = atan2(tx, ty) / M_PI;
221 ny = sqrt(tx * tx + ty * ty) - 1.0;
222 p[0] += v * nx;
223 p[1] += v * ny; */
224
225 double nx = f->precalc_atan * M_1_PI;
226 double ny = f->precalc_sqrt - 1.0;
227
228 f->p0 += weight * nx;
229 f->p1 += weight * ny;
230 }
231
var6_handkerchief(flam3_iter_helper * f,double weight)232 void var6_handkerchief (flam3_iter_helper *f, double weight) {
233 /* folded handkerchief */
234 /* a = atan2(tx, ty);
235 r = sqrt(tx*tx + ty*ty);
236 p[0] += v * sin(a+r) * r;
237 p[1] += v * cos(a-r) * r; */
238
239 double a = f->precalc_atan;
240 double r = f->precalc_sqrt;
241
242 f->p0 += weight * r * sin(a+r);
243 f->p1 += weight * r * cos(a-r);
244 }
245
var7_heart(flam3_iter_helper * f,double weight)246 void var7_heart (flam3_iter_helper *f, double weight) {
247 /* heart */
248 /* a = atan2(tx, ty);
249 r = sqrt(tx*tx + ty*ty);
250 a *= r;
251 p[0] += v * sin(a) * r;
252 p[1] += v * cos(a) * -r; */
253
254 double a = f->precalc_sqrt * f->precalc_atan;
255 double ca,sa;
256 double r = weight * f->precalc_sqrt;
257
258 sincos(a,&sa,&ca);
259
260 f->p0 += r * sa;
261 f->p1 += (-r) * ca;
262 }
263
var8_disc(flam3_iter_helper * f,double weight)264 void var8_disc (flam3_iter_helper *f, double weight) {
265 /* disc */
266 /* nx = tx * M_PI;
267 ny = ty * M_PI;
268 a = atan2(nx, ny);
269 r = sqrt(nx*nx + ny*ny);
270 p[0] += v * sin(r) * a / M_PI;
271 p[1] += v * cos(r) * a / M_PI; */
272
273 double a = f->precalc_atan * M_1_PI;
274 double r = M_PI * f->precalc_sqrt;
275 double sr,cr;
276 sincos(r,&sr,&cr);
277
278 f->p0 += weight * sr * a;
279 f->p1 += weight * cr * a;
280 }
281
var9_spiral(flam3_iter_helper * f,double weight)282 void var9_spiral (flam3_iter_helper *f, double weight) {
283 /* spiral */
284 /* a = atan2(tx, ty);
285 r = sqrt(tx*tx + ty*ty) + 1e-6;
286 p[0] += v * (cos(a) + sin(r)) / r;
287 p[1] += v * (sin(a) - cos(r)) / r; */
288
289 double r = f->precalc_sqrt + EPS;
290 double r1 = weight/r;
291 double sr,cr;
292 sincos(r,&sr,&cr);
293
294 f->p0 += r1 * (f->precalc_cosa + sr);
295 f->p1 += r1 * (f->precalc_sina - cr);
296 }
297
var10_hyperbolic(flam3_iter_helper * f,double weight)298 void var10_hyperbolic (flam3_iter_helper *f, double weight) {
299 /* hyperbolic */
300 /* a = atan2(tx, ty);
301 r = sqrt(tx*tx + ty*ty) + 1e-6;
302 p[0] += v * sin(a) / r;
303 p[1] += v * cos(a) * r; */
304
305 double r = f->precalc_sqrt + EPS;
306
307 f->p0 += weight * f->precalc_sina / r;
308 f->p1 += weight * f->precalc_cosa * r;
309 }
310
var11_diamond(flam3_iter_helper * f,double weight)311 void var11_diamond (flam3_iter_helper *f, double weight) {
312 /* diamond */
313 /* a = atan2(tx, ty);
314 r = sqrt(tx*tx + ty*ty);
315 p[0] += v * sin(a) * cos(r);
316 p[1] += v * cos(a) * sin(r); */
317
318 double r = f->precalc_sqrt;
319 double sr,cr;
320 sincos(r,&sr,&cr);
321
322 f->p0 += weight * f->precalc_sina * cr;
323 f->p1 += weight * f->precalc_cosa * sr;
324 }
325
var12_ex(flam3_iter_helper * f,double weight)326 void var12_ex (flam3_iter_helper *f, double weight) {
327 /* ex */
328 /* a = atan2(tx, ty);
329 r = sqrt(tx*tx + ty*ty);
330 n0 = sin(a+r);
331 n1 = cos(a-r);
332 m0 = n0 * n0 * n0 * r;
333 m1 = n1 * n1 * n1 * r;
334 p[0] += v * (m0 + m1);
335 p[1] += v * (m0 - m1); */
336
337 double a = f->precalc_atan;
338 double r = f->precalc_sqrt;
339
340 double n0 = sin(a+r);
341 double n1 = cos(a-r);
342
343 double m0 = n0 * n0 * n0 * r;
344 double m1 = n1 * n1 * n1 * r;
345
346 f->p0 += weight * (m0 + m1);
347 f->p1 += weight * (m0 - m1);
348 }
349
var13_julia(flam3_iter_helper * f,double weight)350 void var13_julia (flam3_iter_helper *f, double weight) {
351 /* julia */
352 /* a = atan2(tx, ty)/2.0;
353 if (flam3_random_bit()) a += M_PI;
354 r = pow(tx*tx + ty*ty, 0.25);
355 nx = r * cos(a);
356 ny = r * sin(a);
357 p[0] += v * nx;
358 p[1] += v * ny; */
359
360 double r;
361 double a = 0.5 * f->precalc_atan;
362 double sa,ca;
363
364 if (flam3_random_isaac_bit(f->rc)) //(flam3_random_bit())
365 a += M_PI;
366
367 r = weight * sqrt(f->precalc_sqrt);
368
369 sincos(a,&sa,&ca);
370
371 f->p0 += r * ca;
372 f->p1 += r * sa;
373 }
374
var14_bent(flam3_iter_helper * f,double weight)375 void var14_bent (flam3_iter_helper *f, double weight) {
376 /* bent */
377 /* nx = tx;
378 ny = ty;
379 if (nx < 0.0) nx = nx * 2.0;
380 if (ny < 0.0) ny = ny / 2.0;
381 p[0] += v * nx;
382 p[1] += v * ny; */
383
384 double nx = f->tx;
385 double ny = f->ty;
386
387 if (nx < 0.0)
388 nx = nx * 2.0;
389 if (ny < 0.0)
390 ny = ny / 2.0;
391
392 f->p0 += weight * nx;
393 f->p1 += weight * ny;
394 }
395
var15_waves(flam3_iter_helper * f,double weight)396 void var15_waves (flam3_iter_helper *f, double weight) {
397 /* waves */
398 /* dx = coef[2][0];
399 dy = coef[2][1];
400 nx = tx + coef[1][0]*sin(ty/((dx*dx)+EPS));
401 ny = ty + coef[1][1]*sin(tx/((dy*dy)+EPS));
402 p[0] += v * nx;
403 p[1] += v * ny; */
404
405 double c10 = f->xform->c[1][0];
406 double c11 = f->xform->c[1][1];
407
408 double nx = f->tx + c10 * sin( f->ty * f->xform->waves_dx2 );
409 double ny = f->ty + c11 * sin( f->tx * f->xform->waves_dy2 );
410
411 f->p0 += weight * nx;
412 f->p1 += weight * ny;
413 }
414
var16_fisheye(flam3_iter_helper * f,double weight)415 void var16_fisheye (flam3_iter_helper *f, double weight) {
416 /* fisheye */
417 /* a = atan2(tx, ty);
418 r = sqrt(tx*tx + ty*ty);
419 r = 2 * r / (r + 1);
420 nx = r * cos(a);
421 ny = r * sin(a);
422 p[0] += v * nx;
423 p[1] += v * ny; */
424
425 double r = f->precalc_sqrt;
426
427 r = 2 * weight / (r+1);
428
429 f->p0 += r * f->ty;
430 f->p1 += r * f->tx;
431 }
432
var17_popcorn(flam3_iter_helper * f,double weight)433 void var17_popcorn (flam3_iter_helper *f, double weight) {
434 /* popcorn */
435 /* dx = tan(3*ty);
436 dy = tan(3*tx);
437 nx = tx + coef[2][0] * sin(dx);
438 ny = ty + coef[2][1] * sin(dy);
439 p[0] += v * nx;
440 p[1] += v * ny; */
441
442 double dx = tan(3*f->ty);
443 double dy = tan(3*f->tx);
444
445 double nx = f->tx + f->xform->c[2][0] * sin(dx);
446 double ny = f->ty + f->xform->c[2][1] * sin(dy);
447
448 f->p0 += weight * nx;
449 f->p1 += weight * ny;
450 }
451
var18_exponential(flam3_iter_helper * f,double weight)452 void var18_exponential (flam3_iter_helper *f, double weight) {
453 /* exponential */
454 /* dx = exp(tx-1.0);
455 dy = M_PI * ty;
456 nx = cos(dy) * dx;
457 ny = sin(dy) * dx;
458 p[0] += v * nx;
459 p[1] += v * ny; */
460
461 double dx = weight * exp(f->tx - 1.0);
462 double dy = M_PI * f->ty;
463 double sdy,cdy;
464
465 sincos(dy,&sdy,&cdy);
466
467
468 f->p0 += dx * cdy;
469 f->p1 += dx * sdy;
470 }
471
var19_power(flam3_iter_helper * f,double weight)472 void var19_power (flam3_iter_helper *f, double weight) {
473 /* power */
474 /* a = atan2(tx, ty);
475 sa = sin(a);
476 r = sqrt(tx*tx + ty*ty);
477 r = pow(r, sa);
478 nx = r * precalc_cosa;
479 ny = r * sa;
480 p[0] += v * nx;
481 p[1] += v * ny; */
482
483 double r = weight * pow(f->precalc_sqrt, f->precalc_sina);
484
485 f->p0 += r * f->precalc_cosa;
486 f->p1 += r * f->precalc_sina;
487 }
488
var20_cosine(flam3_iter_helper * f,double weight)489 void var20_cosine (flam3_iter_helper *f, double weight) {
490 /* cosine */
491 /* nx = cos(tx * M_PI) * cosh(ty);
492 ny = -sin(tx * M_PI) * sinh(ty);
493 p[0] += v * nx;
494 p[1] += v * ny; */
495
496 double a = f->tx * M_PI;
497 double sa,ca;
498 double nx,ny;
499
500 sincos(a,&sa,&ca);
501 nx = ca * cosh(f->ty);
502 ny = -sa * sinh(f->ty);
503
504 f->p0 += weight * nx;
505 f->p1 += weight * ny;
506 }
507
var21_rings(flam3_iter_helper * f,double weight)508 void var21_rings (flam3_iter_helper *f, double weight) {
509 /* rings */
510 /* dx = coef[2][0];
511 dx = dx * dx + EPS;
512 r = sqrt(tx*tx + ty*ty);
513 r = fmod(r + dx, 2*dx) - dx + r*(1-dx);
514 a = atan2(tx, ty);
515 nx = cos(a) * r;
516 ny = sin(a) * r;
517 p[0] += v * nx;
518 p[1] += v * ny; */
519
520 double dx = f->xform->c[2][0] * f->xform->c[2][0] + EPS;
521 double r = f->precalc_sqrt;
522 r = weight * (fmod(r+dx, 2*dx) - dx + r * (1 - dx));
523
524 f->p0 += r * f->precalc_cosa;
525 f->p1 += r * f->precalc_sina;
526 }
527
var22_fan(flam3_iter_helper * f,double weight)528 void var22_fan (flam3_iter_helper *f, double weight) {
529 /* fan */
530 /* dx = coef[2][0];
531 dy = coef[2][1];
532 dx = M_PI * (dx * dx + EPS);
533 dx2 = dx/2;
534 a = atan(tx,ty);
535 r = sqrt(tx*tx + ty*ty);
536 a += (fmod(a+dy, dx) > dx2) ? -dx2 : dx2;
537 nx = cos(a) * r;
538 ny = sin(a) * r;
539 p[0] += v * nx;
540 p[1] += v * ny; */
541
542 double dx = M_PI * (f->xform->c[2][0] * f->xform->c[2][0] + EPS);
543 double dy = f->xform->c[2][1];
544 double dx2 = 0.5 * dx;
545
546 double a = f->precalc_atan;
547 double r = weight * f->precalc_sqrt;
548 double sa,ca;
549
550 a += (fmod(a+dy,dx) > dx2) ? -dx2 : dx2;
551 sincos(a,&sa,&ca);
552
553 f->p0 += r * ca;
554 f->p1 += r * sa;
555 }
556
var23_blob(flam3_iter_helper * f,double weight)557 void var23_blob (flam3_iter_helper *f, double weight) {
558 /* blob */
559 /* a = atan2(tx, ty);
560 r = sqrt(tx*tx + ty*ty);
561 r = r * (bloblow + (blobhigh-bloblow) * (0.5 + 0.5 * sin(blobwaves * a)));
562 nx = sin(a) * r;
563 ny = cos(a) * r;
564
565 p[0] += v * nx;
566 p[1] += v * ny; */
567
568 double r = f->precalc_sqrt;
569 double a = f->precalc_atan;
570 double bdiff = f->xform->blob_high - f->xform->blob_low;
571
572 r = r * (f->xform->blob_low +
573 bdiff * (0.5 + 0.5 * sin(f->xform->blob_waves * a)));
574
575 f->p0 += weight * f->precalc_sina * r;
576 f->p1 += weight * f->precalc_cosa * r;
577 }
578
var24_pdj(flam3_iter_helper * f,double weight)579 void var24_pdj (flam3_iter_helper *f, double weight) {
580 /* pdj */
581 /* nx1 = cos(pdjb * tx);
582 nx2 = sin(pdjc * tx);
583 ny1 = sin(pdja * ty);
584 ny2 = cos(pdjd * ty);
585
586 p[0] += v * (ny1 - nx1);
587 p[1] += v * (nx2 - ny2); */
588
589 double nx1 = cos(f->xform->pdj_b * f->tx);
590 double nx2 = sin(f->xform->pdj_c * f->tx);
591 double ny1 = sin(f->xform->pdj_a * f->ty);
592 double ny2 = cos(f->xform->pdj_d * f->ty);
593
594 f->p0 += weight * (ny1 - nx1);
595 f->p1 += weight * (nx2 - ny2);
596 }
597
var25_fan2(flam3_iter_helper * f,double weight)598 void var25_fan2 (flam3_iter_helper *f, double weight) {
599 /* fan2 */
600 /* a = precalc_atan;
601 r = precalc_sqrt;
602
603 dy = fan2y;
604 dx = M_PI * (fan2x * fan2x + EPS);
605 dx2 = dx / 2.0;
606
607 t = a + dy - dx * (int)((a + dy)/dx);
608
609 if (t > dx2)
610 a = a - dx2;
611 else
612 a = a + dx2;
613
614 nx = sin(a) * r;
615 ny = cos(a) * r;
616
617 p[0] += v * nx;
618 p[1] += v * ny; */
619
620 double dy = f->xform->fan2_y;
621 double dx = M_PI * (f->xform->fan2_x * f->xform->fan2_x + EPS);
622 double dx2 = 0.5 * dx;
623 double a = f->precalc_atan;
624 double sa,ca;
625 double r = weight * f->precalc_sqrt;
626
627 double t = a + dy - dx * (int)((a + dy)/dx);
628
629 if (t>dx2)
630 a = a-dx2;
631 else
632 a = a+dx2;
633
634 sincos(a,&sa,&ca);
635
636 f->p0 += r * sa;
637 f->p1 += r * ca;
638 }
639
var26_rings2(flam3_iter_helper * f,double weight)640 void var26_rings2 (flam3_iter_helper *f, double weight) {
641 /* rings2 */
642 /* r = precalc_sqrt;
643 dx = rings2val * rings2val + EPS;
644 r += dx - 2.0*dx*(int)((r + dx)/(2.0 * dx)) - dx + r * (1.0-dx);
645 nx = precalc_sina * r;
646 ny = precalc_cosa * r;
647 p[0] += v * nx;
648 p[1] += v * ny; */
649
650 double r = f->precalc_sqrt;
651 double dx = f->xform->rings2_val * f->xform->rings2_val + EPS;
652
653 r += -2.0*dx*(int)((r+dx)/(2.0*dx)) + r * (1.0-dx);
654
655 f->p0 += weight * f->precalc_sina * r;
656 f->p1 += weight * f->precalc_cosa * r;
657 }
658
var27_eyefish(flam3_iter_helper * f,double weight)659 void var27_eyefish (flam3_iter_helper *f, double weight) {
660 /* eyefish */
661 /* r = 2.0 * v / (precalc_sqrt + 1.0);
662 p[0] += r*tx;
663 p[1] += r*ty; */
664
665 double r = (weight * 2.0) / (f->precalc_sqrt + 1.0);
666
667 f->p0 += r * f->tx;
668 f->p1 += r * f->ty;
669 }
670
var28_bubble(flam3_iter_helper * f,double weight)671 void var28_bubble (flam3_iter_helper *f, double weight) {
672 /* bubble */
673
674 double r = weight / (0.25 * (f->precalc_sumsq) + 1);
675
676 f->p0 += r * f->tx;
677 f->p1 += r * f->ty;
678 }
679
var29_cylinder(flam3_iter_helper * f,double weight)680 void var29_cylinder (flam3_iter_helper *f, double weight) {
681 /* cylinder (01/06) */
682
683 f->p0 += weight * sin(f->tx);
684 f->p1 += weight * f->ty;
685 }
686
var30_perspective(flam3_iter_helper * f,double weight)687 void var30_perspective (flam3_iter_helper *f, double weight) {
688 /* perspective (01/06) */
689
690 double t = 1.0 / (f->xform->perspective_dist - f->ty * f->xform->persp_vsin);
691
692 f->p0 += weight * f->xform->perspective_dist * f->tx * t;
693 f->p1 += weight * f->xform->persp_vfcos * f->ty * t;
694 }
695
var31_noise(flam3_iter_helper * f,double weight)696 void var31_noise (flam3_iter_helper *f, double weight) {
697 /* noise (03/06) */
698
699 double tmpr, sinr, cosr, r;
700
701 tmpr = flam3_random_isaac_01(f->rc) * 2 * M_PI;
702 sincos(tmpr,&sinr,&cosr);
703
704 r = weight * flam3_random_isaac_01(f->rc);
705
706 f->p0 += f->tx * r * cosr;
707 f->p1 += f->ty * r * sinr;
708 }
709
var32_juliaN_generic(flam3_iter_helper * f,double weight)710 void var32_juliaN_generic (flam3_iter_helper *f, double weight) {
711 /* juliaN (03/06) */
712
713 int t_rnd = trunc((f->xform->julian_rN)*flam3_random_isaac_01(f->rc));
714
715 double tmpr = (f->precalc_atanyx + 2 * M_PI * t_rnd) / f->xform->julian_power;
716
717 double r = weight * pow(f->precalc_sumsq, f->xform->julian_cn);
718 double sina, cosa;
719 sincos(tmpr,&sina,&cosa);
720
721 f->p0 += r * cosa;
722 f->p1 += r * sina;
723 }
724
var33_juliaScope_generic(flam3_iter_helper * f,double weight)725 void var33_juliaScope_generic (flam3_iter_helper *f, double weight) {
726 /* juliaScope (03/06) */
727
728 int t_rnd = trunc((f->xform->juliascope_rN) * flam3_random_isaac_01(f->rc));
729
730 double tmpr, r;
731 double sina, cosa;
732
733 if ((t_rnd & 1) == 0)
734 tmpr = (2 * M_PI * t_rnd + f->precalc_atanyx) / f->xform->juliascope_power;
735 else
736 tmpr = (2 * M_PI * t_rnd - f->precalc_atanyx) / f->xform->juliascope_power;
737
738 sincos(tmpr,&sina,&cosa);
739
740 r = weight * pow(f->precalc_sumsq, f->xform->juliascope_cn);
741
742 f->p0 += r * cosa;
743 f->p1 += r * sina;
744 }
745
var34_blur(flam3_iter_helper * f,double weight)746 void var34_blur (flam3_iter_helper *f, double weight) {
747 /* blur (03/06) */
748
749 double tmpr, sinr, cosr, r;
750
751 tmpr = flam3_random_isaac_01(f->rc) * 2 * M_PI;
752 sincos(tmpr,&sinr,&cosr);
753
754 r = weight * flam3_random_isaac_01(f->rc);
755
756 f->p0 += r * cosr;
757 f->p1 += r * sinr;
758 }
759
var35_gaussian(flam3_iter_helper * f,double weight)760 void var35_gaussian (flam3_iter_helper *f, double weight) {
761 /* gaussian (09/06) */
762
763 double ang, r, sina, cosa;
764
765 ang = flam3_random_isaac_01(f->rc) * 2 * M_PI;
766 sincos(ang,&sina,&cosa);
767
768 r = weight * ( flam3_random_isaac_01(f->rc) + flam3_random_isaac_01(f->rc)
769 + flam3_random_isaac_01(f->rc) + flam3_random_isaac_01(f->rc) - 2.0 );
770
771 f->p0 += r * cosa;
772 f->p1 += r * sina;
773 }
774
var36_radial_blur(flam3_iter_helper * f,double weight)775 void var36_radial_blur (flam3_iter_helper *f, double weight) {
776 /* radial blur (09/06) */
777 /* removed random storage 6/07 */
778
779 double rndG, ra, rz, tmpa, sa, ca;
780
781 /* Get pseudo-gaussian */
782 rndG = weight * (flam3_random_isaac_01(f->rc) + flam3_random_isaac_01(f->rc)
783 + flam3_random_isaac_01(f->rc) + flam3_random_isaac_01(f->rc) - 2.0);
784
785 /* Calculate angle & zoom */
786 ra = f->precalc_sqrt;
787 tmpa = f->precalc_atanyx + f->xform->radialBlur_spinvar*rndG;
788 sincos(tmpa,&sa,&ca);
789 rz = f->xform->radialBlur_zoomvar * rndG - 1;
790
791 f->p0 += ra * ca + rz * f->tx;
792 f->p1 += ra * sa + rz * f->ty;
793 }
794
var37_pie(flam3_iter_helper * f,double weight)795 void var37_pie(flam3_iter_helper *f, double weight) {
796 /* pie by Joel Faber (June 2006) */
797
798 double a, r, sa, ca;
799 int sl;
800
801 sl = (int) (flam3_random_isaac_01(f->rc) * f->xform->pie_slices + 0.5);
802 a = f->xform->pie_rotation +
803 2.0 * M_PI * (sl + flam3_random_isaac_01(f->rc) * f->xform->pie_thickness) / f->xform->pie_slices;
804 r = weight * flam3_random_isaac_01(f->rc);
805 sincos(a,&sa,&ca);
806
807 f->p0 += r * ca;
808 f->p1 += r * sa;
809 }
810
var38_ngon(flam3_iter_helper * f,double weight)811 void var38_ngon(flam3_iter_helper *f, double weight) {
812 /* ngon by Joel Faber (09/06) */
813
814 double r_factor,theta,phi,b, amp;
815
816 r_factor = pow(f->precalc_sumsq, f->xform->ngon_power/2.0);
817
818 theta = f->precalc_atanyx;
819 b = 2*M_PI/f->xform->ngon_sides;
820
821 phi = theta - (b*floor(theta/b));
822 if (phi > b/2)
823 phi -= b;
824
825 amp = f->xform->ngon_corners * (1.0 / (cos(phi) + EPS) - 1.0) + f->xform->ngon_circle;
826 amp /= (r_factor + EPS);
827
828 f->p0 += weight * f->tx * amp;
829 f->p1 += weight * f->ty * amp;
830 }
831
var39_curl(flam3_iter_helper * f,double weight)832 void var39_curl(flam3_iter_helper *f, double weight)
833 {
834 double re = 1.0 + f->xform->curl_c1 * f->tx + f->xform->curl_c2 * (f->tx * f->tx - f->ty * f->ty);
835 double im = f->xform->curl_c1 * f->ty + 2.0 * f->xform->curl_c2 * f->tx * f->ty;
836
837 double r = weight / (re*re + im*im);
838
839 f->p0 += (f->tx * re + f->ty * im) * r;
840 f->p1 += (f->ty * re - f->tx * im) * r;
841 }
842
var40_rectangles(flam3_iter_helper * f,double weight)843 void var40_rectangles(flam3_iter_helper *f, double weight)
844 {
845 if (f->xform->rectangles_x==0)
846 f->p0 += weight * f->tx;
847 else
848 f->p0 += weight * ((2 * floor(f->tx / f->xform->rectangles_x) + 1) * f->xform->rectangles_x - f->tx);
849
850 if (f->xform->rectangles_y==0)
851 f->p1 += weight * f->ty;
852 else
853 f->p1 += weight * ((2 * floor(f->ty / f->xform->rectangles_y) + 1) * f->xform->rectangles_y - f->ty);
854
855 }
856
var41_arch(flam3_iter_helper * f,double weight)857 void var41_arch(flam3_iter_helper *f, double weight)
858 {
859 /* Z+ variation Jan 07
860 procedure TXForm.Arch;
861 var
862 sinr, cosr: double;
863 begin
864 SinCos(random * vars[29]*pi, sinr, cosr);
865 FPx := FPx + sinr*vars[29];
866 FPy := FPy + sqr(sinr)/cosr*vars[29];
867 end;
868 */
869
870 /*
871 * !!! Note !!!
872 * This code uses the variation weight in a non-standard fashion, and
873 * it may change or even be removed in future versions of flam3.
874 */
875
876 double ang = flam3_random_isaac_01(f->rc) * weight * M_PI;
877 double sinr,cosr;
878 sincos(ang,&sinr,&cosr);
879
880 f->p0 += weight * sinr;
881 f->p1 += weight * (sinr*sinr)/cosr;
882
883 }
884
var42_tangent(flam3_iter_helper * f,double weight)885 void var42_tangent(flam3_iter_helper *f, double weight)
886 {
887 /* Z+ variation Jan 07
888 procedure TXForm.Tangent;
889 begin
890 FPx := FPx + vars[30] * (sin(FTx)/cos(FTy));
891 FPy := FPy + vars[30] * (sin(FTy)/cos(FTy));
892 end;
893 */
894
895 f->p0 += weight * sin(f->tx)/cos(f->ty);
896 f->p1 += weight * tan(f->ty);
897
898 }
899
var43_square(flam3_iter_helper * f,double weight)900 void var43_square(flam3_iter_helper *f, double weight)
901 {
902 /* Z+ variation Jan 07
903 procedure TXForm.SquareBlur;
904 begin
905 FPx := FPx + vars[31] * (random - 0.5);
906 FPy := FPy + vars[31] * (random - 0.5);
907 end;
908 */
909
910 f->p0 += weight * (flam3_random_isaac_01(f->rc) - 0.5);
911 f->p1 += weight * (flam3_random_isaac_01(f->rc) - 0.5);
912
913 }
914
var44_rays(flam3_iter_helper * f,double weight)915 void var44_rays(flam3_iter_helper *f, double weight)
916 {
917 /* Z+ variation Jan 07
918 procedure TXForm.Rays;
919 var
920 r, sinr, cosr, tgr: double;
921 begin
922 SinCos(random * vars[32]*pi, sinr, cosr);
923 r := vars[32] / (sqr(FTx) + sqr(FTy) + EPS);
924 tgr := sinr/cosr;
925 FPx := FPx + tgr * (cos(FTx)*vars[32]) * r;
926 FPy := FPy + tgr * (sin(FTy)*vars[32]) * r;
927 end;
928 */
929
930 /*
931 * !!! Note !!!
932 * This code uses the variation weight in a non-standard fashion, and
933 * it may change or even be removed in future versions of flam3.
934 */
935
936 double ang = weight * flam3_random_isaac_01(f->rc) * M_PI;
937 double r = weight / (f->precalc_sumsq + EPS);
938 double tanr = weight * tan(ang) * r;
939
940
941 f->p0 += tanr * cos(f->tx);
942 f->p1 += tanr * sin(f->ty);
943
944 }
945
var45_blade(flam3_iter_helper * f,double weight)946 void var45_blade(flam3_iter_helper *f, double weight)
947 {
948 /* Z+ variation Jan 07
949 procedure TXForm.Blade;
950 var
951 r, sinr, cosr: double;
952 begin
953 r := sqrt(sqr(FTx) + sqr(FTy))*vars[33];
954 SinCos(r*random, sinr, cosr);
955 FPx := FPx + vars[33] * FTx * (cosr + sinr);
956 FPy := FPy + vars[33] * FTx * (cosr - sinr);
957 end;
958 */
959
960 /*
961 * !!! Note !!!
962 * This code uses the variation weight in a non-standard fashion, and
963 * it may change or even be removed in future versions of flam3.
964 */
965
966 double r = flam3_random_isaac_01(f->rc) * weight * f->precalc_sqrt;
967 double sinr,cosr;
968
969 sincos(r,&sinr,&cosr);
970
971 f->p0 += weight * f->tx * (cosr + sinr);
972 f->p1 += weight * f->tx * (cosr - sinr);
973
974 }
975
var46_secant2(flam3_iter_helper * f,double weight)976 void var46_secant2(flam3_iter_helper *f, double weight)
977 {
978 /* Intended as a 'fixed' version of secant */
979
980 /*
981 * !!! Note !!!
982 * This code uses the variation weight in a non-standard fashion, and
983 * it may change or even be removed in future versions of flam3.
984 */
985
986 double r = weight * f->precalc_sqrt;
987 double cr = cos(r);
988 double icr = 1.0/cr;
989
990 f->p0 += weight * f->tx;
991
992 if (cr<0)
993 f->p1 += weight*(icr + 1);
994 else
995 f->p1 += weight*(icr - 1);
996 }
997
var47_twintrian(flam3_iter_helper * f,double weight)998 void var47_twintrian(flam3_iter_helper *f, double weight)
999 {
1000 /* Z+ variation Jan 07
1001 procedure TXForm.TwinTrian;
1002 var
1003 r, diff, sinr, cosr: double;
1004 begin
1005 r := sqrt(sqr(FTx) + sqr(FTy))*vars[35];
1006 SinCos(r*random, sinr, cosr);
1007 diff := Math.Log10(sinr*sinr)+cosr;
1008 FPx := FPx + vars[35] * FTx * diff;
1009 FPy := FPy + vars[35] * FTx * (diff - (sinr*pi));
1010 end;
1011 */
1012
1013 /*
1014 * !!! Note !!!
1015 * This code uses the variation weight in a non-standard fashion, and
1016 * it may change or even be removed in future versions of flam3.
1017 */
1018
1019 double r = flam3_random_isaac_01(f->rc) * weight * f->precalc_sqrt;
1020 double sinr,cosr,diff;
1021
1022 sincos(r,&sinr,&cosr);
1023 diff = log10(sinr*sinr)+cosr;
1024
1025 if (badvalue(diff))
1026 diff = -30.0;
1027
1028 f->p0 += weight * f->tx * diff;
1029 f->p1 += weight * f->tx * (diff - sinr*M_PI);
1030
1031 }
1032
var48_cross(flam3_iter_helper * f,double weight)1033 void var48_cross(flam3_iter_helper *f, double weight)
1034 {
1035 /* Z+ variation Jan 07
1036 procedure TXForm.Cross;
1037 var
1038 r: double;
1039 begin
1040 r := vars[36]*sqrt(1/(sqr(sqr(FTx)-sqr(FTy))+EPS));
1041 FPx := FPx + FTx * r;
1042 FPy := FPy + FTy * r;
1043 end;
1044 */
1045
1046 double s = f->tx*f->tx - f->ty*f->ty;
1047 double r = weight * sqrt(1.0 / (s*s+EPS));
1048
1049 f->p0 += f->tx * r;
1050 f->p1 += f->ty * r;
1051
1052 }
1053
var49_disc2(flam3_iter_helper * f,double weight)1054 void var49_disc2(flam3_iter_helper *f, double weight)
1055 {
1056 /* Z+ variation Jan 07
1057 c := vvar/PI;
1058 k := rot*PI;
1059 sinadd := Sin(add);
1060 cosadd := Cos(add);
1061 cosadd := cosadd - 1;
1062 if (add > 2*PI) then begin
1063 cosadd := cosadd * (1 + add - 2*PI);
1064 sinadd := sinadd * (1 + add - 2*PI)
1065 end
1066 else if (add < -2*PI) then begin
1067 cosadd := cosadd * (1 + add + 2*PI);
1068 sinadd := sinadd * (1 + add + 2*PI)
1069 end
1070 end;
1071 procedure TVariationDisc2.CalcFunction;
1072 var
1073 r, sinr, cosr: extended;
1074 begin
1075 SinCos(k * (FTx^+FTy^), sinr, cosr); //rot*PI
1076 r := c * arctan2(FTx^, FTy^); //vvar/PI
1077 FPx^ := FPx^ + (sinr + cosadd) * r;
1078 FPy^ := FPy^ + (cosr + sinadd) * r;
1079 */
1080
1081 double r,t,sinr, cosr;
1082
1083 t = f->xform->disc2_timespi * (f->tx + f->ty);
1084 sincos(t,&sinr,&cosr);
1085 r = weight * f->precalc_atan / M_PI;
1086
1087 f->p0 += (sinr + f->xform->disc2_cosadd) * r;
1088 f->p1 += (cosr + f->xform->disc2_sinadd) * r;
1089
1090 }
1091
var50_supershape(flam3_iter_helper * f,double weight)1092 void var50_supershape(flam3_iter_helper *f, double weight) {
1093
1094 double theta;
1095 double t1,t2,r;
1096 double st,ct;
1097 double myrnd;
1098
1099 theta = f->xform->super_shape_pm_4 * f->precalc_atanyx + M_PI_4;
1100
1101 sincos(theta,&st,&ct);
1102
1103 t1 = fabs(ct);
1104 t1 = pow(t1,f->xform->super_shape_n2);
1105
1106 t2 = fabs(st);
1107 t2 = pow(t2,f->xform->super_shape_n3);
1108
1109 myrnd = f->xform->super_shape_rnd;
1110
1111 r = weight * ( (myrnd*flam3_random_isaac_01(f->rc) + (1.0-myrnd)*f->precalc_sqrt) - f->xform->super_shape_holes)
1112 * pow(t1+t2,f->xform->super_shape_pneg1_n1) / f->precalc_sqrt;
1113
1114 f->p0 += r * f->tx;
1115 f->p1 += r * f->ty;
1116 }
1117
var51_flower(flam3_iter_helper * f,double weight)1118 void var51_flower(flam3_iter_helper *f, double weight) {
1119 /* cyberxaos, 4/2007 */
1120 /* theta := arctan2(FTy^, FTx^);
1121 r := (random-holes)*cos(petals*theta);
1122 FPx^ := FPx^ + vvar*r*cos(theta);
1123 FPy^ := FPy^ + vvar*r*sin(theta);*/
1124
1125 double theta = f->precalc_atanyx;
1126 double r = weight * (flam3_random_isaac_01(f->rc) - f->xform->flower_holes) *
1127 cos(f->xform->flower_petals*theta) / f->precalc_sqrt;
1128
1129 f->p0 += r * f->tx;
1130 f->p1 += r * f->ty;
1131 }
1132
var52_conic(flam3_iter_helper * f,double weight)1133 void var52_conic(flam3_iter_helper *f, double weight) {
1134 /* cyberxaos, 4/2007 */
1135 /* theta := arctan2(FTy^, FTx^);
1136 r := (random - holes)*((eccentricity)/(1+eccentricity*cos(theta)));
1137 FPx^ := FPx^ + vvar*r*cos(theta);
1138 FPy^ := FPy^ + vvar*r*sin(theta); */
1139
1140 double ct = f->tx / f->precalc_sqrt;
1141 double r = weight * (flam3_random_isaac_01(f->rc) - f->xform->conic_holes) *
1142 f->xform->conic_eccentricity / (1 + f->xform->conic_eccentricity*ct) / f->precalc_sqrt;
1143
1144 f->p0 += r * f->tx;
1145 f->p1 += r * f->ty;
1146 }
1147
var53_parabola(flam3_iter_helper * f,double weight)1148 void var53_parabola(flam3_iter_helper *f, double weight) {
1149 /* cyberxaos, 4/2007 */
1150 /* r := sqrt(sqr(FTx^) + sqr(FTy^));
1151 FPx^ := FPx^ + parabola_height*vvar*sin(r)*sin(r)*random;
1152 FPy^ := FPy^ + parabola_width*vvar*cos(r)*random; */
1153
1154 double r = f->precalc_sqrt;
1155 double sr,cr;
1156
1157 sincos(r,&sr,&cr);
1158
1159 f->p0 += f->xform->parabola_height * weight * sr*sr * flam3_random_isaac_01(f->rc);
1160 f->p1 += f->xform->parabola_width * weight * cr * flam3_random_isaac_01(f->rc);
1161
1162 }
1163
var54_bent2(flam3_iter_helper * f,double weight)1164 void var54_bent2 (flam3_iter_helper *f, double weight) {
1165
1166 /* Bent2 in the Apophysis Plugin Pack */
1167
1168 double nx = f->tx;
1169 double ny = f->ty;
1170
1171 if (nx < 0.0)
1172 nx = nx * f->xform->bent2_x;
1173 if (ny < 0.0)
1174 ny = ny * f->xform->bent2_y;
1175
1176 f->p0 += weight * nx;
1177 f->p1 += weight * ny;
1178 }
1179
var55_bipolar(flam3_iter_helper * f,double weight)1180 void var55_bipolar (flam3_iter_helper *f, double weight) {
1181
1182 /* Bipolar in the Apophysis Plugin Pack */
1183
1184 double x2y2 = f->precalc_sumsq;
1185 double t = x2y2+1;
1186 double x2 = 2*f->tx;
1187 double ps = -M_PI_2 * f->xform->bipolar_shift;
1188 double y = 0.5 * atan2(2.0 * f->ty, x2y2 - 1.0) + ps;
1189
1190 if (y > M_PI_2)
1191 y = -M_PI_2 + fmod(y + M_PI_2, M_PI);
1192 else if (y < -M_PI_2)
1193 y = M_PI_2 - fmod(M_PI_2 - y, M_PI);
1194
1195 f->p0 += weight * 0.25 * M_2_PI * log ( (t+x2) / (t-x2) );
1196 f->p1 += weight * M_2_PI * y;
1197 }
1198
var56_boarders(flam3_iter_helper * f,double weight)1199 void var56_boarders (flam3_iter_helper *f, double weight) {
1200
1201 /* Boarders in the Apophysis Plugin Pack */
1202
1203 double roundX, roundY, offsetX, offsetY;
1204
1205 roundX = rint(f->tx);
1206 roundY = rint(f->ty);
1207 offsetX = f->tx - roundX;
1208 offsetY = f->ty - roundY;
1209
1210 if (flam3_random_isaac_01(f->rc) >= 0.75) {
1211 f->p0 += weight*(offsetX*0.5 + roundX);
1212 f->p1 += weight*(offsetY*0.5 + roundY);
1213 } else {
1214
1215 if (fabs(offsetX) >= fabs(offsetY)) {
1216
1217 if (offsetX >= 0.0) {
1218 f->p0 += weight*(offsetX*0.5 + roundX + 0.25);
1219 f->p1 += weight*(offsetY*0.5 + roundY + 0.25 * offsetY / offsetX);
1220 } else {
1221 f->p0 += weight*(offsetX*0.5 + roundX - 0.25);
1222 f->p1 += weight*(offsetY*0.5 + roundY - 0.25 * offsetY / offsetX);
1223 }
1224
1225 } else {
1226
1227 if (offsetY >= 0.0) {
1228 f->p1 += weight*(offsetY*0.5 + roundY + 0.25);
1229 f->p0 += weight*(offsetX*0.5 + roundX + offsetX/offsetY*0.25);
1230 } else {
1231 f->p1 += weight*(offsetY*0.5 + roundY - 0.25);
1232 f->p0 += weight*(offsetX*0.5 + roundX - offsetX/offsetY*0.25);
1233 }
1234 }
1235 }
1236 }
1237
var57_butterfly(flam3_iter_helper * f,double weight)1238 void var57_butterfly (flam3_iter_helper *f, double weight) {
1239
1240 /* Butterfly in the Apophysis Plugin Pack */
1241
1242 /* wx is weight*4/sqrt(3*pi) */
1243 double wx = weight*1.3029400317411197908970256609023;
1244
1245 double y2 = f->ty*2.0;
1246 double r = wx*sqrt(fabs(f->ty * f->tx)/(EPS + f->tx*f->tx + y2*y2));
1247
1248 f->p0 += r * f->tx;
1249 f->p1 += r * y2;
1250
1251 }
1252
var58_cell(flam3_iter_helper * f,double weight)1253 void var58_cell (flam3_iter_helper *f, double weight) {
1254
1255 /* Cell in the Apophysis Plugin Pack */
1256
1257 double inv_cell_size = 1.0/f->xform->cell_size;
1258
1259 /* calculate input cell */
1260 int x = floor(f->tx*inv_cell_size);
1261 int y = floor(f->ty*inv_cell_size);
1262
1263 /* Offset from cell origin */
1264 double dx = f->tx - x*f->xform->cell_size;
1265 double dy = f->ty - y*f->xform->cell_size;
1266
1267 /* interleave cells */
1268 if (y >= 0) {
1269 if (x >= 0) {
1270 y *= 2;
1271 x *= 2;
1272 } else {
1273 y *= 2;
1274 x = -(2*x+1);
1275 }
1276 } else {
1277 if (x >= 0) {
1278 y = -(2*y+1);
1279 x *= 2;
1280 } else {
1281 y = -(2*y+1);
1282 x = -(2*x+1);
1283 }
1284 }
1285
1286 f->p0 += weight * (dx + x*f->xform->cell_size);
1287 f->p1 -= weight * (dy + y*f->xform->cell_size);
1288
1289 }
1290
var59_cpow(flam3_iter_helper * f,double weight)1291 void var59_cpow (flam3_iter_helper *f, double weight) {
1292
1293 /* Cpow in the Apophysis Plugin Pack */
1294
1295 double a = f->precalc_atanyx;
1296 double lnr = 0.5 * log(f->precalc_sumsq);
1297 double va = 2.0 * M_PI / f->xform->cpow_power;
1298 double vc = f->xform->cpow_r / f->xform->cpow_power;
1299 double vd = f->xform->cpow_i / f->xform->cpow_power;
1300 double ang = vc*a + vd*lnr + va*floor(f->xform->cpow_power*flam3_random_isaac_01(f->rc));
1301 double sa,ca;
1302
1303 double m = weight * exp(vc * lnr - vd * a);
1304
1305 sincos(ang,&sa,&ca);
1306
1307 f->p0 += m * ca;
1308 f->p1 += m * sa;
1309
1310 }
1311
var60_curve(flam3_iter_helper * f,double weight)1312 void var60_curve (flam3_iter_helper *f, double weight) {
1313
1314 /* Curve in the Apophysis Plugin Pack */
1315
1316 double pc_xlen = f->xform->curve_xlength*f->xform->curve_xlength;
1317 double pc_ylen = f->xform->curve_ylength*f->xform->curve_ylength;
1318
1319 if (pc_xlen<1E-20) pc_xlen = 1E-20;
1320
1321 if (pc_ylen<1E-20) pc_ylen = 1E-20;
1322
1323 f->p0 += weight * (f->tx + f->xform->curve_xamp * exp(-f->ty*f->ty/pc_xlen));
1324 f->p1 += weight * (f->ty + f->xform->curve_yamp * exp(-f->tx*f->tx/pc_ylen));
1325
1326 }
1327
var61_edisc(flam3_iter_helper * f,double weight)1328 void var61_edisc (flam3_iter_helper *f, double weight) {
1329
1330 /* Edisc in the Apophysis Plugin Pack */
1331
1332 double tmp = f->precalc_sumsq + 1.0;
1333 double tmp2 = 2.0 * f->tx;
1334 double r1 = sqrt(tmp+tmp2);
1335 double r2 = sqrt(tmp-tmp2);
1336 double xmax = (r1+r2) * 0.5;
1337 double a1 = log(xmax + sqrt(xmax - 1.0));
1338 double a2 = -acos(f->tx/xmax);
1339 double w = weight / 11.57034632;
1340 double snv,csv,snhu,cshu;
1341
1342 sincos(a1,&snv,&csv);
1343
1344 snhu = sinh(a2);
1345 cshu = cosh(a2);
1346
1347 if (f->ty > 0.0) snv = -snv;
1348
1349 f->p0 += w * cshu * csv;
1350 f->p1 += w * snhu * snv;
1351
1352 }
1353
var62_elliptic(flam3_iter_helper * f,double weight)1354 void var62_elliptic (flam3_iter_helper *f, double weight) {
1355
1356 /* Elliptic in the Apophysis Plugin Pack */
1357
1358 double tmp = f->precalc_sumsq + 1.0;
1359 double x2 = 2.0 * f->tx;
1360 double xmax = 0.5 * (sqrt(tmp+x2) + sqrt(tmp-x2));
1361 double a = f->tx / xmax;
1362 double b = 1.0 - a*a;
1363 double ssx = xmax - 1.0;
1364 double w = weight / M_PI_2;
1365
1366 if (b<0)
1367 b = 0;
1368 else
1369 b = sqrt(b);
1370
1371 if (ssx<0)
1372 ssx = 0;
1373 else
1374 ssx = sqrt(ssx);
1375
1376 f->p0 += w * atan2(a,b);
1377
1378 if (f->ty > 0)
1379 f->p1 += w * log(xmax + ssx);
1380 else
1381 f->p1 -= w * log(xmax + ssx);
1382
1383 }
1384
var63_escher(flam3_iter_helper * f,double weight)1385 void var63_escher (flam3_iter_helper *f, double weight) {
1386
1387 /* Escher in the Apophysis Plugin Pack */
1388
1389 double seb,ceb;
1390 double vc,vd;
1391 double m,n;
1392 double sn,cn;
1393
1394 double a = f->precalc_atanyx;
1395 double lnr = 0.5 * log(f->precalc_sumsq);
1396
1397 sincos(f->xform->escher_beta,&seb,&ceb);
1398
1399 vc = 0.5 * (1.0 + ceb);
1400 vd = 0.5 * seb;
1401
1402 m = weight * exp(vc*lnr - vd*a);
1403 n = vc*a + vd*lnr;
1404
1405 sincos(n,&sn,&cn);
1406
1407 f->p0 += m * cn;
1408 f->p1 += m * sn;
1409
1410 }
1411
var64_foci(flam3_iter_helper * f,double weight)1412 void var64_foci (flam3_iter_helper *f, double weight) {
1413
1414 /* Foci in the Apophysis Plugin Pack */
1415
1416 double expx = exp(f->tx) * 0.5;
1417 double expnx = 0.25 / expx;
1418 double sn,cn,tmp;
1419
1420 sincos(f->ty,&sn,&cn);
1421 tmp = weight/(expx + expnx - cn);
1422
1423 f->p0 += tmp * (expx - expnx);
1424 f->p1 += tmp * sn;
1425
1426 }
1427
var65_lazysusan(flam3_iter_helper * f,double weight)1428 void var65_lazysusan (flam3_iter_helper *f, double weight) {
1429
1430 /* Lazysusan in the Apophysis Plugin Pack */
1431
1432 double x = f->tx - f->xform->lazysusan_x;
1433 double y = f->ty + f->xform->lazysusan_y;
1434 double r = sqrt(x*x + y*y);
1435 double sina, cosa;
1436
1437 if (r<weight) {
1438 double a = atan2(y,x) + f->xform->lazysusan_spin +
1439 f->xform->lazysusan_twist*(weight-r);
1440 sincos(a,&sina,&cosa);
1441 r = weight * r;
1442
1443 f->p0 += r*cosa + f->xform->lazysusan_x;
1444 f->p1 += r*sina - f->xform->lazysusan_y;
1445 } else {
1446
1447 r = weight * (1.0 + f->xform->lazysusan_space / r);
1448
1449 f->p0 += r*x + f->xform->lazysusan_x;
1450 f->p1 += r*y - f->xform->lazysusan_y;
1451
1452 }
1453
1454 }
1455
var66_loonie(flam3_iter_helper * f,double weight)1456 void var66_loonie (flam3_iter_helper *f, double weight) {
1457
1458 /* Loonie in the Apophysis Plugin Pack */
1459
1460 /*
1461 * !!! Note !!!
1462 * This code uses the variation weight in a non-standard fashion, and
1463 * it may change or even be removed in future versions of flam3.
1464 */
1465
1466 double r2 = f->precalc_sumsq;
1467 double w2 = weight*weight;
1468
1469 if (r2 < w2) {
1470 double r = weight * sqrt(w2/r2 - 1.0);
1471 f->p0 += r * f->tx;
1472 f->p1 += r * f->ty;
1473 } else {
1474 f->p0 += weight * f->tx;
1475 f->p1 += weight * f->ty;
1476 }
1477
1478 }
1479
var67_pre_blur(flam3_iter_helper * f,double weight)1480 void var67_pre_blur (flam3_iter_helper *f, double weight) {
1481
1482 /* pre-xform: PreBlur (Apo 2.08) */
1483
1484 /* Get pseudo-gaussian */
1485 double rndG = weight * (flam3_random_isaac_01(f->rc) + flam3_random_isaac_01(f->rc)
1486 + flam3_random_isaac_01(f->rc) + flam3_random_isaac_01(f->rc) - 2.0);
1487 double rndA = flam3_random_isaac_01(f->rc) * 2.0 * M_PI;
1488 double sinA,cosA;
1489
1490 sincos(rndA,&sinA,&cosA);
1491
1492 /* Note: original coordinate changed */
1493 f->tx += rndG * cosA;
1494 f->ty += rndG * sinA;
1495
1496 }
1497
var68_modulus(flam3_iter_helper * f,double weight)1498 void var68_modulus (flam3_iter_helper *f, double weight) {
1499
1500 /* Modulus in the Apophysis Plugin Pack */
1501
1502 double xr = 2*f->xform->modulus_x;
1503 double yr = 2*f->xform->modulus_y;
1504
1505 if (f->tx > f->xform->modulus_x)
1506 f->p0 += weight * (-f->xform->modulus_x + fmod(f->tx + f->xform->modulus_x, xr));
1507 else if (f->tx < -f->xform->modulus_x)
1508 f->p0 += weight * ( f->xform->modulus_x - fmod(f->xform->modulus_x - f->tx, xr));
1509 else
1510 f->p0 += weight * f->tx;
1511
1512 if (f->ty > f->xform->modulus_y)
1513 f->p1 += weight * (-f->xform->modulus_y + fmod(f->ty + f->xform->modulus_y, yr));
1514 else if (f->ty < -f->xform->modulus_y)
1515 f->p1 += weight * ( f->xform->modulus_y - fmod(f->xform->modulus_y - f->ty, yr));
1516 else
1517 f->p1 += weight * f->ty;
1518
1519 }
1520
var69_oscope(flam3_iter_helper * f,double weight)1521 void var69_oscope (flam3_iter_helper *f, double weight) {
1522
1523 /* oscilloscope from the apophysis plugin pack */
1524
1525 double tpf = 2 * M_PI * f->xform->oscope_frequency;
1526 double t;
1527
1528 if (f->xform->oscope_damping == 0.0)
1529 t = f->xform->oscope_amplitude * cos(tpf*f->tx) + f->xform->oscope_separation;
1530 else {
1531 t = f->xform->oscope_amplitude * exp(-fabs(f->tx)*f->xform->oscope_damping)
1532 * cos(tpf*f->tx) + f->xform->oscope_separation;
1533 }
1534
1535 if (fabs(f->ty) <= t) {
1536 f->p0 += weight*f->tx;
1537 f->p1 -= weight*f->ty;
1538 } else {
1539 f->p0 += weight*f->tx;
1540 f->p1 += weight*f->ty;
1541 }
1542 }
1543
var70_polar2(flam3_iter_helper * f,double weight)1544 void var70_polar2 (flam3_iter_helper *f, double weight) {
1545
1546 /* polar2 from the apophysis plugin pack */
1547
1548 double p2v = weight / M_PI;
1549
1550 f->p0 += p2v * f->precalc_atan;
1551 f->p1 += p2v/2.0 * log(f->precalc_sumsq);
1552 }
1553
var71_popcorn2(flam3_iter_helper * f,double weight)1554 void var71_popcorn2 (flam3_iter_helper *f, double weight) {
1555
1556 /* popcorn2 from the apophysis plugin pack */
1557
1558 f->p0 += weight * ( f->tx + f->xform->popcorn2_x * sin(tan(f->ty*f->xform->popcorn2_c)));
1559 f->p1 += weight * ( f->ty + f->xform->popcorn2_y * sin(tan(f->tx*f->xform->popcorn2_c)));
1560
1561 }
1562
var72_scry(flam3_iter_helper * f,double weight)1563 void var72_scry (flam3_iter_helper *f, double weight) {
1564
1565 /* scry from the apophysis plugin pack */
1566 /* note that scry does not multiply by weight, but as the */
1567 /* values still approach 0 as the weight approaches 0, it */
1568 /* should be ok */
1569
1570 /*
1571 * !!! Note !!!
1572 * This code uses the variation weight in a non-standard fashion, and
1573 * it may change or even be removed in future versions of flam3.
1574 */
1575
1576 double t = f->precalc_sumsq;
1577 double r = 1.0 / (f->precalc_sqrt * (t + 1.0/(weight+EPS)));
1578
1579 f->p0 += f->tx * r;
1580 f->p1 += f->ty * r;
1581
1582 }
1583
var73_separation(flam3_iter_helper * f,double weight)1584 void var73_separation (flam3_iter_helper *f, double weight) {
1585
1586 /* separation from the apophysis plugin pack */
1587
1588 double sx2 = f->xform->separation_x * f->xform->separation_x;
1589 double sy2 = f->xform->separation_y * f->xform->separation_y;
1590
1591 if (f->tx > 0.0)
1592 f->p0 += weight * (sqrt(f->tx*f->tx + sx2)- f->tx*f->xform->separation_xinside);
1593 else
1594 f->p0 -= weight * (sqrt(f->tx*f->tx + sx2)+ f->tx*f->xform->separation_xinside);
1595
1596 if (f->ty > 0.0)
1597 f->p1 += weight * (sqrt(f->ty*f->ty + sy2)- f->ty*f->xform->separation_yinside);
1598 else
1599 f->p1 -= weight * (sqrt(f->ty*f->ty + sy2)+ f->ty*f->xform->separation_yinside);
1600
1601 }
1602
var74_split(flam3_iter_helper * f,double weight)1603 void var74_split (flam3_iter_helper *f, double weight) {
1604
1605 /* Split from apo plugins pack */
1606
1607 if (cos(f->tx*f->xform->split_xsize*M_PI) >= 0)
1608 f->p1 += weight*f->ty;
1609 else
1610 f->p1 -= weight*f->ty;
1611
1612 if (cos(f->ty*f->xform->split_ysize*M_PI) >= 0)
1613 f->p0 += weight * f->tx;
1614 else
1615 f->p0 -= weight * f->tx;
1616
1617 }
1618
var75_splits(flam3_iter_helper * f,double weight)1619 void var75_splits (flam3_iter_helper *f, double weight) {
1620
1621 /* Splits from apo plugins pack */
1622
1623 if (f->tx >= 0)
1624 f->p0 += weight*(f->tx+f->xform->splits_x);
1625 else
1626 f->p0 += weight*(f->tx-f->xform->splits_x);
1627
1628 if (f->ty >= 0)
1629 f->p1 += weight*(f->ty+f->xform->splits_y);
1630 else
1631 f->p1 += weight*(f->ty-f->xform->splits_y);
1632
1633 }
1634
var76_stripes(flam3_iter_helper * f,double weight)1635 void var76_stripes (flam3_iter_helper *f, double weight) {
1636
1637 /* Stripes from apo plugins pack */
1638
1639 double roundx,offsetx;
1640
1641 roundx = floor(f->tx + 0.5);
1642 offsetx = f->tx - roundx;
1643
1644 f->p0 += weight * (offsetx*(1.0-f->xform->stripes_space)+roundx);
1645 f->p1 += weight * (f->ty + offsetx*offsetx*f->xform->stripes_warp);
1646
1647 }
1648
var77_wedge(flam3_iter_helper * f,double weight)1649 void var77_wedge (flam3_iter_helper *f, double weight) {
1650
1651 /* Wedge from apo plugins pack */
1652
1653 double r = f->precalc_sqrt;
1654 double a = f->precalc_atanyx + f->xform->wedge_swirl * r;
1655 double c = floor( (f->xform->wedge_count * a + M_PI)*M_1_PI*0.5);
1656
1657 double comp_fac = 1 - f->xform->wedge_angle*f->xform->wedge_count*M_1_PI*0.5;
1658 double sa, ca;
1659
1660 a = a * comp_fac + c * f->xform->wedge_angle;
1661
1662 sincos(a,&sa,&ca);
1663
1664 r = weight * (r + f->xform->wedge_hole);
1665
1666 f->p0 += r*ca;
1667 f->p1 += r*sa;
1668
1669 }
1670
var78_wedge_julia(flam3_iter_helper * f,double weight)1671 void var78_wedge_julia (flam3_iter_helper *f, double weight) {
1672
1673 /* wedge_julia from apo plugin pack */
1674
1675 double r = weight * pow(f->precalc_sumsq, f->xform->wedgeJulia_cn);
1676 int t_rnd = (int)((f->xform->wedgeJulia_rN)*flam3_random_isaac_01(f->rc));
1677 double a = (f->precalc_atanyx + 2 * M_PI * t_rnd) / f->xform->wedge_julia_power;
1678 double c = floor( (f->xform->wedge_julia_count * a + M_PI)*M_1_PI*0.5 );
1679 double sa,ca;
1680
1681 a = a * f->xform->wedgeJulia_cf + c * f->xform->wedge_julia_angle;
1682
1683 sincos(a,&sa,&ca);
1684
1685 f->p0 += r * ca;
1686 f->p1 += r * sa;
1687 }
1688
var79_wedge_sph(flam3_iter_helper * f,double weight)1689 void var79_wedge_sph (flam3_iter_helper *f, double weight) {
1690
1691 /* Wedge_sph from apo plugins pack */
1692
1693 double r = 1.0/(f->precalc_sqrt+EPS);
1694 double a = f->precalc_atanyx + f->xform->wedge_sph_swirl * r;
1695 double c = floor( (f->xform->wedge_sph_count * a + M_PI)*M_1_PI*0.5);
1696
1697 double comp_fac = 1 - f->xform->wedge_sph_angle*f->xform->wedge_sph_count*M_1_PI*0.5;
1698 double sa, ca;
1699
1700 a = a * comp_fac + c * f->xform->wedge_sph_angle;
1701
1702 sincos(a,&sa,&ca);
1703 r = weight * (r + f->xform->wedge_sph_hole);
1704
1705 f->p0 += r*ca;
1706 f->p1 += r*sa;
1707
1708 }
1709
var80_whorl(flam3_iter_helper * f,double weight)1710 void var80_whorl (flam3_iter_helper *f, double weight) {
1711
1712 /* whorl from apo plugins pack */
1713
1714 /*
1715 * !!! Note !!!
1716 * This code uses the variation weight in a non-standard fashion, and
1717 * it may change or even be removed in future versions of flam3.
1718 */
1719
1720 double r = f->precalc_sqrt;
1721 double a,sa,ca;
1722
1723 if (r<weight)
1724 a = f->precalc_atanyx + f->xform->whorl_inside/(weight-r);
1725 else
1726 a = f->precalc_atanyx + f->xform->whorl_outside/(weight-r);
1727
1728 sincos(a,&sa,&ca);
1729
1730 f->p0 += weight*r*ca;
1731 f->p1 += weight*r*sa;
1732
1733 }
1734
var81_waves2(flam3_iter_helper * f,double weight)1735 void var81_waves2 (flam3_iter_helper *f, double weight) {
1736
1737 /* waves2 from Joel F */
1738
1739 f->p0 += weight*(f->tx + f->xform->waves2_scalex*sin(f->ty * f->xform->waves2_freqx));
1740 f->p1 += weight*(f->ty + f->xform->waves2_scaley*sin(f->tx * f->xform->waves2_freqy));
1741
1742 }
1743
1744 /* complex vars by cothe */
1745 /* exp log sin cos tan sec csc cot sinh cosh tanh sech csch coth */
1746
var82_exp(flam3_iter_helper * f,double weight)1747 void var82_exp (flam3_iter_helper *f, double weight) {
1748 //Exponential EXP
1749 double expe = exp(f->tx);
1750 double expcos,expsin;
1751 sincos(f->ty,&expsin,&expcos);
1752 f->p0 += weight * expe * expcos;
1753 f->p1 += weight * expe * expsin;
1754 }
1755
var83_log(flam3_iter_helper * f,double weight)1756 void var83_log (flam3_iter_helper *f, double weight) {
1757 //Natural Logarithm LOG
1758 // needs precalc_atanyx and precalc_sumsq
1759 f->p0 += weight * 0.5 * log(f->precalc_sumsq);
1760 f->p1 += weight * f->precalc_atanyx;
1761 }
1762
var84_sin(flam3_iter_helper * f,double weight)1763 void var84_sin (flam3_iter_helper *f, double weight) {
1764 //Sine SIN
1765 double sinsin,sinacos,sinsinh,sincosh;
1766 sincos(f->tx,&sinsin,&sinacos);
1767 sinsinh = sinh(f->ty);
1768 sincosh = cosh(f->ty);
1769 f->p0 += weight * sinsin * sincosh;
1770 f->p1 += weight * sinacos * sinsinh;
1771 }
1772
var85_cos(flam3_iter_helper * f,double weight)1773 void var85_cos (flam3_iter_helper *f, double weight) {
1774 //Cosine COS
1775 double cossin,coscos,cossinh,coscosh;
1776 sincos(f->tx,&cossin,&coscos);
1777 cossinh = sinh(f->ty);
1778 coscosh = cosh(f->ty);
1779 f->p0 += weight * coscos * coscosh;
1780 f->p1 -= weight * cossin * cossinh;
1781 }
1782
var86_tan(flam3_iter_helper * f,double weight)1783 void var86_tan (flam3_iter_helper *f, double weight) {
1784 //Tangent TAN
1785 double tansin,tancos,tansinh,tancosh;
1786 double tanden;
1787 sincos(2*f->tx,&tansin,&tancos);
1788 tansinh = sinh(2.0*f->ty);
1789 tancosh = cosh(2.0*f->ty);
1790 tanden = 1.0/(tancos + tancosh);
1791 f->p0 += weight * tanden * tansin;
1792 f->p1 += weight * tanden * tansinh;
1793 }
1794
var87_sec(flam3_iter_helper * f,double weight)1795 void var87_sec (flam3_iter_helper *f, double weight) {
1796 //Secant SEC
1797 double secsin,seccos,secsinh,seccosh;
1798 double secden;
1799 sincos(f->tx,&secsin,&seccos);
1800 secsinh = sinh(f->ty);
1801 seccosh = cosh(f->ty);
1802 secden = 2.0/(cos(2*f->tx) + cosh(2*f->ty));
1803 f->p0 += weight * secden * seccos * seccosh;
1804 f->p1 += weight * secden * secsin * secsinh;
1805 }
1806
var88_csc(flam3_iter_helper * f,double weight)1807 void var88_csc (flam3_iter_helper *f, double weight) {
1808 //Cosecant CSC
1809 double cscsin,csccos,cscsinh,csccosh;
1810 double cscden;
1811 sincos(f->tx,&cscsin,&csccos);
1812 cscsinh = sinh(f->ty);
1813 csccosh = cosh(f->ty);
1814 cscden = 2.0/(cosh(2.0*f->ty) - cos(2.0*f->tx));
1815 f->p0 += weight * cscden * cscsin * csccosh;
1816 f->p1 -= weight * cscden * csccos * cscsinh;
1817 }
1818
var89_cot(flam3_iter_helper * f,double weight)1819 void var89_cot (flam3_iter_helper *f, double weight) {
1820 //Cotangent COT
1821 double cotsin,cotcos,cotsinh,cotcosh;
1822 double cotden;
1823 sincos(2.0*f->tx,&cotsin,&cotcos);
1824 cotsinh = sinh(2.0*f->ty);
1825 cotcosh = cosh(2.0*f->ty);
1826 cotden = 1.0/(cotcosh - cotcos);
1827 f->p0 += weight * cotden * cotsin;
1828 f->p1 += weight * cotden * -1 * cotsinh;
1829 }
1830
var90_sinh(flam3_iter_helper * f,double weight)1831 void var90_sinh (flam3_iter_helper *f, double weight) {
1832 //Hyperbolic Sine SINH
1833 double sinhsin,sinhcos,sinhsinh,sinhcosh;
1834 sincos(f->ty,&sinhsin,&sinhcos);
1835 sinhsinh = sinh(f->tx);
1836 sinhcosh = cosh(f->tx);
1837 f->p0 += weight * sinhsinh * sinhcos;
1838 f->p1 += weight * sinhcosh * sinhsin;
1839 }
1840
var91_cosh(flam3_iter_helper * f,double weight)1841 void var91_cosh (flam3_iter_helper *f, double weight) {
1842 //Hyperbolic Cosine COSH
1843 double coshsin,coshcos,coshsinh,coshcosh;
1844 sincos(f->ty,&coshsin,&coshcos);
1845 coshsinh = sinh(f->tx);
1846 coshcosh = cosh(f->tx);
1847 f->p0 += weight * coshcosh * coshcos;
1848 f->p1 += weight * coshsinh * coshsin;
1849 }
1850
var92_tanh(flam3_iter_helper * f,double weight)1851 void var92_tanh (flam3_iter_helper *f, double weight) {
1852 //Hyperbolic Tangent TANH
1853 double tanhsin,tanhcos,tanhsinh,tanhcosh;
1854 double tanhden;
1855 sincos(2.0*f->ty,&tanhsin,&tanhcos);
1856 tanhsinh = sinh(2.0*f->tx);
1857 tanhcosh = cosh(2.0*f->tx);
1858 tanhden = 1.0/(tanhcos + tanhcosh);
1859 f->p0 += weight * tanhden * tanhsinh;
1860 f->p1 += weight * tanhden * tanhsin;
1861 }
1862
var93_sech(flam3_iter_helper * f,double weight)1863 void var93_sech (flam3_iter_helper *f, double weight) {
1864 //Hyperbolic Secant SECH
1865 double sechsin,sechcos,sechsinh,sechcosh;
1866 double sechden;
1867 sincos(f->ty,&sechsin,&sechcos);
1868 sechsinh = sinh(f->tx);
1869 sechcosh = cosh(f->tx);
1870 sechden = 2.0/(cos(2.0*f->ty) + cosh(2.0*f->tx));
1871 f->p0 += weight * sechden * sechcos * sechcosh;
1872 f->p1 -= weight * sechden * sechsin * sechsinh;
1873 }
1874
var94_csch(flam3_iter_helper * f,double weight)1875 void var94_csch (flam3_iter_helper *f, double weight) {
1876 //Hyperbolic Cosecant CSCH
1877 double cschsin,cschcos,cschsinh,cschcosh;
1878 double cschden;
1879 sincos(f->ty,&cschsin,&cschcos);
1880 cschsinh = sinh(f->tx);
1881 cschcosh = cosh(f->tx);
1882 cschden = 2.0/(cosh(2.0*f->tx) - cos(2.0*f->ty));
1883 f->p0 += weight * cschden * cschsinh * cschcos;
1884 f->p1 -= weight * cschden * cschcosh * cschsin;
1885 }
1886
var95_coth(flam3_iter_helper * f,double weight)1887 void var95_coth (flam3_iter_helper *f, double weight) {
1888 //Hyperbolic Cotangent COTH
1889 double cothsin,cothcos,cothsinh,cothcosh;
1890 double cothden;
1891 sincos(2.0*f->ty,&cothsin,&cothcos);
1892 cothsinh = sinh(2.0*f->tx);
1893 cothcosh = cosh(2.0*f->tx);
1894 cothden = 1.0/(cothcosh - cothcos);
1895 f->p0 += weight * cothden * cothsinh;
1896 f->p1 += weight * cothden * cothsin;
1897 }
1898
var96_auger(flam3_iter_helper * f,double weight)1899 void var96_auger (flam3_iter_helper *f, double weight) {
1900
1901 // Auger, by Xyrus01
1902 double s = sin(f->xform->auger_freq * f->tx);
1903 double t = sin(f->xform->auger_freq * f->ty);
1904 double dy = f->ty + f->xform->auger_weight*(f->xform->auger_scale*s/2.0 + fabs(f->ty)*s);
1905 double dx = f->tx + f->xform->auger_weight*(f->xform->auger_scale*t/2.0 + fabs(f->tx)*t);
1906
1907 f->p0 += weight * (f->tx + f->xform->auger_sym*(dx-f->tx));
1908 f->p1 += weight * dy;
1909 }
1910
var97_flux(flam3_iter_helper * f,double weight)1911 void var97_flux (flam3_iter_helper *f, double weight) {
1912
1913 // Flux, by meckie
1914 double xpw = f->tx + weight;
1915 double xmw = f->tx - weight;
1916 double avgr = weight * (2 + f->xform->flux_spread) * sqrt( sqrt(f->ty*f->ty + xpw*xpw) / sqrt(f->ty*f->ty + xmw*xmw));
1917 double avga = ( atan2(f->ty, xmw) - atan2(f->ty,xpw) ) * 0.5;
1918
1919 f->p0 += avgr * cos(avga);
1920 f->p1 += avgr * sin(avga);
1921 }
1922
var98_mobius(flam3_iter_helper * f,double weight)1923 void var98_mobius (flam3_iter_helper *f, double weight) {
1924
1925 // Mobius, by eralex
1926 double re_u, im_u, re_v, im_v, rad_v;
1927
1928 re_u = f->xform->mobius_re_a * f->tx - f->xform->mobius_im_a * f->ty + f->xform->mobius_re_b;
1929 im_u = f->xform->mobius_re_a * f->ty + f->xform->mobius_im_a * f->tx + f->xform->mobius_im_b;
1930 re_v = f->xform->mobius_re_c * f->tx - f->xform->mobius_im_c * f->ty + f->xform->mobius_re_d;
1931 im_v = f->xform->mobius_re_c * f->ty + f->xform->mobius_im_c * f->tx + f->xform->mobius_im_d;
1932
1933 rad_v = weight / (re_v*re_v + im_v*im_v);
1934
1935 f->p0 += rad_v * (re_u*re_v + im_u*im_v);
1936 f->p1 += rad_v * (im_u*re_v - re_u*im_v);
1937 }
1938
1939
1940 /* Precalc functions */
1941
perspective_precalc(flam3_xform * xf)1942 void perspective_precalc(flam3_xform *xf) {
1943 double ang = xf->perspective_angle * M_PI / 2.0;
1944 xf->persp_vsin = sin(ang);
1945 xf->persp_vfcos = xf->perspective_dist * cos(ang);
1946 }
1947
juliaN_precalc(flam3_xform * xf)1948 void juliaN_precalc(flam3_xform *xf) {
1949 xf->julian_rN = fabs(xf->julian_power);
1950 xf->julian_cn = xf->julian_dist / (double)xf->julian_power / 2.0;
1951 }
1952
wedgeJulia_precalc(flam3_xform * xf)1953 void wedgeJulia_precalc(flam3_xform *xf) {
1954 xf->wedgeJulia_cf = 1.0 - xf->wedge_julia_angle * xf->wedge_julia_count * M_1_PI * 0.5;
1955 xf->wedgeJulia_rN = fabs(xf->wedge_julia_power);
1956 xf->wedgeJulia_cn = xf->wedge_julia_dist / xf->wedge_julia_power / 2.0;
1957 }
1958
juliaScope_precalc(flam3_xform * xf)1959 void juliaScope_precalc(flam3_xform *xf) {
1960 xf->juliascope_rN = fabs(xf->juliascope_power);
1961 xf->juliascope_cn = xf->juliascope_dist / (double)xf->juliascope_power / 2.0;
1962 }
1963
radial_blur_precalc(flam3_xform * xf)1964 void radial_blur_precalc(flam3_xform *xf) {
1965 sincos(xf->radial_blur_angle * M_PI / 2.0,
1966 &xf->radialBlur_spinvar, &xf->radialBlur_zoomvar);
1967 }
1968
waves_precalc(flam3_xform * xf)1969 void waves_precalc(flam3_xform *xf) {
1970 double dx = xf->c[2][0];
1971 double dy = xf->c[2][1];
1972
1973 xf->waves_dx2 = 1.0/(dx * dx + EPS);
1974 xf->waves_dy2 = 1.0/(dy * dy + EPS);
1975 }
1976
disc2_precalc(flam3_xform * xf)1977 void disc2_precalc(flam3_xform *xf) {
1978 double add = xf->disc2_twist;
1979 double k;
1980
1981 xf->disc2_timespi = xf->disc2_rot * M_PI;
1982
1983 sincos(add,&xf->disc2_sinadd,&xf->disc2_cosadd);
1984 xf->disc2_cosadd -= 1;
1985
1986 if (add > 2 * M_PI) {
1987 k = (1 + add - 2*M_PI);
1988 xf->disc2_cosadd *= k;
1989 xf->disc2_sinadd *= k;
1990 }
1991
1992 if (add < -2 * M_PI) {
1993 k = (1 + add + 2*M_PI);
1994 xf->disc2_cosadd *= k;
1995 xf->disc2_sinadd *= k;
1996 }
1997 }
1998
supershape_precalc(flam3_xform * xf)1999 void supershape_precalc(flam3_xform *xf) {
2000 xf->super_shape_pm_4 = xf->super_shape_m / 4.0;
2001 xf->super_shape_pneg1_n1 = -1.0 / xf->super_shape_n1;
2002 }
2003
xform_precalc(flam3_genome * cp,int xi)2004 void xform_precalc(flam3_genome *cp, int xi) {
2005
2006 perspective_precalc(&(cp->xform[xi]));
2007 juliaN_precalc(&(cp->xform[xi]));
2008 juliaScope_precalc(&(cp->xform[xi]));
2009 radial_blur_precalc(&(cp->xform[xi]));
2010 waves_precalc(&(cp->xform[xi]));
2011 disc2_precalc(&(cp->xform[xi]));
2012 supershape_precalc(&(cp->xform[xi]));
2013 wedgeJulia_precalc(&(cp->xform[xi]));
2014 }
2015
prepare_precalc_flags(flam3_genome * cp)2016 int prepare_precalc_flags(flam3_genome *cp) {
2017
2018 double d;
2019 int i,j,totnum;
2020
2021 /* Loop over valid xforms */
2022 for (i = 0; i < cp->num_xforms; i++) {
2023 d = cp->xform[i].density;
2024 if (d < 0.0) {
2025 fprintf(stderr, "xform %d weight must be non-negative, not %g.\n",i,d);
2026 return(1);
2027 }
2028
2029 if (i != cp->final_xform_index && d == 0.0)
2030 continue;
2031
2032 totnum = 0;
2033
2034 cp->xform[i].vis_adjusted = adjust_percentage(cp->xform[i].opacity);
2035
2036 cp->xform[i].precalc_angles_flag=0;
2037 cp->xform[i].precalc_atan_xy_flag=0;
2038 cp->xform[i].precalc_atan_yx_flag=0;
2039 cp->xform[i].has_preblur=0;
2040 cp->xform[i].has_post = !(id_matrix(cp->xform[i].post));
2041
2042
2043 for (j = 0; j < flam3_nvariations; j++) {
2044
2045 if (cp->xform[i].var[j]!=0) {
2046
2047 cp->xform[i].varFunc[totnum] = j;
2048 cp->xform[i].active_var_weights[totnum] = cp->xform[i].var[j];
2049
2050 if (j==VAR_POLAR) {
2051 cp->xform[i].precalc_atan_xy_flag=1;
2052 } else if (j==VAR_HANDKERCHIEF) {
2053 cp->xform[i].precalc_atan_xy_flag=1;
2054 } else if (j==VAR_HEART) {
2055 cp->xform[i].precalc_atan_xy_flag=1;
2056 } else if (j==VAR_DISC) {
2057 cp->xform[i].precalc_atan_xy_flag=1;
2058 } else if (j==VAR_SPIRAL) {
2059 cp->xform[i].precalc_angles_flag=1;
2060 } else if (j==VAR_HYPERBOLIC) {
2061 cp->xform[i].precalc_angles_flag=1;
2062 } else if (j==VAR_DIAMOND) {
2063 cp->xform[i].precalc_angles_flag=1;
2064 } else if (j==VAR_EX) {
2065 cp->xform[i].precalc_atan_xy_flag=1;
2066 } else if (j==VAR_JULIA) {
2067 cp->xform[i].precalc_atan_xy_flag=1;
2068 } else if (j==VAR_POWER) {
2069 cp->xform[i].precalc_angles_flag=1;
2070 } else if (j==VAR_RINGS) {
2071 cp->xform[i].precalc_angles_flag=1;
2072 } else if (j==VAR_FAN) {
2073 cp->xform[i].precalc_atan_xy_flag=1;
2074 } else if (j==VAR_BLOB) {
2075 cp->xform[i].precalc_atan_xy_flag=1;
2076 cp->xform[i].precalc_angles_flag=1;
2077 } else if (j==VAR_FAN2) {
2078 cp->xform[i].precalc_atan_xy_flag=1;
2079 } else if (j==VAR_RINGS2) {
2080 cp->xform[i].precalc_angles_flag=1;
2081 } else if (j==VAR_JULIAN) {
2082 cp->xform[i].precalc_atan_yx_flag=1;
2083 } else if (j==VAR_JULIASCOPE) {
2084 cp->xform[i].precalc_atan_yx_flag=1;
2085 } else if (j==VAR_RADIAL_BLUR) {
2086 cp->xform[i].precalc_atan_yx_flag=1;
2087 } else if (j==VAR_NGON) {
2088 cp->xform[i].precalc_atan_yx_flag=1;
2089 } else if (j==VAR_DISC2) {
2090 cp->xform[i].precalc_atan_xy_flag=1;
2091 } else if (j==VAR_SUPER_SHAPE) {
2092 cp->xform[i].precalc_atan_yx_flag=1;
2093 } else if (j==VAR_FLOWER) {
2094 cp->xform[i].precalc_atan_yx_flag=1;
2095 } else if (j==VAR_CONIC) {
2096 cp->xform[i].precalc_atan_yx_flag=1;
2097 } else if (j==VAR_CPOW) {
2098 cp->xform[i].precalc_atan_yx_flag=1;
2099 } else if (j==VAR_ESCHER) {
2100 cp->xform[i].precalc_atan_yx_flag=1;
2101 } else if (j==VAR_PRE_BLUR) {
2102 cp->xform[i].has_preblur=cp->xform[i].var[j];
2103 } else if (j==VAR_POLAR2) {
2104 cp->xform[i].precalc_atan_xy_flag=1;
2105 } else if (j==VAR_WEDGE) {
2106 cp->xform[i].precalc_atan_yx_flag=1;
2107 } else if (j==VAR_WEDGE_JULIA) {
2108 cp->xform[i].precalc_atan_yx_flag=1;
2109 } else if (j==VAR_WEDGE_SPH) {
2110 cp->xform[i].precalc_atan_yx_flag=1;
2111 } else if (j==VAR_WHORL) {
2112 cp->xform[i].precalc_atan_yx_flag=1;
2113 } else if (j==VAR_LOG) {
2114 cp->xform[i].precalc_atan_yx_flag=1;
2115 }
2116
2117 totnum++;
2118 }
2119 }
2120
2121 cp->xform[i].num_active_vars = totnum;
2122
2123 }
2124
2125 return(0);
2126 }
2127
2128
apply_xform(flam3_genome * cp,int fn,double * p,double * q,randctx * rc)2129 int apply_xform(flam3_genome *cp, int fn, double *p, double *q, randctx *rc)
2130 {
2131 flam3_iter_helper f;
2132 int var_n;
2133 double s1;
2134 double weight;
2135
2136 f.rc = rc;
2137
2138 s1 = cp->xform[fn].color_speed;
2139
2140 q[2] = s1 * cp->xform[fn].color + (1.0-s1) * p[2];
2141 q[3] = cp->xform[fn].vis_adjusted;
2142
2143 //fprintf(stderr,"%d : %f %f %f\n",fn,cp->xform[fn].c[0][0],cp->xform[fn].c[1][0],cp->xform[fn].c[2][0]);
2144
2145 f.tx = cp->xform[fn].c[0][0] * p[0] + cp->xform[fn].c[1][0] * p[1] + cp->xform[fn].c[2][0];
2146 f.ty = cp->xform[fn].c[0][1] * p[0] + cp->xform[fn].c[1][1] * p[1] + cp->xform[fn].c[2][1];
2147
2148 /* Pre-xforms go here, and modify the f.tx and f.ty values */
2149 if (cp->xform[fn].has_preblur!=0.0)
2150 var67_pre_blur(&f, cp->xform[fn].has_preblur);
2151
2152 /* Always calculate sumsq and sqrt */
2153 f.precalc_sumsq = f.tx*f.tx + f.ty*f.ty;
2154 f.precalc_sqrt = sqrt(f.precalc_sumsq);
2155
2156 /* Check to see if we can precalculate any parts */
2157 /* Precalculate atanxy, sin, cos */
2158 if (cp->xform[fn].precalc_atan_xy_flag > 0) {
2159 f.precalc_atan = atan2(f.tx,f.ty);
2160 }
2161
2162 if (cp->xform[fn].precalc_angles_flag > 0) {
2163 f.precalc_sina = f.tx / f.precalc_sqrt;
2164 f.precalc_cosa = f.ty / f.precalc_sqrt;
2165 }
2166
2167 /* Precalc atanyx */
2168 if (cp->xform[fn].precalc_atan_yx_flag > 0) {
2169 f.precalc_atanyx = atan2(f.ty,f.tx);
2170 }
2171
2172 f.p0 = 0.0;
2173 f.p1 = 0.0;
2174 f.xform = &(cp->xform[fn]);
2175
2176
2177 for (var_n=0; var_n < cp->xform[fn].num_active_vars; var_n++) {
2178
2179 weight = cp->xform[fn].active_var_weights[var_n];
2180
2181 switch (cp->xform[fn].varFunc[var_n]) {
2182
2183 case (VAR_LINEAR):
2184 var0_linear(&f, weight); break;
2185 case (VAR_SINUSOIDAL):
2186 var1_sinusoidal(&f, weight); break;
2187 case (VAR_SPHERICAL):
2188 var2_spherical(&f, weight); break;
2189 case (VAR_SWIRL):
2190 var3_swirl(&f, weight); break;
2191 case (VAR_HORSESHOE):
2192 var4_horseshoe(&f, weight); break;
2193 case (VAR_POLAR):
2194 var5_polar(&f, weight); break;
2195 case (VAR_HANDKERCHIEF):
2196 var6_handkerchief(&f, weight); break;
2197 case (VAR_HEART):
2198 var7_heart(&f, weight); break;
2199 case (VAR_DISC):
2200 var8_disc(&f, weight); break;
2201 case (VAR_SPIRAL):
2202 var9_spiral(&f, weight); break;
2203 case (VAR_HYPERBOLIC):
2204 var10_hyperbolic(&f, weight); break;
2205 case (VAR_DIAMOND):
2206 var11_diamond(&f, weight); break;
2207 case (VAR_EX):
2208 var12_ex(&f, weight); break;
2209 case (VAR_JULIA):
2210 var13_julia(&f, weight); break;
2211 case (VAR_BENT):
2212 var14_bent(&f, weight); break;
2213 case (VAR_WAVES):
2214 var15_waves(&f, weight); break;
2215 case (VAR_FISHEYE):
2216 var16_fisheye(&f, weight); break;
2217 case (VAR_POPCORN):
2218 var17_popcorn(&f, weight); break;
2219 case (VAR_EXPONENTIAL):
2220 var18_exponential(&f, weight); break;
2221 case (VAR_POWER):
2222 var19_power(&f, weight); break;
2223 case (VAR_COSINE):
2224 var20_cosine(&f, weight); break;
2225 case (VAR_RINGS):
2226 var21_rings(&f, weight); break;
2227 case (VAR_FAN):
2228 var22_fan(&f, weight); break;
2229 case (VAR_BLOB):
2230 var23_blob(&f, weight); break;
2231 case (VAR_PDJ):
2232 var24_pdj(&f, weight); break;
2233 case (VAR_FAN2):
2234 var25_fan2(&f, weight); break;
2235 case (VAR_RINGS2):
2236 var26_rings2(&f, weight); break;
2237 case (VAR_EYEFISH):
2238 var27_eyefish(&f, weight); break;
2239 case (VAR_BUBBLE):
2240 var28_bubble(&f, weight); break;
2241 case (VAR_CYLINDER):
2242 var29_cylinder(&f, weight); break;
2243 case (VAR_PERSPECTIVE):
2244 var30_perspective(&f, weight); break;
2245 case (VAR_NOISE):
2246 var31_noise(&f, weight); break;
2247 case (VAR_JULIAN):
2248 var32_juliaN_generic(&f, weight); break;
2249 case (VAR_JULIASCOPE):
2250 var33_juliaScope_generic(&f, weight);break;
2251 case (VAR_BLUR):
2252 var34_blur(&f, weight); break;
2253 case (VAR_GAUSSIAN_BLUR):
2254 var35_gaussian(&f, weight); break;
2255 case (VAR_RADIAL_BLUR):
2256 var36_radial_blur(&f, weight); break;
2257 case (VAR_PIE):
2258 var37_pie(&f, weight); break;
2259 case (VAR_NGON):
2260 var38_ngon(&f, weight); break;
2261 case (VAR_CURL):
2262 var39_curl(&f, weight); break;
2263 case (VAR_RECTANGLES):
2264 var40_rectangles(&f, weight); break;
2265 case (VAR_ARCH):
2266 var41_arch(&f, weight); break;
2267 case (VAR_TANGENT):
2268 var42_tangent(&f, weight); break;
2269 case (VAR_SQUARE):
2270 var43_square(&f, weight); break;
2271 case (VAR_RAYS):
2272 var44_rays(&f, weight); break;
2273 case (VAR_BLADE):
2274 var45_blade(&f, weight); break;
2275 case (VAR_SECANT2):
2276 var46_secant2(&f, weight); break;
2277 case (VAR_TWINTRIAN):
2278 var47_twintrian(&f, weight); break;
2279 case (VAR_CROSS):
2280 var48_cross(&f, weight); break;
2281 case (VAR_DISC2):
2282 var49_disc2(&f, weight); break;
2283 case (VAR_SUPER_SHAPE):
2284 var50_supershape(&f, weight); break;
2285 case (VAR_FLOWER):
2286 var51_flower(&f, weight); break;
2287 case (VAR_CONIC):
2288 var52_conic(&f, weight); break;
2289 case (VAR_PARABOLA):
2290 var53_parabola(&f, weight); break;
2291 case (VAR_BENT2):
2292 var54_bent2(&f, weight); break;
2293 case (VAR_BIPOLAR):
2294 var55_bipolar(&f, weight); break;
2295 case (VAR_BOARDERS):
2296 var56_boarders(&f, weight); break;
2297 case (VAR_BUTTERFLY):
2298 var57_butterfly(&f, weight); break;
2299 case (VAR_CELL):
2300 var58_cell(&f, weight); break;
2301 case (VAR_CPOW):
2302 var59_cpow(&f, weight); break;
2303 case (VAR_CURVE):
2304 var60_curve(&f, weight); break;
2305 case (VAR_EDISC):
2306 var61_edisc(&f, weight); break;
2307 case (VAR_ELLIPTIC):
2308 var62_elliptic(&f, weight); break;
2309 case (VAR_ESCHER):
2310 var63_escher(&f, weight); break;
2311 case (VAR_FOCI):
2312 var64_foci(&f, weight); break;
2313 case (VAR_LAZYSUSAN):
2314 var65_lazysusan(&f, weight); break;
2315 case (VAR_LOONIE):
2316 var66_loonie(&f, weight); break;
2317 case (VAR_MODULUS):
2318 var68_modulus(&f, weight); break;
2319 case (VAR_OSCILLOSCOPE):
2320 var69_oscope(&f, weight); break;
2321 case (VAR_POLAR2):
2322 var70_polar2(&f, weight); break;
2323 case (VAR_POPCORN2):
2324 var71_popcorn2(&f, weight); break;
2325 case (VAR_SCRY):
2326 var72_scry(&f, weight); break;
2327 case (VAR_SEPARATION):
2328 var73_separation(&f, weight); break;
2329 case (VAR_SPLIT):
2330 var74_split(&f, weight); break;
2331 case (VAR_SPLITS):
2332 var75_splits(&f, weight); break;
2333 case (VAR_STRIPES):
2334 var76_stripes(&f, weight); break;
2335 case (VAR_WEDGE):
2336 var77_wedge(&f, weight); break;
2337 case (VAR_WEDGE_JULIA):
2338 var78_wedge_julia(&f, weight); break;
2339 case (VAR_WEDGE_SPH):
2340 var79_wedge_sph(&f, weight); break;
2341 case (VAR_WHORL):
2342 var80_whorl(&f, weight); break;
2343 case (VAR_WAVES2):
2344 var81_waves2(&f, weight); break;
2345 case (VAR_EXP):
2346 var82_exp(&f, weight); break;
2347 case (VAR_LOG):
2348 var83_log(&f, weight); break;
2349 case (VAR_SIN):
2350 var84_sin(&f, weight); break;
2351 case (VAR_COS):
2352 var85_cos(&f, weight); break;
2353 case (VAR_TAN):
2354 var86_tan(&f, weight); break;
2355 case (VAR_SEC):
2356 var87_sec(&f, weight); break;
2357 case (VAR_CSC):
2358 var88_csc(&f, weight); break;
2359 case (VAR_COT):
2360 var89_cot(&f, weight); break;
2361 case (VAR_SINH):
2362 var90_sinh(&f, weight); break;
2363 case (VAR_COSH):
2364 var91_cosh(&f, weight); break;
2365 case (VAR_TANH):
2366 var92_tanh(&f, weight); break;
2367 case (VAR_SECH):
2368 var93_sech(&f, weight); break;
2369 case (VAR_CSCH):
2370 var94_csch(&f, weight); break;
2371 case (VAR_COTH):
2372 var95_coth(&f, weight); break;
2373 case (VAR_AUGER):
2374 var96_auger(&f, weight); break;
2375 case (VAR_FLUX):
2376 var97_flux(&f, weight); break;
2377 case (VAR_MOBIUS):
2378 var98_mobius(&f, weight); break;
2379 }
2380
2381 }
2382 /* apply the post transform */
2383 if (cp->xform[fn].has_post) {
2384 q[0] = cp->xform[fn].post[0][0] * f.p0 + cp->xform[fn].post[1][0] * f.p1 + cp->xform[fn].post[2][0];
2385 q[1] = cp->xform[fn].post[0][1] * f.p0 + cp->xform[fn].post[1][1] * f.p1 + cp->xform[fn].post[2][1];
2386 } else {
2387 q[0] = f.p0;
2388 q[1] = f.p1;
2389 }
2390
2391 /* Check for badvalues and return randoms if bad */
2392 if (badvalue(q[0]) || badvalue(q[1])) {
2393 q[0] = flam3_random_isaac_11(rc);
2394 q[1] = flam3_random_isaac_11(rc);
2395 return(1);
2396 } else
2397 return(0);
2398
2399 }
2400
initialize_xforms(flam3_genome * thiscp,int start_here)2401 void initialize_xforms(flam3_genome *thiscp, int start_here) {
2402
2403 int i,j;
2404 for (i = start_here ; i < thiscp->num_xforms ; i++) {
2405 thiscp->xform[i].padding = 0;
2406 thiscp->xform[i].density = 0.0;
2407 thiscp->xform[i].color_speed = 0.5;
2408 thiscp->xform[i].animate = 1.0;
2409 thiscp->xform[i].color = i&1;
2410 thiscp->xform[i].opacity = 1.0;
2411 thiscp->xform[i].var[0] = 1.0;
2412 thiscp->xform[i].motion_freq = 0;
2413 thiscp->xform[i].motion_func = 0;
2414 thiscp->xform[i].num_motion = 0;
2415 thiscp->xform[i].motion = NULL;
2416 for (j = 1; j < flam3_nvariations; j++)
2417 thiscp->xform[i].var[j] = 0.0;
2418 thiscp->xform[i].c[0][0] = 1.0;
2419 thiscp->xform[i].c[0][1] = 0.0;
2420 thiscp->xform[i].c[1][0] = 0.0;
2421 thiscp->xform[i].c[1][1] = 1.0;
2422 thiscp->xform[i].c[2][0] = 0.0;
2423 thiscp->xform[i].c[2][1] = 0.0;
2424 thiscp->xform[i].post[0][0] = 1.0;
2425 thiscp->xform[i].post[0][1] = 0.0;
2426 thiscp->xform[i].post[1][0] = 0.0;
2427 thiscp->xform[i].post[1][1] = 1.0;
2428 thiscp->xform[i].post[2][0] = 0.0;
2429 thiscp->xform[i].post[2][1] = 0.0;
2430 thiscp->xform[i].wind[0] = 0.0;
2431 thiscp->xform[i].wind[1] = 0.0;
2432 thiscp->xform[i].blob_low = 0.0;
2433 thiscp->xform[i].blob_high = 1.0;
2434 thiscp->xform[i].blob_waves = 1.0;
2435 thiscp->xform[i].pdj_a = 0.0;
2436 thiscp->xform[i].pdj_b = 0.0;
2437 thiscp->xform[i].pdj_c = 0.0;
2438 thiscp->xform[i].pdj_d = 0.0;
2439 thiscp->xform[i].fan2_x = 0.0;
2440 thiscp->xform[i].fan2_y = 0.0;
2441 thiscp->xform[i].rings2_val = 0.0;
2442 thiscp->xform[i].perspective_angle = 0.0;
2443 thiscp->xform[i].perspective_dist = 0.0;
2444 thiscp->xform[i].persp_vsin = 0.0;
2445 thiscp->xform[i].persp_vfcos = 0.0;
2446 thiscp->xform[i].radial_blur_angle = 0.0;
2447 thiscp->xform[i].disc2_rot = 0.0;
2448 thiscp->xform[i].disc2_twist = 0.0;
2449 thiscp->xform[i].disc2_sinadd = 0.0;
2450 thiscp->xform[i].disc2_cosadd = 0.0;
2451 thiscp->xform[i].disc2_timespi = 0.0;
2452 thiscp->xform[i].flower_petals = 0.0;
2453 thiscp->xform[i].flower_holes = 0.0;
2454 thiscp->xform[i].parabola_height = 0.0;
2455 thiscp->xform[i].parabola_width = 0.0;
2456 thiscp->xform[i].bent2_x = 1.0;
2457 thiscp->xform[i].bent2_y = 1.0;
2458 thiscp->xform[i].bipolar_shift = 0.0;
2459 thiscp->xform[i].cell_size = 1.0;
2460 thiscp->xform[i].cpow_r = 1.0;
2461 thiscp->xform[i].cpow_i = 0.0;
2462 thiscp->xform[i].cpow_power = 1.0;
2463 thiscp->xform[i].curve_xamp = 0.0;
2464 thiscp->xform[i].curve_yamp = 0.0;
2465 thiscp->xform[i].curve_xlength = 1.0;
2466 thiscp->xform[i].curve_ylength = 1.0;
2467 thiscp->xform[i].escher_beta = 0.0;
2468 thiscp->xform[i].lazysusan_space = 0.0;
2469 thiscp->xform[i].lazysusan_twist = 0.0;
2470 thiscp->xform[i].lazysusan_spin = 0.0;
2471 thiscp->xform[i].lazysusan_x = 0.0;
2472 thiscp->xform[i].lazysusan_y = 0.0;
2473 thiscp->xform[i].modulus_x = 0.0;
2474 thiscp->xform[i].modulus_y = 0.0;
2475 thiscp->xform[i].oscope_separation = 1.0;
2476 thiscp->xform[i].oscope_frequency = M_PI;
2477 thiscp->xform[i].oscope_amplitude = 1.0;
2478 thiscp->xform[i].oscope_damping = 0.0;
2479 thiscp->xform[i].popcorn2_c = 0.0;
2480 thiscp->xform[i].popcorn2_x = 0.0;
2481 thiscp->xform[i].popcorn2_y = 0.0;
2482 thiscp->xform[i].separation_x = 0.0;
2483 thiscp->xform[i].separation_xinside = 0.0;
2484 thiscp->xform[i].separation_y = 0.0;
2485 thiscp->xform[i].separation_yinside = 0.0;
2486 thiscp->xform[i].split_xsize = 0.0;
2487 thiscp->xform[i].split_ysize = 0.0;
2488 thiscp->xform[i].splits_x = 0.0;
2489 thiscp->xform[i].splits_y = 0.0;
2490 thiscp->xform[i].stripes_space = 0.0;
2491 thiscp->xform[i].stripes_warp = 0.0;
2492 thiscp->xform[i].wedge_angle = 0.0;
2493 thiscp->xform[i].wedge_hole = 0.0;
2494 thiscp->xform[i].wedge_count = 1.0;
2495 thiscp->xform[i].wedge_swirl = 0.0;
2496 thiscp->xform[i].wedge_sph_angle = 0.0;
2497 thiscp->xform[i].wedge_sph_hole = 0.0;
2498 thiscp->xform[i].wedge_sph_count = 1.0;
2499 thiscp->xform[i].wedge_sph_swirl = 0.0;
2500
2501 thiscp->xform[i].wedge_julia_power = 1.0;
2502 thiscp->xform[i].wedge_julia_dist = 0.0;
2503 thiscp->xform[i].wedge_julia_count = 1.0;
2504 thiscp->xform[i].wedge_julia_angle = 0.0;
2505 thiscp->xform[i].wedgeJulia_cf = 0.0;
2506 thiscp->xform[i].wedgeJulia_cn = 0.5;
2507 thiscp->xform[i].wedgeJulia_rN = 1.0;
2508 thiscp->xform[i].whorl_inside = 0.0;
2509 thiscp->xform[i].whorl_outside = 0.0;
2510
2511 thiscp->xform[i].waves2_scalex = 0.0;
2512 thiscp->xform[i].waves2_scaley = 0.0;
2513 thiscp->xform[i].waves2_freqx = 0.0;
2514 thiscp->xform[i].waves2_freqy = 0.0;
2515
2516 thiscp->xform[i].auger_freq = 1.0;
2517 thiscp->xform[i].auger_weight = 0.5;
2518 thiscp->xform[i].auger_sym = 0.0;
2519 thiscp->xform[i].auger_scale = 1.0;
2520
2521 thiscp->xform[i].flux_spread = 0.0;
2522
2523 thiscp->xform[i].julian_power = 1.0;
2524 thiscp->xform[i].julian_dist = 1.0;
2525 thiscp->xform[i].julian_rN = 1.0;
2526 thiscp->xform[i].julian_cn = 0.5;
2527 thiscp->xform[i].juliascope_power = 1.0;
2528 thiscp->xform[i].juliascope_dist = 1.0;
2529 thiscp->xform[i].juliascope_rN = 1.0;
2530 thiscp->xform[i].juliascope_cn = 0.5;
2531 thiscp->xform[i].radialBlur_spinvar = 0.0;
2532 thiscp->xform[i].radialBlur_zoomvar = 1.0;
2533 thiscp->xform[i].pie_slices = 6.0;
2534 thiscp->xform[i].pie_rotation = 0.0;
2535 thiscp->xform[i].pie_thickness = 0.5;
2536 thiscp->xform[i].ngon_sides = 5;
2537 thiscp->xform[i].ngon_power = 3;
2538 thiscp->xform[i].ngon_circle = 1;
2539 thiscp->xform[i].ngon_corners = 2;
2540 thiscp->xform[i].curl_c1 = 1.0;
2541 thiscp->xform[i].curl_c2 = 0.0;
2542 thiscp->xform[i].rectangles_x = 1.0;
2543 thiscp->xform[i].rectangles_y = 1.0;
2544 thiscp->xform[i].amw_amp = 1.0;
2545 thiscp->xform[i].super_shape_rnd = 0.0;
2546 thiscp->xform[i].super_shape_m = 0.0;
2547 thiscp->xform[i].super_shape_n1 = 1.0;
2548 thiscp->xform[i].super_shape_n2 = 1.0;
2549 thiscp->xform[i].super_shape_n3 = 1.0;
2550 thiscp->xform[i].super_shape_holes = 0.0;
2551 thiscp->xform[i].conic_eccentricity = 1.0;
2552 thiscp->xform[i].conic_holes = 0.0;
2553
2554 thiscp->xform[i].mobius_re_a = 0.0;
2555 thiscp->xform[i].mobius_re_b = 0.0;
2556 thiscp->xform[i].mobius_re_c = 0.0;
2557 thiscp->xform[i].mobius_re_d = 0.0;
2558 thiscp->xform[i].mobius_im_a = 0.0;
2559 thiscp->xform[i].mobius_im_b = 0.0;
2560 thiscp->xform[i].mobius_im_c = 0.0;
2561 thiscp->xform[i].mobius_im_d = 0.0;
2562 }
2563 }
2564