From 9e74ff57ce985ed3050488ab71ef7fcc22fe5251 Mon Sep 17 00:00:00 2001 From: Steven Robertson Date: Thu, 16 Jun 2011 13:42:17 -0400 Subject: [PATCH] Fix julia variation. Closes issue 10. --- cuburn/code/variations.py | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/cuburn/code/variations.py b/cuburn/code/variations.py index 3bdac8d..da44634 100644 --- a/cuburn/code/variations.py +++ b/cuburn/code/variations.py @@ -102,15 +102,11 @@ var(12, 'ex', """ """) var(13, 'julia', """ - float power = 2.0f; - float t_rnd = truncf(mwc_next_01(rctx) * fabsf(power)); - float a = atan2f(tx, ty); - float tmpr = (a + 2.0f * M_PI * t_rnd) / power; - float cn = 0.5f; - float r = w * powf(tx * tx + ty * ty, cn); - - ox += r * cosf(tmpr); - oy += r * sinf(tmpr); + float a = 0.5f * atan2f(tx, ty); + if (mwc_next(rctx) & 1) a += M_PI; + float r = w * sqrtf(sqrtf(tx*tx + ty*ty)); // TODO: fastest? + ox += r * cosf(a); + oy += r * sinf(a); """) var(14, 'bent', """