From bb63d86a8c3e7db0f48b2b7cd169d118dd943f62 Mon Sep 17 00:00:00 2001 From: Alain Zscheile Date: Fri, 8 Dec 2023 00:29:32 +0100 Subject: [PATCH] spiral: use cosine for dyanmic scale --- src/ex.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/ex.rs b/src/ex.rs index 84506f9..7605438 100644 --- a/src/ex.rs +++ b/src/ex.rs @@ -143,9 +143,8 @@ pub fn cassini_astroid(ca: f64, cc: f64, aa: f64) -> impl Fn(f64) -> [f64; 2] { pub fn spiral(k: u32) -> impl Fn(f64) -> [f64; 2] { let x2pi = (k as f64) * core::f64::consts::TAU; move |t: f64| { - let tstretch = t - 0.5; - let tstretch = tstretch * tstretch; + let ttcos = (t * core::f64::consts::TAU).cos(); let (ttxsin, ttxcos) = (t * x2pi).sin_cos(); - [tstretch * ttxcos, tstretch * ttxsin] + [ttcos * ttxcos, ttcos * ttxsin] } }