From 1f1deea662da4328bf588c0642c8a90c7b1f2144 Mon Sep 17 00:00:00 2001 From: David Thompson Date: Tue, 24 Sep 2013 21:06:41 -0400 Subject: Rough draft of manual. --- doc/math/rect.texi | 90 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 doc/math/rect.texi (limited to 'doc/math/rect.texi') 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 -- cgit v1.2.3