diff options
-rw-r--r-- | chickadee/math.scm | 7 | ||||
-rw-r--r-- | doc/api.texi | 15 |
2 files changed, 21 insertions, 1 deletions
diff --git a/chickadee/math.scm b/chickadee/math.scm index 3bcda52..adb7d8b 100644 --- a/chickadee/math.scm +++ b/chickadee/math.scm @@ -16,12 +16,17 @@ ;;; <http://www.gnu.org/licenses/>. (define-module (chickadee math) - #:export (square + #:export (pi + pi/2 + square clamp min max) #:replace (min max)) +(define pi 3.14159265358979323846) +(define pi/2 (/ pi 2.0)) + (define-inlinable (square x) (* x x)) diff --git a/doc/api.texi b/doc/api.texi index 9c568d5..e1f6acc 100644 --- a/doc/api.texi +++ b/doc/api.texi @@ -406,11 +406,26 @@ with vectors and matrices and axis-aligned bounding box collision detection. @menu +* Basics:: Commonly used, miscellaneous things. * Vectors:: Euclidean vectors. * Matrices:: Transformation matrices. * Rectangles:: Axis-aligned bounding boxes. @end menu +@node Basics +@subsection Basics + +@defvar {Scheme Variable} pi +An essential constant for all trigonometry. @code{@U{03C0}} is the ratio +of a circle's circumferences to its diameter. Since @code{@U{03C0}} is an +irrational number, the @var{pi} in Chickadee is a mere floating point +approximation that is ``good enough.'' +@end defvar + +@defvar {Scheme Variable} pi/2 +Half of @var{pi}. +@end defvar + @node Vectors @subsection Vectors |