]> gitweb.factorcode.org Git - factor.git/blob - basis/math/geometry/rect/rect-docs.factor
Merge branch 'master' into experimental
[factor.git] / basis / math / geometry / rect / rect-docs.factor
1 USING: help.markup help.syntax ;
2
3 IN: math.geometry.rect
4
5 HELP: rect
6 { $class-description "A rectangle with the following slots:"
7     { $list
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" }
10     }
11     "Rectangles are constructed by calling " { $link <rect> } " and " { $link <extent-rect> } "."
12 } ;
13
14 HELP: <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." } ;
17
18 { <zero-rect> <rect> <extent-rect> } related-words
19
20 HELP: rect-bounds
21 { $values { "rect" rect } { "loc" "a pair of integers" } { "dim" "a pair of integers" } }
22 { $description "Outputs the location and dimensions of a rectangle." } ;
23
24 { rect-bounds rect-extent } related-words
25
26 HELP: <extent-rect>
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." } ;
29
30 HELP: rect-extent
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." } ;
33
34 HELP: offset-rect
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" } "." } ;
37
38 HELP: rect-intersect
39 { $values { "rect1" rect } { "rect2" rect } { "newrect" "a new " { $link rect } } }
40 { $description "Computes the intersection of two rectangles." } ;
41
42 HELP: intersects?
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." } ;
45
46 HELP: <zero-rect>
47 { $values { "rect" "a new " { $link rect } } }
48 { $description "Creates a rectangle located at the origin with zero dimensions." } ;
49
50 ARTICLE: "math.geometry.rect" "Rectangles"
51 "The " { $vocab-link "math.geometry.rect" } " vocabulary defines a rectangle data type and operations on them."
52 { $subsection rect }
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? } ;
66
67 ABOUT: "math.geometry.rect"