1 | <!DOCTYPE html>
|
---|
2 | <html lang="en">
|
---|
3 | <head>
|
---|
4 | <meta charset="utf-8" />
|
---|
5 | <script src="../../list.js"></script>
|
---|
6 | <script src="../../page.js"></script>
|
---|
7 | <link type="text/css" rel="stylesheet" href="../../page.css" />
|
---|
8 | </head>
|
---|
9 | <body>
|
---|
10 | <h1>[name]</h1>
|
---|
11 |
|
---|
12 | <div class="desc">Represents a boundary box in 2D space.</div>
|
---|
13 |
|
---|
14 |
|
---|
15 | <h2>Constructor</h2>
|
---|
16 |
|
---|
17 |
|
---|
18 | <h3>[name]([page:Vector2 min], [page:Vector2 max])</h3>
|
---|
19 | <div>
|
---|
20 | min -- Lower (x, y) boundary of the box.<br />
|
---|
21 | max -- Upper (x, y) boundary of the box.
|
---|
22 | </div>
|
---|
23 | <div>
|
---|
24 | Creates a box bounded by min and max.
|
---|
25 | </div>
|
---|
26 |
|
---|
27 |
|
---|
28 | <h2>Properties</h2>
|
---|
29 |
|
---|
30 |
|
---|
31 |
|
---|
32 | <h3>.[page:Vector2 max]</h3>
|
---|
33 | <div>
|
---|
34 | Upper (x, y) boundary of this box.
|
---|
35 | </div>
|
---|
36 |
|
---|
37 | <h3>.[page:Vector2 min]</h3>
|
---|
38 | <div>
|
---|
39 | Lower (x, y) boundary of this box.
|
---|
40 | </div>
|
---|
41 |
|
---|
42 | <h2>Methods</h2>
|
---|
43 |
|
---|
44 |
|
---|
45 |
|
---|
46 | <h3>.set([page:Vector2 min], [page:Vector2 max]) [page:Box2 this]</h3>
|
---|
47 | <div>
|
---|
48 | min -- Lower (x, y) boundary of the box. <br />
|
---|
49 | max -- Upper (x, y) boundary of the box.
|
---|
50 | </div>
|
---|
51 | <div>
|
---|
52 | Sets the lower and upper (x, y) boundaries of this box.
|
---|
53 | </div>
|
---|
54 |
|
---|
55 | <h3>.expandByPoint([page:Vector2 point]) [page:Box2 this]</h3>
|
---|
56 | <div>
|
---|
57 | point -- Point that should be included in the box.
|
---|
58 | </div>
|
---|
59 | <div>
|
---|
60 | Expands the boundaries of this box to include *point*.
|
---|
61 | </div>
|
---|
62 |
|
---|
63 | <h3>.clampPoint([page:Vector2 point], [page:Vector2 optionalTarget]) [page:Vector2]</h3>
|
---|
64 | <div>
|
---|
65 | point -- Position to clamp. <br />
|
---|
66 | optionalTarget -- If specified, the clamped result will be copied here.
|
---|
67 | </div>
|
---|
68 | <div>
|
---|
69 | Clamps *point* within the bounds of this box.
|
---|
70 | </div>
|
---|
71 |
|
---|
72 | <h3>.isIntersectionBox([page:Box2 box]) [page:Boolean]</h3>
|
---|
73 | <div>
|
---|
74 | box -- Box to check for intersection against.
|
---|
75 | </div>
|
---|
76 | <div>
|
---|
77 | Determines whether or not this box intersects *box*.
|
---|
78 | </div>
|
---|
79 |
|
---|
80 | <h3>.setFromPoints([page:Array points]) [page:Box2 this]</h3>
|
---|
81 | <div>
|
---|
82 | points -- Set of points that the resulting box will envelop.
|
---|
83 | </div>
|
---|
84 | <div>
|
---|
85 | Sets the upper and lower bounds of this box to include all of the points in *points*.
|
---|
86 | </div>
|
---|
87 |
|
---|
88 | <h3>.size([page:Vector2 optionalTarget]) [page:Vector2]</h3>
|
---|
89 | <div>
|
---|
90 | optionalTarget -- If specified, the result will be copied here.
|
---|
91 | </div>
|
---|
92 | <div>
|
---|
93 | Returns the width and height of this box.
|
---|
94 | </div>
|
---|
95 |
|
---|
96 | <h3>.union([page:Box2 box]) [page:Box2 this]</h3>
|
---|
97 | <div>
|
---|
98 | box -- Box that will be unioned with this box.
|
---|
99 | </div>
|
---|
100 | <div>
|
---|
101 | Unions this box with *box* setting the upper bound of this box to the greater of the
|
---|
102 | two boxes' upper bounds and the lower bound of this box to the lesser of the two boxes'
|
---|
103 | lower bounds.
|
---|
104 | </div>
|
---|
105 |
|
---|
106 | <h3>.getParameter([page:Vector2 point], [page:Vector2 optionalTarget]) [page:Vector2]</h3>
|
---|
107 | <div>
|
---|
108 | point -- [page:Vector2]<br/>
|
---|
109 | optionalTarget -- [page:Vector2]<br/>
|
---|
110 |
|
---|
111 | </div>
|
---|
112 | <div>
|
---|
113 | Returns a point as a proportion of this box's width and height.
|
---|
114 | </div>
|
---|
115 |
|
---|
116 | <h3>.expandByScalar([page:float scalar]) [page:Box2 this]</h3>
|
---|
117 | <div>
|
---|
118 | scalar -- Distance to expand.
|
---|
119 | </div>
|
---|
120 | <div>
|
---|
121 | Expands each dimension of the box by *scalar*. If negative, the dimensions of the box </br>
|
---|
122 | will be contracted.
|
---|
123 | </div>
|
---|
124 |
|
---|
125 | <h3>.intersect([page:Box2 box]) [page:Box2 this]</h3>
|
---|
126 | <div>
|
---|
127 | box -- Box to intersect with.
|
---|
128 | </div>
|
---|
129 | <div>
|
---|
130 | Returns the intersection of this and *box*, setting the upper bound of this box to the lesser </br>
|
---|
131 | of the two boxes' upper bounds and the lower bound of this box to the greater of the two boxes' </br>
|
---|
132 | lower bounds.
|
---|
133 | </div>
|
---|
134 |
|
---|
135 | <h3>.containsBox([page:Box2 box]) [page:Boolean]</h3>
|
---|
136 | <div>
|
---|
137 | box -- Box to test for inclusion.
|
---|
138 | </div>
|
---|
139 | <div>
|
---|
140 | Returns true if this box includes the entirety of *box*. If this and *box* overlap exactly,</br>
|
---|
141 | this function also returns true.
|
---|
142 | </div>
|
---|
143 |
|
---|
144 | <h3>.translate([page:Vector2 offset]) [page:Box2 this]</h3>
|
---|
145 | <div>
|
---|
146 | offset -- Direction and distance of offset.
|
---|
147 | </div>
|
---|
148 | <div>
|
---|
149 | Adds *offset* to both the upper and lower bounds of this box, effectively moving this box </br>
|
---|
150 | *offset* units in 2D space.
|
---|
151 | </div>
|
---|
152 |
|
---|
153 | <h3>.empty() [page:Boolean]</h3>
|
---|
154 | <div>
|
---|
155 | Returns true if this box includes zero points within its bounds.</br>
|
---|
156 | Note that a box with equal lower and upper bounds still includes one point, the
|
---|
157 | one both bounds share.
|
---|
158 | </div>
|
---|
159 |
|
---|
160 | <h3>.clone() [page:Box2]</h3>
|
---|
161 | <div>
|
---|
162 | Returns a copy of this box.
|
---|
163 | </div>
|
---|
164 |
|
---|
165 | <h3>.equals([page:Box2 box]) [page:Boolean]</h3>
|
---|
166 | <div>
|
---|
167 | box -- Box to compare.
|
---|
168 | </div>
|
---|
169 | <div>
|
---|
170 | Returns true if this box and *box* share the same lower and upper bounds.
|
---|
171 | </div>
|
---|
172 |
|
---|
173 | <h3>.expandByVector([page:Vector2 vector]) [page:Box2 this]</h3>
|
---|
174 | <div>
|
---|
175 | vector -- Amount to expand this box in each dimension.
|
---|
176 | </div>
|
---|
177 | <div>
|
---|
178 | Expands this box equilaterally by *vector*. The width of this box will be
|
---|
179 | expanded by the x component of *vector* in both directions. The height of
|
---|
180 | this box will be expanded by the y component of *vector* in both directions.
|
---|
181 | </div>
|
---|
182 |
|
---|
183 | <h3>.copy([page:Box2 box]) [page:Box2 this]</h3>
|
---|
184 | <div>
|
---|
185 | box -- Box to copy.
|
---|
186 | </div>
|
---|
187 | <div>
|
---|
188 | Copies the values of *box* to this box.
|
---|
189 | </div>
|
---|
190 |
|
---|
191 | <h3>.makeEmpty() [page:Box2 this]</h3>
|
---|
192 | <div>
|
---|
193 | Makes this box empty.
|
---|
194 | </div>
|
---|
195 |
|
---|
196 | <h3>.center([page:Vector2 optionalTarget]) [page:Vector2]</h3>
|
---|
197 | <div>
|
---|
198 | optionalTarget -- If specified, the result will be copied here.
|
---|
199 | </div>
|
---|
200 | <div>
|
---|
201 | Returns the center point of this box.
|
---|
202 | </div>
|
---|
203 |
|
---|
204 | <h3>.distanceToPoint([page:Vector2 point]) [page:Float]</h3>
|
---|
205 | <div>
|
---|
206 | point -- Point to measure distance to.
|
---|
207 | </div>
|
---|
208 | <div>
|
---|
209 | Returns the distance from any edge of this box to the specified point. </br>
|
---|
210 | If the point lies inside of this box, the distance will be 0.
|
---|
211 | </div>
|
---|
212 |
|
---|
213 | <h3>.containsPoint([page:Vector2 point]) [page:Boolean]</h3>
|
---|
214 | <div>
|
---|
215 | point -- Point to check for inclusion.
|
---|
216 | </div>
|
---|
217 | <div>
|
---|
218 | Returns true if the specified point lies within the boundaries of this box.
|
---|
219 | </div>
|
---|
220 |
|
---|
221 | <h3>.setFromCenterAndSize([page:Vector2 center], [page:Vector2 size]) [page:Box2 this]</h3>
|
---|
222 | <div>
|
---|
223 | center -- Desired center position of the box. <br />
|
---|
224 | size -- Desired x and y dimensions of the box.
|
---|
225 | </div>
|
---|
226 | <div>
|
---|
227 | Centers this box on *center* and sets this box's width and height to the values specified
|
---|
228 | in *size*.
|
---|
229 | </div>
|
---|
230 |
|
---|
231 | <h2>Source</h2>
|
---|
232 |
|
---|
233 | [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
|
---|
234 | </body>
|
---|
235 | </html>
|
---|