From 16b94f925733a5e6107eb314429d2f834e59eeff Mon Sep 17 00:00:00 2001 From: Erik Reckase Date: Sat, 23 Jul 2011 11:03:46 +0000 Subject: was incorrectly adding symmetry xforms when a final xform was present, as well as a bug in handling final xforms in genetic crosses. thanks david bitseff git-svn-id: https://flam3.googlecode.com/svn/trunk@161 77852712-ef1d-11de-8684-7d64432d61a3 --- src/flam3.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/flam3.c b/src/flam3.c index e9fe6fd..6a02335 100644 --- a/src/flam3.c +++ b/src/flam3.c @@ -2567,6 +2567,9 @@ void flam3_add_symmetry(flam3_genome *cp, int sym) { if (sym < 0) { i = cp->num_xforms; + if (cp->final_xform_enable) + i -= 1; + flam3_add_xforms(cp,1,0,0); cp->xform[i].density = 1.0; @@ -2592,6 +2595,9 @@ void flam3_add_symmetry(flam3_genome *cp, int sym) { for (k = 1; k < sym; k++) { i = cp->num_xforms; + if (cp->final_xform_enable) + i -= 1; + flam3_add_xforms(cp, 1, 0,0); cp->xform[i].density = 1.0; @@ -2662,8 +2668,13 @@ void flam3_cross(flam3_genome *cp0, flam3_genome *cp1, flam3_genome *out, int cr /* Default behavior keeps the final from parent0. */ if (cp1->final_xform_index == j) continue; + + i = out->num_xforms; + if (out->final_xform_enable) + i -= 1; + flam3_add_xforms(out, 1, 0, 0); - flam3_copy_xform(&out->xform[out->num_xforms-1],&cp1->xform[j]); + flam3_copy_xform(&out->xform[i],&cp1->xform[j]); } /* Put the final xform last (if there is one) */ -- cgit v1.2.3