From 279f17ac0e1b3d019c2b294098e834d249376686 Mon Sep 17 00:00:00 2001 From: David Thompson Date: Tue, 4 Jun 2019 20:49:16 -0400 Subject: Update chickadee manual. --- manuals/chickadee/Rectangles.html | 83 ++++++++++++++++++++------------------- 1 file changed, 43 insertions(+), 40 deletions(-) (limited to 'manuals/chickadee/Rectangles.html') diff --git a/manuals/chickadee/Rectangles.html b/manuals/chickadee/Rectangles.html index edaf4e6..ecfbde0 100644 --- a/manuals/chickadee/Rectangles.html +++ b/manuals/chickadee/Rectangles.html @@ -1,6 +1,6 @@ - @@ -108,220 +110,221 @@ functions that do in-place modification of rectangles for use in performance critical code paths.

+
Procedure: rect x y width height
Procedure: make-rect x y width height

Create a new rectangle that is width by height in size and whose bottom-left corner is located at (x, y).

-
Procedure: rect? obj
+
Procedure: rect? obj

Return #t if obj is a rectangle.

-
Procedure: rect-within? rect1 rect2
+
Procedure: rect-within? rect1 rect2

Return #t if rect2 is completely within rect1.

-
Procedure: rect-intersects? rect1 rect2
+
Procedure: rect-intersects? rect1 rect2

Return #t if rect2 overlaps rect1.

-
Procedure: rect-contains? rect x y
+
Procedure: rect-contains? rect x y

Return #t if the coordinates (x, y) are within rect.

-
Procedure: rect-contains-vec2? rect v
+
Procedure: rect-contains-vec2? rect v

Return #t if the 2D vector v is within the bounds of rect.

-
Procedure: rect-x rect
+
Procedure: rect-x rect

Return the X coordinate of the lower-left corner of rect.

-
Procedure: rect-y rect
+
Procedure: rect-y rect

Return the Y coordinate of the lower-left corner of rect.

-
Procedure: rect-left rect
+
Procedure: rect-left rect

Return the left-most X coordinate of rect.

-
Procedure: rect-right rect
+
Procedure: rect-right rect

Return the right-most X coordinate of rect.

-
Procedure: rect-bottom rect
+
Procedure: rect-bottom rect

Return the bottom-most Y coordinate of rect.

-
Procedure: rect-top rect
+
Procedure: rect-top rect

Return the top-most Y coordinate of rect.

-
Procedure: rect-center-x rect
+
Procedure: rect-center-x rect

Return the X coordinate of the center of rect.

-
Procedure: rect-center-y rect
+
Procedure: rect-center-y rect

Return the Y coordinate of the center of rect.

-
Procedure: rect-width rect
+
Procedure: rect-width rect

Return the width of rect.

-
Procedure: rect-height rect
+
Procedure: rect-height rect

Return the height of rect.

-
Procedure: rect-area rect
+
Procedure: rect-area rect

Return the surface area covered by rect.

-
Procedure: rect-clamp-x rect x
+
Procedure: rect-clamp-x rect x

Restrict x to the portion of the X axis covered by rect.

-
Procedure: rect-clamp-y rect y
+
Procedure: rect-clamp-y rect y

Restrict y to the portion of the Y axis covered by rect.

-
Procedure: rect-clamp rect1 rect2
+
Procedure: rect-clamp rect1 rect2

Return a new rect that adjusts the location of rect1 so that it is completely within rect2. An exception is thrown in the case that rect1 cannot fit completely within rect2.

-
Procedure: rect-move rect x y
+
Procedure: rect-move rect x y

Return a new rectangle based on rect but moved to the coordinates (x, y).

-
Procedure: rect-move-vec2 rect v
+
Procedure: rect-move-vec2 rect v

Return a new rectangle based on rect but moved to the coordinates in the 2D vector v.

-
Procedure: rect-move-by rect x y
+
Procedure: rect-move-by rect x y

Return a new rectangle based on rect but moved by (x, y) units relative to its current location.

-
Procedure: rect-move-by-vec2 rect v
+
Procedure: rect-move-by-vec2 rect v

Return a new rectangle based on rect but moved by the 2D vector v relative to its current location.

-
Procedure: rect-inflate rect width height
+
Procedure: rect-inflate rect width height

Return a new rectangle based on rect, but expanded by width units on the X axis and height units on the Y axis, while keeping the rectangle centered on the same point.

-
Procedure: rect-union rect1 rect2
+
Procedure: rect-union rect1 rect2

Return a new rectangle that completely covers the area of rect1 and rect2.

-
Procedure: rect-clip rect1 rect2
+
Procedure: rect-clip rect1 rect2

Return a new rectangle that is the overlapping region of rect1 and rect2. If the two rectangles do not overlap, a rectangle of 0 width and 0 height is returned.

-
Procedure: set-rect-x! rect x
+
Procedure: set-rect-x! rect x

Set the left X coordinate of rect to x.

-
Procedure: set-rect-y! rect y
+
Procedure: set-rect-y! rect y

Set the bottom Y coordinate of rect to y.

-
Procedure: set-rect-width! rect width
+
Procedure: set-rect-width! rect width

Set the width of rect to width.

-
Procedure: set-rect-height! rect height
+
Procedure: set-rect-height! rect height

Set the height of rect to height.

-
Procedure: rect-move! rect x y
+
Procedure: rect-move! rect x y

Move rect to (x, y) in-place.

-
Procedure: rect-move-vec2! rect v
+
Procedure: rect-move-vec2! rect v

Move rect to the 2D vector v in-place.

-
Procedure: rect-move-by! rect x y
+
Procedure: rect-move-by! rect x y

Move rect by (x, y) in-place.

-
Procedure: rect-move-by-vec2! rect v
+
Procedure: rect-move-by-vec2! rect v

Move rect by the 2D vector v in-place.

-
Procedure: rect-inflate! rect width height
+
Procedure: rect-inflate! rect width height

Expand rect by width and height in-place.

-
Procedure: rect-union! rect1 rect2
+
Procedure: rect-union! rect1 rect2

Modify rect1 in-place to completely cover the area of both rect1 and rect2.

-
Procedure: rect-clip! rect1 rect2
+
Procedure: rect-clip! rect1 rect2

Modify rect1 in-place to be the overlapping region of rect1 and rect2.

-
Procedure: rect-clamp! rect1 rect2
+
Procedure: rect-clamp! rect1 rect2

Adjust the location of rect1 in-place so that its bounds are completely within rect2. An exception is thrown in the case that rect1 cannot fit completely within rect2.

-
Procedure: vec2-clamp-to-rect! v rect
+
Procedure: vec2-clamp-to-rect! v rect

Restrict the coordinates of the 2D vector v so that they are within the bounds of rect. v is modified in-place.

-- cgit v1.2.3