From 08b9aeecc8b338ebcbc577e2aca304c5cac88baa Mon Sep 17 00:00:00 2001 From: David Thompson Date: Sun, 15 Sep 2013 22:52:54 -0400 Subject: Clean up docstrings for vector2 module. --- 2d/vector2.scm | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to '2d') diff --git a/2d/vector2.scm b/2d/vector2.scm index d231f93..3993fb6 100644 --- a/2d/vector2.scm +++ b/2d/vector2.scm @@ -53,12 +53,12 @@ (define identity-vector2 (vector2 1 1)) (define (vector2-polar r theta) - "Converts polar coordinates into a cartesian vector." + "Convert the polar coordinates (R, THETA) into a cartesian vector." (vector2 (* r (cos theta)) (* r (sin theta)))) (define (v+ . vectors) - "Adds vectors." + "Return the sum of all VECTORS." (define (add-vectors x y vectors) (cond ((null? vectors) (vector2 x y)) @@ -69,7 +69,7 @@ (add-vectors 0 0 vectors)) (define (v* . vectors) - "Multiplies vectors." + "Return the product of all VECTORS." (define (multiply-vectors x y vectors) (cond ((null? vectors) (vector2 x y)) @@ -80,17 +80,17 @@ (multiply-vectors 1 1 vectors)) (define (vscale v scalar) - "Multiply vector by a scalar." + "Multiply the vector V by a scalar value." (vector2 (* (vx v) scalar) (* (vy v) scalar))) (define (vmag v) - "Returns the magnitude of a vector" + "Return the magnitude of the vector V." (sqrt (+ (expt (vx v) 2) (expt (vy v) 2)))) (define (vnorm v) - "Normalizes a vector." + "Normalize the vector V." (let ((m (vmag v))) (if (zero? m) null-vector2 @@ -98,22 +98,22 @@ (/ (vy v) m))))) (define (vdot v1 v2) - "Returns the dot product of two vectors." + "Return the dot product of the vectors V1 and V2." (+ (* (vx v1) (vx v2)) (* (vy v1) (vy v2)))) (define (vcross v1 v2) - "Returns the cross product of two vectors. The cross product of a 2D -vector is not defined. This function instead returns the Z coordinate -of the cross product as if the vectors were in 3D space." + "Return the cross product of the vectors V1 and V2. Technically, the +cross product of a 2D vector is not defined. This function instead +returns the Z coordinate of the cross product as if the vectors were +in 3D space." (- (* (vx v1) (vy v2)) (* (vy v1) (vx v2)))) (define (vector2-translate v) - "Perform an OpenGL translate matrix operation with the given -vector2." + "Perform an OpenGL translate operation with the vector V." (gl-translate (vx v) (vy v) 0)) (define (vector2-scale v) - "Perform an OpenGL scale matrix operation with the given vector2." + "Perform an OpenGL scale operation with the vector V." (gl-scale (vx v) (vy v) 1)) -- cgit v1.2.3