diff options
author | David Thompson <dthompson@member.fsf.org> | 2013-09-24 21:06:41 -0400 |
---|---|---|
committer | David Thompson <dthompson@member.fsf.org> | 2013-09-24 21:06:41 -0400 |
commit | 1f1deea662da4328bf588c0642c8a90c7b1f2144 (patch) | |
tree | a7973b46b580ca2a9e8fb65f459e0004ae87b64f /doc/math | |
parent | 7937b85219607a6e7755907e0752343344ed036c (diff) |
Rough draft of manual.
Diffstat (limited to 'doc/math')
-rw-r--r-- | doc/math/math.texi | 37 | ||||
-rw-r--r-- | doc/math/rect.texi | 90 | ||||
-rw-r--r-- | doc/math/vector2.texi | 76 |
3 files changed, 203 insertions, 0 deletions
diff --git a/doc/math/math.texi b/doc/math/math.texi new file mode 100644 index 0000000..12330f9 --- /dev/null +++ b/doc/math/math.texi @@ -0,0 +1,37 @@ +@node Miscellaneous +@section Miscellaneous + +Miscellaneous math procedures. + +@anchor{2d math pi}@defvar pi +@end defvar + +@anchor{2d math degrees->radians}@defun degrees->radians angle +Convert ANGLE in degrees to radians. + +@end defun + +@anchor{2d math radians->degrees}@defun radians->degrees angle +Convert ANGLE in radians to degrees. + +@end defun + +@anchor{2d math sin-degrees}@defun sin-degrees angle +Compute the sin of ANGLE expressed in degrees. + +@end defun + +@anchor{2d math cos-degrees}@defun cos-degrees angle +Compute the cosine of ANGLE expressed in degrees. + +@end defun + +@anchor{2d math tan-degrees}@defun tan-degrees angle +Compute the tangent of ANGLE expressed in degrees. + +@end defun + +@anchor{2d math atan-degrees}@defun atan-degrees y x +Compute the arctangent in degrees of the coordinates Y and X. + +@end defun diff --git a/doc/math/rect.texi b/doc/math/rect.texi new file mode 100644 index 0000000..62477ea --- /dev/null +++ b/doc/math/rect.texi @@ -0,0 +1,90 @@ +@node Rectangles +@section Rectangles + +Rects are axis-aligned bounding boxes that can be used for performing +simple collision detection. + +@anchor{2d rect make-rect}@defspec make-rect +@end defspec + +@anchor{2d rect rect?}@defspec rect? +@end defspec + +@anchor{2d rect rect-x}@defspec rect-x +@end defspec + +@anchor{2d rect rect-y}@defspec rect-y +@end defspec + +@anchor{2d rect rect-x2}@defun rect-x2 rect +@end defun + +@anchor{2d rect rect-y2}@defun rect-y2 rect +@end defun + +@anchor{2d rect rect-center-x}@defun rect-center-x rect +@end defun + +@anchor{2d rect rect-center-y}@defun rect-center-y rect +@end defun + +@anchor{2d rect rect-half-width}@defun rect-half-width rect +@end defun + +@anchor{2d rect rect-half-height}@defun rect-half-height rect +@end defun + +@anchor{2d rect rect-width}@defspec rect-width +@end defspec + +@anchor{2d rect rect-height}@defspec rect-height +@end defspec + +@anchor{2d rect rect-position}@defun rect-position rect +Return the top-left corner of RECT as a vector2. + +@end defun + +@anchor{2d rect rect-size}@defun rect-size rect +Return the size of RECT as a vector2. + +@end defun + +@anchor{2d rect rect-move}@defun rect-move rect v +Create a new rectangle by moving RECT by the given offset. rect-move +accepts a vector2 or x and y coordinates as separate arguments. + +@end defun + +@anchor{2d rect rect-inflate}@defun rect-inflate rect v +Create a new rectangle by growing RECT by the given amount without +changing the center point. rect-inflate accepts a vector2 or x and y +coordinates as separate arguments. + +@end defun + +@anchor{2d rect rect-union}@defun rect-union rect1 rect2 +Return a rect that covers the area of RECT1 and RECT2. + +@end defun + +@anchor{2d rect rect-clip}@defun rect-clip rect1 rect2 +Return the overlapping region of RECT1 and RECT2. If the rects do not +overlap, a rect of size 0 is returned. + +@end defun + +@anchor{2d rect rect-within?}@defun rect-within? rect1 rect2 +Return #t if RECT2 is completely within RECT1. + +@end defun + +@anchor{2d rect rect-intersects?}@defun rect-intersects? rect1 rect2 +Return #t if RECT2 overlaps RECT1. + +@end defun + +@anchor{2d rect rect-contains?}@defun rect-contains? rect v +Return #t if the given point is within RECT. + +@end defun diff --git a/doc/math/vector2.texi b/doc/math/vector2.texi new file mode 100644 index 0000000..13c2f80 --- /dev/null +++ b/doc/math/vector2.texi @@ -0,0 +1,76 @@ +@node Vectors +@section Vectors + +2D vector math operations. Vector objects are of type vector2 to avoid +confusion with regular Scheme vectors. + +@anchor{2d vector2 vector2}@defspec vector2 +@end defspec + +@anchor{2d vector2 vector2?}@defspec vector2? +@end defspec + +@anchor{2d vector2 vx}@defspec vx +@end defspec + +@anchor{2d vector2 vy}@defspec vy +@end defspec + +@anchor{2d vector2 null-vector2}@defvar null-vector2 +@end defvar + +@anchor{2d vector2 identity-vector2}@defvar identity-vector2 +@end defvar + +@anchor{2d vector2 vector2-polar}@defun vector2-polar r theta +Convert the polar coordinates (R, THETA) into a cartesian vector. + +@end defun + +@anchor{2d vector2 v+}@defun v+ . vectors +Return the sum of all VECTORS. + +@end defun + +@anchor{2d vector2 v*}@defun v* . vectors +Return the product of all VECTORS. + +@end defun + +@anchor{2d vector2 vscale}@defun vscale v scalar +Multiply the vector V by a scalar value. + +@end defun + +@anchor{2d vector2 vmag}@defun vmag v +Return the magnitude of the vector V. + +@end defun + +@anchor{2d vector2 vnorm}@defun vnorm v +Normalize the vector V. + +@end defun + +@anchor{2d vector2 vdot}@defun vdot v1 v2 +Return the dot product of the vectors V1 and V2. + +@end defun + +@anchor{2d vector2 vcross}@defun vcross v1 v2 +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. + +@end defun + +@anchor{2d vector2 vector2-translate}@defun vector2-translate v +Perform an OpenGL translate operation with the vector V. + +@end defun + +@anchor{2d vector2 vector2-scale}@defun vector2-scale v +Perform an OpenGL scale operation with the vector V. + +@end defun |