123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="utf-8" />
- <base href="../../../" />
- <script src="page.js"></script>
- <link type="text/css" rel="stylesheet" href="page.css" />
- </head>
- <body>
- <h1>[name]</h1>
- <p class="desc">
- Represents an axis-aligned bounding box (AABB) in 2D space.
- </p>
- <h2>Constructor</h2>
- <h3>[name]( [param:Vector2 min], [param:Vector2 max] )</h3>
- <p>
- [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 upper (x, y) boundary of the box.
- Default is ( - Infinity, - Infinity ).<br /><br />
- Creates a [name] bounded by min and max.
- </p>
- <h2>Properties</h2>
- <h3>[property:Vector2 min]</h3>
- <p>
- [page:Vector2] representing the lower (x, y) boundary of the box.<br />
- Default is ( + Infinity, + Infinity ).
- </p>
- <h3>[property:Vector2 max]</h3>
- <p>
- [page:Vector2] representing the lower upper (x, y) boundary of the box.<br />
- Default is ( - Infinity, - Infinity ).
- </p>
- <h2>Methods</h2>
- <h3>[method:Vector2 clampPoint]( [param:Vector2 point], [param:Vector2 target] )</h3>
- <p>
- [page:Vector2 point] - [page:Vector2] to clamp. <br>
- [page:Vector2 target] — the result will be copied into this Vector2.<br /><br />
- [link:https://en.wikipedia.org/wiki/Clamping_(graphics) Clamps] the [page:Vector2 point] within the bounds of this box.<br />
- </p>
- <h3>[method:Box2 clone]()</h3>
- <p>Returns a new [page:Box2] with the same [page:.min min] and [page:.max max] as this one.</p>
- <h3>[method:Boolean containsBox]( [param:Box2 box] )</h3>
- <p>
- [page:Box2 box] - [page:Box2 Box2] to test for inclusion.<br /><br />
- 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.
- </p>
- <h3>[method:Boolean containsPoint]( [param:Vector2 point] )</h3>
- <p>
- [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.
- </p>
- <h3>[method:Box2 copy]( [param:Box2 box] )</h3>
- <p>
- Copies the [page:.min min] and [page:.max max] from [page:Box2 box] to this box.
- </p>
- <h3>[method:Float distanceToPoint]( [param:Vector2 point] )</h3>
- <p>
- [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.
- </p>
- <h3>[method:Boolean equals]( [param:Box2 box] )</h3>
- <p>
- [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.
- </p>
- <h3>[method:Box2 expandByPoint]( [param:Vector2 point] )</h3>
- <p>
- [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].
- </p>
- <h3>[method:Box2 expandByScalar]( [param:Float scalar] )</h3>
- <p>
- [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.
- </p>
- <h3>[method:Box2 expandByVector]( [param:Vector2 vector] )</h3>
- <p>
- [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.
- </p>
- <h3>[method:Vector2 getCenter]( [param:Vector2 target] )</h3>
- <p>
- [page:Vector2 target] — the result will be copied into this Vector2.<br /><br />
- Returns the center point of the box as a [page:Vector2].
- </p>
- <h3>[method:Vector2 getParameter]( [param:Vector2 point], [param:Vector2 target] ) </h3>
- <p>
- [page:Vector2 point] - [page:Vector2].<br/>
- [page:Vector2 target] — the result will be copied into this Vector2.<br /><br />
- Returns a point as a proportion of this box's width and height.
- </p>
- <h3>[method:Vector2 getSize]( [param:Vector2 target] )</h3>
- <p>
- [page:Vector2 target] — the result will be copied into this Vector2.<br /><br />
- Returns the width and height of this box.
- </p>
- <h3>[method:Box2 intersect]( [param:Box2 box] )</h3>
- <p>
- [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.
- </p>
- <h3>[method:Boolean intersectsBox]( [param:Box2 box] )</h3>
- <p>
- [page:Box2 box] - Box to check for intersection against.<br /><br />
- Determines whether or not this box intersects [page:Box2 box].
- </p>
- <h3>[method:Boolean isEmpty]()</h3>
- <p>
- 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
- one both bounds share.
- </p>
- <h3>[method:Box2 makeEmpty]()</h3>
- <p>Makes this box empty.</p>
- <h3>[method:Box2 set]( [param:Vector2 min], [param:Vector2 max] )</h3>
- <p>
- [page:Vector2 min] - (required ) [page:Vector2] representing the lower (x, y) boundary of the box. <br>
- [page:Vector2 max] - (required) [page:Vector2] representing the upper (x, y) boundary of the box. <br /><br />
- Sets the lower and upper (x, y) boundaries of this box.<br>
- Please note that this method only copies the values from the given objects.
- </p>
- <h3>[method:Box2 setFromCenterAndSize]( [param:Vector2 center], [param:Vector2 size] )</h3>
- <p>
- [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 />
- Centers this box on [page:Vector2 center] and sets this box's width and height to the values specified
- in [page:Vector2 size].
- </p>
- <h3>[method:Box2 setFromPoints]( [param:Array points] )</h3>
- <p>
- [page:Array points] - Array of [page:Vector2 Vector2s] that the resulting box will contain.<br /><br />
- Sets the upper and lower bounds of this box to include all of the points in [page:Array points].
- </p>
- <h3>[method:Box2 translate]( [param:Vector2 offset] )</h3>
- <p>
- [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.
- </p>
- <h3>[method:Box2 union]( [param:Box2 box] )</h3>
- <p>
- [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.
- </p>
- <h2>Source</h2>
- <p>
- [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
- </p>
- </body>
- </html>
|