|
@@ -18,10 +18,12 @@
|
|
|
|
|
|
<h3>[name]( [page:Vector2 min], [page:Vector2 max] )</h3>
|
|
|
<div>
|
|
|
- min -- Lower (x, y) boundary of the box.<br>
|
|
|
- max -- Upper (x, y) boundary of the box.
|
|
|
- </div>
|
|
|
- <div>
|
|
|
+ [page:Vector2 min] - (optional) [page:Vector2] representing the lower (x, y) boundary of the box.
|
|
|
+ Default is ( + Infinity, + Infinity ).<br>
|
|
|
+
|
|
|
+ [page:Vector2 max] - (optional) [page:Vector2] representing the lower upper (x, y) boundary of the box.
|
|
|
+ Default is ( - Infinity, - Infinity ).<br /><br />
|
|
|
+
|
|
|
Creates a box bounded by min and max.
|
|
|
</div>
|
|
|
|
|
@@ -32,203 +34,189 @@
|
|
|
|
|
|
<h3>[property:Vector2 min]</h3>
|
|
|
<div>
|
|
|
- Lower (x, y) boundary of this box.
|
|
|
+ [page:Vector2] representing the lower (x, y) boundary of the box.<br />
|
|
|
+ Default is ( + Infinity, + Infinity ).
|
|
|
</div>
|
|
|
|
|
|
<h3>[property:Vector2 max]</h3>
|
|
|
<div>
|
|
|
- Upper (x, y) boundary of this box.
|
|
|
+ [page:Vector2] representing the lower upper (x, y) boundary of the box.<br />
|
|
|
+ Default is ( - Infinity, - Infinity ).
|
|
|
</div>
|
|
|
|
|
|
- <h2>Methods</h2>
|
|
|
|
|
|
|
|
|
+ <h2>Methods</h2>
|
|
|
|
|
|
- <h3>[method:Box2 set]( [page:Vector2 min], [page:Vector2 max] ) [page:Box2 this]</h3>
|
|
|
- <div>
|
|
|
- min -- Lower (x, y) boundary of the box. <br>
|
|
|
- max -- Upper (x, y) boundary of the box.
|
|
|
- </div>
|
|
|
+ <h3>[method:Vector2 clampPoint]( [page:Vector2 point], [page:Vector2 optionalTarget] )</h3>
|
|
|
<div>
|
|
|
- Sets the lower and upper (x, y) boundaries of this box.
|
|
|
- </div>
|
|
|
+ [page:Vector2 point] - [page:Vector2] to clamp. <br>
|
|
|
+ [page:Vector2 optionalTarget] - If specified, the clamped result will be copied into this [page:Vector2].<br /><br />
|
|
|
|
|
|
- <h3>[method:Box2 expandByPoint]( [page:Vector2 point] ) [page:Box2 this]</h3>
|
|
|
- <div>
|
|
|
- point -- Point that should be included in the box.
|
|
|
- </div>
|
|
|
- <div>
|
|
|
- Expands the boundaries of this box to include *point*.
|
|
|
+ [link:https://en.wikipedia.org/wiki/Clamping_(graphics) Clamps] the *point* within the bounds of this box.<br />
|
|
|
+ Note: if [page:Vector2 optionalTarget] is not specified, a new [page:Vector2] will be returned. The original point
|
|
|
+ is not modified.
|
|
|
</div>
|
|
|
|
|
|
- <h3>[method:Vector2 clampPoint]( [page:Vector2 point], [page:Vector2 optionalTarget] ) [page:Box2 this]</h3>
|
|
|
- <div>
|
|
|
- point -- Position to clamp. <br>
|
|
|
- optionalTarget -- If specified, the clamped result will be copied here.
|
|
|
- </div>
|
|
|
- <div>
|
|
|
- Clamps *point* within the bounds of this box.
|
|
|
- </div>
|
|
|
+ <h3>[method:Box2 clone]()</h3>
|
|
|
+ <div>Returns a new [page:Box2] with the same [page:.min] and [page:.max] as this one.</div>
|
|
|
|
|
|
- <h3>[method:Boolean intersectsBox]( [page:Box2 box] ) [page:Box2 this]</h3>
|
|
|
- <div>
|
|
|
- box -- Box to check for intersection against.
|
|
|
- </div>
|
|
|
+ <h3>[method:Boolean containsBox]( [page:Box2 box] )</h3>
|
|
|
<div>
|
|
|
- Determines whether or not this box intersects *box*.
|
|
|
- </div>
|
|
|
+ [page:Box2 box] - [page:Box2 Box2] to test for inclusion.<br /><br />
|
|
|
|
|
|
- <h3>[method:Box2 setFromPoints]( [page:Array points] ) [page:Box2 this]</h3>
|
|
|
- <div>
|
|
|
- points -- Set of points that the resulting box will envelop.
|
|
|
+ Returns true if this box includes the entirety of [page:Box2 box]. If this and [page:Box2 box] are identical, <br>
|
|
|
+ this function also returns true.
|
|
|
</div>
|
|
|
+
|
|
|
+ <h3>[method:Boolean containsPoint]( [page:Vector2 point] )</h3>
|
|
|
<div>
|
|
|
- Sets the upper and lower bounds of this box to include all of the points in *points*.
|
|
|
+ [page:Vector2 point] - [page:Vector2] to check for inclusion.<br /><br />
|
|
|
+
|
|
|
+ Returns true if the specified [page:Vector2 point] lies within or on the boundaries of this box.
|
|
|
</div>
|
|
|
|
|
|
- <h3>[method:Vector2 getSize]( [page:Vector2 optionalTarget] ) [page:Box2 this]</h3>
|
|
|
+ <h3>[method:Box2 copy]( [page:Box2 box] )</h3>
|
|
|
<div>
|
|
|
- optionalTarget -- If specified, the result will be copied here.
|
|
|
+ [page:Box2 box] - [page:Box2] to copy.<br /><br />
|
|
|
+
|
|
|
+ Copies the [page:.min] and [page:.max] from [page:Box2 box] to this box.
|
|
|
</div>
|
|
|
+
|
|
|
+ <h3>[method:Float distanceToPoint]( [page:Vector2 point] )</h3>
|
|
|
<div>
|
|
|
- Returns the width and height of this box.
|
|
|
+ [page:Vector2 point] - [page:Vector2] to measure distance to.<br /><br />
|
|
|
+
|
|
|
+ Returns the distance from any edge of this box to the specified point.
|
|
|
+ If the [page:Vector2 point] lies inside of this box, the distance will be 0.
|
|
|
</div>
|
|
|
|
|
|
- <h3>[method:Box2 union]( [page:Box2 box] ) [page:Box2 this]</h3>
|
|
|
+ <h3>[method:Box2 expandByPoint]( [page:Vector2 point] )</h3>
|
|
|
<div>
|
|
|
- box -- Box that will be unioned with this box.
|
|
|
+ [page:Vector2 point] - [page:Vector2] that should be included in the box.<br /><br />
|
|
|
+
|
|
|
+ Expands the boundaries of this box to include [page:Vector2 point].
|
|
|
</div>
|
|
|
+
|
|
|
+ <h3>[method:Box2 expandByScalar]( [page:float scalar] )</h3>
|
|
|
<div>
|
|
|
- Unions this box with *box* setting the upper bound of this box to the greater of the <br>
|
|
|
- two boxes' upper bounds and the lower bound of this box to the lesser of the two boxes' <br>
|
|
|
- lower bounds.
|
|
|
+ [page:float scalar] - Distance to expand the box by.<br /><br />
|
|
|
+
|
|
|
+ Expands each dimension of the box by [page:float scalar]. If negative, the dimensions of the box
|
|
|
+ will be contracted.
|
|
|
</div>
|
|
|
|
|
|
- <h3>[method:Vector2 getParameter]( [page:Vector2 point], [page:Vector2 optionalTarget] ) [page:Box2 this]</h3>
|
|
|
+ <h3>[method:Box2 expandByVector]( [page:Vector2 vector] )</h3>
|
|
|
<div>
|
|
|
- point -- [page:Vector2]<br/>
|
|
|
- optionalTarget -- [page:Vector2]<br/>
|
|
|
+ [page:Vector2 vector] - [page:Vector2] to expand the box by.<br /><br />
|
|
|
|
|
|
+ Expands this box equilaterally by [page:Vector2 vector]. The width of this box will be
|
|
|
+ expanded by the x component of [page:Vector2 vector] in both directions. The height of
|
|
|
+ this box will be expanded by the y component of [page:Vector2 vector] in both directions.
|
|
|
</div>
|
|
|
+
|
|
|
+ <h3>[method:Vector2 getCenter]( [page:Vector2 optionalTarget] )</h3>
|
|
|
<div>
|
|
|
- Returns a point as a proportion of this box's width and height.
|
|
|
+ [page:Vector2 optionalTarget] - (optional) If specified, the result will be copied into this [page:Vector2].<br /><br />
|
|
|
+
|
|
|
+ Returns the center point of the box as a [page:Vector2]. If [page:Vector2 optionalTarget] is not set,
|
|
|
+ a new [page:Vector2] containing the result will be returned.
|
|
|
</div>
|
|
|
|
|
|
- <h3>[method:Box2 expandByScalar]( [page:float scalar] ) [page:Box2 this]</h3>
|
|
|
+ <h3>[method:Vector2 getParameter]( [page:Vector2 point], [page:Vector2 optionalTarget] ) </h3>
|
|
|
<div>
|
|
|
- scalar -- Distance to expand.
|
|
|
+ [page:Vector2 point] - [page:Vector2].<br/>
|
|
|
+ optionalTarget - (optional) If specified, the result will be copied into this [page:Vector2].<br/><br/>
|
|
|
+
|
|
|
+ Returns a point as a proportion of this box's width and height. If [page:Vector2 optionalTarget] is not set,
|
|
|
+ a new [page:Vector2] containing the result will be returned.
|
|
|
</div>
|
|
|
+
|
|
|
+ <h3>[method:Vector2 getSize]( [page:Vector2 optionalTarget] )</h3>
|
|
|
<div>
|
|
|
- Expands each dimension of the box by *scalar*. If negative, the dimensions of the box <br>
|
|
|
- will be contracted.
|
|
|
+ optionalTarget - (optional) If specified, the result will be copied into this [page:Vector2].<br /><br />
|
|
|
+
|
|
|
+ Returns the width and height of this box. If [page:Vector2 optionalTarget] is not set,
|
|
|
+ a new [page:Vector2] containing the result will be returned.
|
|
|
</div>
|
|
|
|
|
|
- <h3>[method:Box2 intersect]( [page:Box2 box] ) [page:Box2 this]</h3>
|
|
|
+ <h3>[method:Boolean equals]( [page:Box2 box] )</h3>
|
|
|
<div>
|
|
|
- box -- Box to intersect with.
|
|
|
+ [page:Box2 box] - Box to compare with this one.<br /><br />
|
|
|
+
|
|
|
+ Returns true if this box and [page:Box2 box] share the same lower and upper bounds.
|
|
|
</div>
|
|
|
+
|
|
|
+ <h3>[method:Box2 intersect]( [page:Box2 box] )</h3>
|
|
|
<div>
|
|
|
- Returns the intersection of this and *box*, setting the upper bound of this box to the lesser <br>
|
|
|
- of the two boxes' upper bounds and the lower bound of this box to the greater of the two boxes' <br>
|
|
|
+ [page:Box2 box] - Box to intersect with.<br /><br />
|
|
|
+
|
|
|
+ Returns the intersection of this and [page:Box2 box], setting the upper bound of this box to the lesser
|
|
|
+ of the two boxes' upper bounds and the lower bound of this box to the greater of the two boxes'
|
|
|
lower bounds.
|
|
|
</div>
|
|
|
|
|
|
- <h3>[method:Boolean containsBox]( [page:Box2 box] ) [page:Box2 this]</h3>
|
|
|
+ <h3>[method:Boolean intersectsBox]( [page:Box2 box] )</h3>
|
|
|
<div>
|
|
|
- box -- Box to test for inclusion.
|
|
|
- </div>
|
|
|
- <div>
|
|
|
- Returns true if this box includes the entirety of *box*. If this and *box* overlap exactly, <br>
|
|
|
- this function also returns true.
|
|
|
- </div>
|
|
|
+ [page:Box2 box] - Box to check for intersection against.<br /><br />
|
|
|
|
|
|
- <h3>[method:Box2 translate]( [page:Vector2 offset] ) [page:Box2 this]</h3>
|
|
|
- <div>
|
|
|
- offset -- Direction and distance of offset.
|
|
|
- </div>
|
|
|
- <div>
|
|
|
- Adds *offset* to both the upper and lower bounds of this box, effectively moving this box <br>
|
|
|
- *offset* units in 2D space.
|
|
|
+ Determines whether or not this box intersects [page:Box2 box].
|
|
|
</div>
|
|
|
|
|
|
- <h3>[method:Boolean isEmpty]() [page:Box2 this]</h3>
|
|
|
+ <h3>[method:Boolean isEmpty]()</h3>
|
|
|
<div>
|
|
|
Returns true if this box includes zero points within its bounds.<br>
|
|
|
- Note that a box with equal lower and upper bounds still includes one point, the <br>
|
|
|
+ Note that a box with equal lower and upper bounds still includes one point, the
|
|
|
one both bounds share.
|
|
|
</div>
|
|
|
|
|
|
- <h3>[method:Box2 clone]() [page:Box2 this]</h3>
|
|
|
- <div>
|
|
|
- Returns a copy of this box.
|
|
|
- </div>
|
|
|
+ <h3>[method:Box2 makeEmpty]()</h3>
|
|
|
+ <div>Makes this box empty.</div>
|
|
|
|
|
|
- <h3>[method:Boolean equals]( [page:Box2 box] ) [page:Box2 this]</h3>
|
|
|
- <div>
|
|
|
- box -- Box to compare.
|
|
|
- </div>
|
|
|
- <div>
|
|
|
- Returns true if this box and *box* share the same lower and upper bounds.
|
|
|
- </div>
|
|
|
|
|
|
- <h3>[method:Box2 expandByVector]( [page:Vector2 vector] ) [page:Box2 this]</h3>
|
|
|
+ <h3>[method:Box2 set]( [page:Vector2 min], [page:Vector2 max] )</h3>
|
|
|
<div>
|
|
|
- vector -- Amount to expand this box in each dimension.
|
|
|
- </div>
|
|
|
- <div>
|
|
|
- Expands this box equilaterally by *vector*. The width of this box will be <br>
|
|
|
- expanded by the x component of *vector* in both directions. The height of <br>
|
|
|
- this box will be expanded by the y component of *vector* in both directions.
|
|
|
- </div>
|
|
|
+ [page:Vector2 min] - (required ) [page:Vector2] representing the lower (x, y) boundary of the box. <br>
|
|
|
+ [page:Vector2 max] - (required) [page:Vector2] representing the lower upper (x, y) boundary of the box. <br /><br />
|
|
|
|
|
|
- <h3>[method:Box2 copy]( [page:Box2 box] ) [page:Box2 this]</h3>
|
|
|
- <div>
|
|
|
- box -- Box to copy.
|
|
|
- </div>
|
|
|
- <div>
|
|
|
- Copies the values of *box* to this box.
|
|
|
+ Sets the lower and upper (x, y) boundaries of this box.
|
|
|
</div>
|
|
|
|
|
|
- <h3>[method:Box2 makeEmpty]() [page:Box2 this]</h3>
|
|
|
+ <h3>[method:Box2 setFromCenterAndSize]( [page:Vector2 center], [page:Vector2 size] )</h3>
|
|
|
<div>
|
|
|
- Makes this box empty.
|
|
|
- </div>
|
|
|
+ [page:Vector2 center] - Desired center position of the box ([page:Vector2]). <br>
|
|
|
+ [page:Vector2 size] - Desired x and y dimensions of the box ([page:Vector2]).<br /><br />
|
|
|
|
|
|
- <h3>[method:Vector2 getCenter]( [page:Vector2 optionalTarget] ) [page:Box2 this]</h3>
|
|
|
- <div>
|
|
|
- optionalTarget -- If specified, the result will be copied here.
|
|
|
- </div>
|
|
|
- <div>
|
|
|
- Returns the center point of this box.
|
|
|
+ Centers this box on [page:Vector2 center] and sets this box's width and height to the values specified
|
|
|
+ in [page:Vector2 size].
|
|
|
</div>
|
|
|
|
|
|
- <h3>[method:Float distanceToPoint]( [page:Vector2 point] ) [page:Box2 this]</h3>
|
|
|
- <div>
|
|
|
- point -- Point to measure distance to.
|
|
|
- </div>
|
|
|
+ <h3>[method:Box2 setFromPoints]( [page:Array points] )</h3>
|
|
|
<div>
|
|
|
- Returns the distance from any edge of this box to the specified point. <br>
|
|
|
- If the point lies inside of this box, the distance will be 0.
|
|
|
- </div>
|
|
|
+ [page:Array points] - Array of [page:Vector2 Vector2s] that the resulting box will contain.<br /><br />
|
|
|
|
|
|
- <h3>[method:Boolean containsPoint]( [page:Vector2 point] ) [page:Box2 this]</h3>
|
|
|
- <div>
|
|
|
- point -- [page:Vector2] to check for inclusion.
|
|
|
- </div>
|
|
|
- <div>
|
|
|
- Returns true if the specified point lies within the boundaries of this box.
|
|
|
+ Sets the upper and lower bounds of this box to include all of the points in [page:Array points].
|
|
|
</div>
|
|
|
|
|
|
- <h3>[method:Box2 setFromCenterAndSize]( [page:Vector2 center], [page:Vector2 size] ) [page:Box2 this]</h3>
|
|
|
+ <h3>[method:Box2 translate]( [page:Vector2 offset] )</h3>
|
|
|
<div>
|
|
|
- center -- Desired center position of the box. <br>
|
|
|
- size -- Desired x and y dimensions of the box.
|
|
|
+ [page:Vector2 offset] - Direction and distance of offset.<br /><br />
|
|
|
+
|
|
|
+ Adds [page:Vector2 offset] to both the upper and lower bounds of this box, effectively moving this box
|
|
|
+ [page:Vector2 offset] units in 2D space.
|
|
|
</div>
|
|
|
+
|
|
|
+ <h3>[method:Box2 union]( [page:Box2 box] )</h3>
|
|
|
<div>
|
|
|
- Centers this box on *center* and sets this box's width and height to the values specified <br>
|
|
|
- in *size*.
|
|
|
+ [page:Box2 box] - Box that will be unioned with this box.<br /><br />
|
|
|
+
|
|
|
+ Unions this box with [page:Box2 box], setting the upper bound of this box to the greater of the
|
|
|
+ two boxes' upper bounds and the lower bound of this box to the lesser of the two boxes'
|
|
|
+ lower bounds.
|
|
|
</div>
|
|
|
|
|
|
+
|
|
|
+
|
|
|
<h2>Source</h2>
|
|
|
|
|
|
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
|