summaryrefslogtreecommitdiff
path: root/src/variations.c
diff options
context:
space:
mode:
authorErik Reckase <e.reckase@gmail.com>2010-06-23 10:31:31 +0000
committerScott Draves <spot@draves.org>2015-02-15 12:20:12 -0500
commit933c9a4532637d1373f3299035f62e041c495d87 (patch)
tree69a2d9a3a9a10ce0d3a7c73d49579a6ce53529fc /src/variations.c
parentce1ef42a60b4cfdf5c00bf4eb90399090374e31e (diff)
downloadpucket-933c9a4532637d1373f3299035f62e041c495d87.tar.gz
pucket-933c9a4532637d1373f3299035f62e041c495d87.tar.bz2
pucket-933c9a4532637d1373f3299035f62e041c495d87.zip
Added flux variation.
git-svn-id: https://flam3.googlecode.com/svn/trunk@15 77852712-ef1d-11de-8684-7d64432d61a3
Diffstat (limited to 'src/variations.c')
-rw-r--r--src/variations.c26
1 files changed, 21 insertions, 5 deletions
diff --git a/src/variations.c b/src/variations.c
index e40c48f..4d26dd9 100644
--- a/src/variations.c
+++ b/src/variations.c
@@ -130,6 +130,7 @@ char *flam3_variation_names[1+flam3_nvariations] = {
"csch",
"coth",
"auger",
+ "flux",
0
};
@@ -1906,6 +1907,21 @@ void var96_auger (flam3_iter_helper *f, double weight) {
f->p1 += weight * dy;
}
+void var97_flux (flam3_iter_helper *f, double weight) {
+
+ // Flux, by meckie
+ double xpw = f->tx + weight;
+ double xmw = f->tx - weight;
+ double avgr = weight * (2 + f->xform->flux_spread) * sqrt( sqrt(f->ty*f->ty + xpw*xpw) / sqrt(f->ty*f->ty + xmw*xmw));
+ double avga = ( atan2(f->ty, xmw) - atan2(f->ty,xpw) ) * 0.5;
+
+ double s = sin(avga);
+ double c = cos(avga);
+
+ f->p0 += avgr * cos(avga);
+ f->p1 += avgr * sin(avga);
+}
+
/* Precalc functions */
void perspective_precalc(flam3_xform *xf) {
@@ -2104,13 +2120,9 @@ int apply_xform(flam3_genome *cp, int fn, double *p, double *q, randctx *rc)
f.rc = rc;
-// s = 1.0-2.0*cp->xform[fn].color_speed;
-// s1 = 0.5 - 0.5 * s;
s1 = cp->xform[fn].color_speed;
- s = 1.0 - 2.0*s1;
- next_color = (p[2] + cp->xform[fn].color) * s1 + s * p[2];
- q[2] = next_color;
+ q[2] = s1 * cp->xform[fn].color + (1.0-s1) * p[2];
q[3] = cp->xform[fn].vis_adjusted;
//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]);
@@ -2345,6 +2357,8 @@ int apply_xform(flam3_genome *cp, int fn, double *p, double *q, randctx *rc)
var95_coth(&f, weight); break;
case (VAR_AUGER):
var96_auger(&f, weight); break;
+ case (VAR_FLUX):
+ var97_flux(&f, weight); break;
}
}
@@ -2486,6 +2500,8 @@ void initialize_xforms(flam3_genome *thiscp, int start_here) {
thiscp->xform[i].auger_weight = 0.5;
thiscp->xform[i].auger_sym = 0.0;
thiscp->xform[i].auger_scale = 1.0;
+
+ thiscp->xform[i].flux_spread = 0.0;
thiscp->xform[i].julian_power = 1.0;
thiscp->xform[i].julian_dist = 1.0;