1 USING: help.markup help.syntax ;
6 { $class-description "A rectangle with the following slots:"
8 { { $link rect-loc } " - the top-left corner of the rectangle as an x/y pair" }
9 { { $link rect-dim } " - the dimensions of the rectangle as a width/height pair" }
11 "Rectangles are constructed by calling " { $link <rect> } " and " { $link <extent-rect> } "."
15 { $values { "loc" "a pair of integers" } { "dim" "a pair of integers" } { "rect" "a new " { $link rect } } }
16 { $description "Creates a new rectangle with the specified top-left location and dimensions." } ;
18 { <zero-rect> <rect> <extent-rect> } related-words
21 { $values { "rect" rect } { "loc" "a pair of integers" } { "dim" "a pair of integers" } }
22 { $description "Outputs the location and dimensions of a rectangle." } ;
24 { rect-bounds rect-extent } related-words
27 { $values { "loc" "a pair of integers" } { "ext" "a pair of integers" } { "rect" "a new " { $link rect } } }
28 { $description "Creates a new rectangle with the specified top-left and bottom-right corner locations." } ;
31 { $values { "rect" rect } { "loc" "a pair of integers" } { "ext" "a pair of integers" } }
32 { $description "Outputs the location of the top-left and bottom-right corners of a rectangle." } ;
35 { $values { "rect" rect } { "loc" "a pair of integers" } { "newrect" "a new " { $link rect } } }
36 { $description "Creates a new rectangle with the same dimensions, and top-left corner translated by " { $snippet "loc" } "." } ;
39 { $values { "rect1" rect } { "rect2" rect } { "newrect" "a new " { $link rect } } }
40 { $description "Computes the intersection of two rectangles." } ;
43 { $values { "rect/point" "a " { $link rect } " or a pair of integers" } { "rect" rect } { "?" "a boolean" } }
44 { $description "Tests if two rectangles (or a point and a rectangle, respectively) have a non-empty intersection." } ;
47 { $values { "rect" "a new " { $link rect } } }
48 { $description "Creates a rectangle located at the origin with zero dimensions." } ;
50 ARTICLE: "math.geometry.rect" "Rectangles"
51 "The " { $vocab-link "math.geometry.rect" } " vocabulary defines a rectangle data type and operations on them."
53 "Rectangles can be taken apart:"
54 { $subsection rect-loc }
55 { $subsection rect-dim }
56 { $subsection rect-bounds }
57 { $subsection rect-extent }
58 "New rectangles can be created:"
59 { $subsection <zero-rect> }
60 { $subsection <rect> }
61 { $subsection <extent-rect> }
62 "More utility words for working with rectangles:"
63 { $subsection offset-rect }
64 { $subsection rect-intersect }
65 { $subsection intersects? } ;
67 ABOUT: "math.geometry.rect"