diff options
author | David Thompson <dthompson2@worcester.edu> | 2021-08-12 07:31:36 -0400 |
---|---|---|
committer | David Thompson <dthompson2@worcester.edu> | 2021-08-12 07:31:36 -0400 |
commit | 692eb45def187e2f2dbe7e40eacf27b2058c88bd (patch) | |
tree | f63749ccb9a43c2644a04a6bdab7137646e47b2e | |
parent | b7350d996b5ef4942caf1e475bbd3a9d4c7bf5a9 (diff) |
math: Rename 2pi to tau.
-rw-r--r-- | chickadee/graphics/path.scm | 10 | ||||
-rw-r--r-- | chickadee/math.scm | 4 | ||||
-rw-r--r-- | doc/api.texi | 2 |
3 files changed, 8 insertions, 8 deletions
diff --git a/chickadee/graphics/path.scm b/chickadee/graphics/path.scm index 0d218fb..fb75efd 100644 --- a/chickadee/graphics/path.scm +++ b/chickadee/graphics/path.scm @@ -118,8 +118,8 @@ ;; Curves" by Joe Cridge: ;; https://web.archive.org/web/20170829122313/https://www.joecridge.me/content/pdf/bezier-arcs.pdf (define (adjust-angle angle) - ;; Clamp within [0, 2pi] range. - (let* ((clamped (mod angle 2pi)) + ;; Clamp within [0, tau] range. + (let* ((clamped (mod angle tau)) (adjusted (atan (* (/ rx ry) (tan clamped))))) ;; Adjust angles to counter linear scaling. (cond @@ -129,11 +129,11 @@ (<= clamped (* pi 1.5))) (+ adjusted pi)) (else - (+ adjusted 2pi))))) + (+ adjusted tau))))) (let* ((angle-start (adjust-angle angle-start)) (angle-end* (adjust-angle angle-end)) (angle-end (if (> angle-start angle-end*) - (+ angle-end* 2pi) + (+ angle-end* tau) angle-end*)) ;; Don't bother making a curve for an angle smaller than ;; this. @@ -416,7 +416,7 @@ (close-path)))) (define (regular-polygon center num-sides radius) - (let ((theta-step (/ 2pi num-sides))) + (let ((theta-step (/ tau num-sides))) (apply path (let loop ((i 0)) (cond diff --git a/chickadee/math.scm b/chickadee/math.scm index c61b862..9286fe4 100644 --- a/chickadee/math.scm +++ b/chickadee/math.scm @@ -18,7 +18,7 @@ (define-module (chickadee math) #:export (pi pi/2 - 2pi + tau cotan clamp min @@ -30,7 +30,7 @@ (define pi 3.14159265358979323846) (define pi/2 (/ pi 2.0)) -(define 2pi (* pi 2.0)) +(define tau 6.283185307179586) ;; AKA 2pi (define-inlinable (cotan z) "Return the cotangent of Z." diff --git a/doc/api.texi b/doc/api.texi index 96ac394..68cffef 100644 --- a/doc/api.texi +++ b/doc/api.texi @@ -581,7 +581,7 @@ approximation that is ``good enough.'' Half of @var{pi}. @end defvar -@defvar 2pi +@defvar tau Twice @var{pi}. @end defvar |