]> gitweb.factorcode.org Git - factor.git/blob - basis/math/rectangles/rectangles-docs.factor
help.markup: adding a $slots word to document slots, use it.
[factor.git] / basis / math / rectangles / rectangles-docs.factor
1 USING: help.markup help.syntax kernel ;
2 IN: math.rectangles
3
4 HELP: rect
5 { $class-description "A rectangle with the following slots:"
6     { $slots
7         { "loc" "the top-left corner of the rectangle as an x/y pair" }
8         { "dim" "the dimensions of the rectangle as a width/height pair" }
9     }
10     "Rectangles are constructed by calling " { $link <rect> } " and " { $link <extent-rect> } "."
11 } ;
12
13 HELP: <rect>
14 { $values { "loc" "a pair of integers" } { "dim" "a pair of integers" } { "rect" "a new " { $link rect } } }
15 { $description "Creates a new rectangle with the specified top-left location and dimensions." } ;
16
17 { <zero-rect> <rect> <extent-rect> } related-words
18
19 HELP: rect-bounds
20 { $values { "rect" rect } { "loc" "a pair of integers" } { "dim" "a pair of integers" } }
21 { $description "Outputs the location and dimensions of a rectangle." } ;
22
23 { rect-bounds rect-extent } related-words
24
25 HELP: <extent-rect>
26 { $values { "loc" "a pair of integers" } { "ext" "a pair of integers" } { "rect" "a new " { $link rect } } }
27 { $description "Creates a new rectangle with the specified top-left and bottom-right corner locations." } ;
28
29 HELP: rect-extent
30 { $values { "rect" rect } { "loc" "a pair of integers" } { "ext" "a pair of integers" } }
31 { $description "Outputs the location of the top-left and bottom-right corners of a rectangle." } ;
32
33 HELP: offset-rect
34 { $values { "rect" rect } { "loc" "a pair of integers" } { "newrect" "a new " { $link rect } } }
35 { $description "Creates a new rectangle with the same dimensions, and top-left corner translated by " { $snippet "loc" } "." } ;
36
37 HELP: rect-intersect
38 { $values { "rect1" rect } { "rect2" rect } { "newrect" "a new " { $link rect } } }
39 { $description "Computes the intersection of two rectangles." } ;
40
41 HELP: contains-rect?
42 { $values { "rect1" rect } { "rect2" rect } { "?" boolean } }
43 { $description "Tests if two rectangles have a non-empty intersection." } ;
44
45 HELP: contains-point?
46 { $values { "point" "a pair of integers" } { "rect" rect } { "?" boolean } }
47 { $description "Tests if a rectangle contains a point." } ;
48
49 HELP: <zero-rect>
50 { $values { "rect" "a new " { $link rect } } }
51 { $description "Creates a rectangle located at the origin with zero dimensions." } ;
52
53 ARTICLE: "math.rectangles" "Rectangles"
54 "The " { $vocab-link "math.rectangles" } " vocabulary defines a rectangle data type and operations on them."
55 { $subsections rect }
56 "Rectangles can be taken apart:"
57 { $subsections
58     rect-bounds
59     rect-extent
60 }
61 "New rectangles can be created:"
62 { $subsections
63     <zero-rect>
64     <rect>
65     <extent-rect>
66 }
67 "Set-theoretic operations on rectangles:"
68 { $subsections
69     rect-intersect
70     rect-union
71     contains-rect?
72     contains-point?
73 }
74 "A utility word:"
75 { $subsections offset-rect } ;
76
77 ABOUT: "math.rectangles"