| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="utf-8">
- <title>Box3 - Three.js Docs</title>
- <meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
- <script src="../scripts/highlight.min.js"></script>
- <link type="text/css" rel="stylesheet" href="../styles/highlight-three.css">
- <link type="text/css" rel="stylesheet" href="../styles/page.css">
- </head>
- <body>
- <h1 translate="no">Box3</h1>
- <section>
- <header>
- <div class="class-description"><p>Represents an axis-aligned bounding box (AABB) in 3D space.</p></div>
- </header>
- <article>
- <div class="container-overview">
- <h2>Constructor</h2>
- <h3 class="name name-method" id="Box3" translate="no">new <a href="#Box3">Box3</a><span class="signature">( min : <span class="param-type"><a href="Vector3.html">Vector3</a></span>, max : <span class="param-type"><a href="Vector3.html">Vector3</a></span> )</span> </h3>
- <div class="method">
- <div class="description">
- <p>Constructs a new bounding box.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>min</strong>
- </td>
- <td class="description last">
- <p>A vector representing the lower boundary of the box.</p>
- <p>Default is <code>(Infinity,Infinity,Infinity)</code>.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>max</strong>
- </td>
- <td class="description last">
- <p>A vector representing the upper boundary of the box.</p>
- <p>Default is <code>(-Infinity,-Infinity,-Infinity)</code>.</p>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- </div>
- <h2 class="subsection-title">Properties</h2>
- <div class="member">
- <h3 class="name" id="isBox3" translate="no">.<a href="#isBox3">isBox3</a><span class="type-signature"> : boolean</span> <span class="type-signature">(readonly) </span></h3>
- <div class="description">
- <p>This flag can be used for type testing.</p>
- <p>Default is <code>true</code>.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="max" translate="no">.<a href="#max">max</a><span class="type-signature"> : <a href="Vector3.html">Vector3</a></span> </h3>
- <div class="description">
- <p>The upper boundary of the box.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="min" translate="no">.<a href="#min">min</a><span class="type-signature"> : <a href="Vector3.html">Vector3</a></span> </h3>
- <div class="description">
- <p>The lower boundary of the box.</p>
- </div>
- </div>
- <h2 class="subsection-title">Methods</h2>
- <h3 class="name name-method" id="applyMatrix4" translate="no">.<a href="#applyMatrix4">applyMatrix4</a><span class="signature">( matrix : <span class="param-type"><a href="Matrix4.html">Matrix4</a></span> )</span><span class="type-signature"> : <a href="Box3.html">Box3</a></span> </h3>
- <div class="method">
- <div class="description">
- <p>Transforms this bounding box by the given 4x4 transformation matrix.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>matrix</strong>
- </td>
- <td class="description last">
- <p>The transformation matrix.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> A reference to this bounding box.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="clampPoint" translate="no">.<a href="#clampPoint">clampPoint</a><span class="signature">( point : <span class="param-type"><a href="Vector3.html">Vector3</a></span>, target : <span class="param-type"><a href="Vector3.html">Vector3</a></span> )</span><span class="type-signature"> : <a href="Vector3.html">Vector3</a></span> </h3>
- <div class="method">
- <div class="description">
- <p>Clamps the given point within the bounds of this box.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>point</strong>
- </td>
- <td class="description last">
- <p>The point to clamp.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>target</strong>
- </td>
- <td class="description last">
- <p>The target vector that is used to store the method's result.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The clamped point.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="clone" translate="no">.<a href="#clone">clone</a><span class="signature">()</span><span class="type-signature"> : <a href="Box3.html">Box3</a></span> </h3>
- <div class="method">
- <div class="description">
- <p>Returns a new box with copied values from this instance.</p>
- </div>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> A clone of this instance.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="containsBox" translate="no">.<a href="#containsBox">containsBox</a><span class="signature">( box : <span class="param-type"><a href="Box3.html">Box3</a></span> )</span><span class="type-signature"> : boolean</span> </h3>
- <div class="method">
- <div class="description">
- <p>Returns <code>true</code> if this bounding box includes the entirety of the given bounding box.
- If this box and the given one are identical, this function also returns <code>true</code>.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>box</strong>
- </td>
- <td class="description last">
- <p>The bounding box to test.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> Whether the bounding box contains the given bounding box or not.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="containsPoint" translate="no">.<a href="#containsPoint">containsPoint</a><span class="signature">( point : <span class="param-type"><a href="Vector3.html">Vector3</a></span> )</span><span class="type-signature"> : boolean</span> </h3>
- <div class="method">
- <div class="description">
- <p>Returns <code>true</code> if the given point lies within or on the boundaries of this box.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>point</strong>
- </td>
- <td class="description last">
- <p>The point to test.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> Whether the bounding box contains the given point or not.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="copy" translate="no">.<a href="#copy">copy</a><span class="signature">( box : <span class="param-type"><a href="Box3.html">Box3</a></span> )</span><span class="type-signature"> : <a href="Box3.html">Box3</a></span> </h3>
- <div class="method">
- <div class="description">
- <p>Copies the values of the given box to this instance.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>box</strong>
- </td>
- <td class="description last">
- <p>The box to copy.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> A reference to this bounding box.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="distanceToPoint" translate="no">.<a href="#distanceToPoint">distanceToPoint</a><span class="signature">( point : <span class="param-type"><a href="Vector3.html">Vector3</a></span> )</span><span class="type-signature"> : number</span> </h3>
- <div class="method">
- <div class="description">
- <p>Returns the euclidean distance from any edge of this box to the specified point. If
- the given point lies inside of this box, the distance will be <code>0</code>.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>point</strong>
- </td>
- <td class="description last">
- <p>The point to compute the distance to.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The euclidean distance.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="equals" translate="no">.<a href="#equals">equals</a><span class="signature">( box : <span class="param-type"><a href="Box3.html">Box3</a></span> )</span><span class="type-signature"> : boolean</span> </h3>
- <div class="method">
- <div class="description">
- <p>Returns <code>true</code> if this bounding box is equal with the given one.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>box</strong>
- </td>
- <td class="description last">
- <p>The box to test for equality.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> Whether this bounding box is equal with the given one.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="expandByObject" translate="no">.<a href="#expandByObject">expandByObject</a><span class="signature">( object : <span class="param-type"><a href="Object3D.html">Object3D</a></span>, precise : <span class="param-type">boolean</span> )</span><span class="type-signature"> : <a href="Box3.html">Box3</a></span> </h3>
- <div class="method">
- <div class="description">
- <p>Expands the boundaries of this box to include the given 3D object and
- its children, accounting for the object's, and children's, world
- transforms. The function may result in a larger box than strictly
- necessary (unless the precise parameter is set to true).</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>object</strong>
- </td>
- <td class="description last">
- <p>The 3D object that should expand the bounding box.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>precise</strong>
- </td>
- <td class="description last">
- <p>If set to <code>true</code>, the method expands the bounding box
- as little as necessary at the expense of more computation.</p>
- <p>Default is <code>false</code>.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> A reference to this bounding box.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="expandByPoint" translate="no">.<a href="#expandByPoint">expandByPoint</a><span class="signature">( point : <span class="param-type"><a href="Vector3.html">Vector3</a></span> )</span><span class="type-signature"> : <a href="Box3.html">Box3</a></span> </h3>
- <div class="method">
- <div class="description">
- <p>Expands the boundaries of this box to include the given point.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>point</strong>
- </td>
- <td class="description last">
- <p>The point that should be included by the bounding box.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> A reference to this bounding box.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="expandByScalar" translate="no">.<a href="#expandByScalar">expandByScalar</a><span class="signature">( scalar : <span class="param-type">number</span> )</span><span class="type-signature"> : <a href="Box3.html">Box3</a></span> </h3>
- <div class="method">
- <div class="description">
- <p>Expands each dimension of the box by the given scalar. If negative, the
- dimensions of the box will be contracted.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>scalar</strong>
- </td>
- <td class="description last">
- <p>The scalar value that should expand the bounding box.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> A reference to this bounding box.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="expandByVector" translate="no">.<a href="#expandByVector">expandByVector</a><span class="signature">( vector : <span class="param-type"><a href="Vector3.html">Vector3</a></span> )</span><span class="type-signature"> : <a href="Box3.html">Box3</a></span> </h3>
- <div class="method">
- <div class="description">
- <p>Expands this box equilaterally by the given vector. The width of this
- box will be expanded by the x component of the vector in both
- directions. The height of this box will be expanded by the y component of
- the vector in both directions. The depth of this box will be
- expanded by the z component of the vector in both directions.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>vector</strong>
- </td>
- <td class="description last">
- <p>The vector that should expand the bounding box.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> A reference to this bounding box.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="fromJSON" translate="no">.<a href="#fromJSON">fromJSON</a><span class="signature">( json : <span class="param-type">Object</span> )</span><span class="type-signature"> : <a href="Box3.html">Box3</a></span> </h3>
- <div class="method">
- <div class="description">
- <p>Returns a serialized structure of the bounding box.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>json</strong>
- </td>
- <td class="description last">
- <p>The serialized json to set the box from.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> A reference to this bounding box.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="getBoundingSphere" translate="no">.<a href="#getBoundingSphere">getBoundingSphere</a><span class="signature">( target : <span class="param-type"><a href="Sphere.html">Sphere</a></span> )</span><span class="type-signature"> : <a href="Sphere.html">Sphere</a></span> </h3>
- <div class="method">
- <div class="description">
- <p>Returns a bounding sphere that encloses this bounding box.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>target</strong>
- </td>
- <td class="description last">
- <p>The target sphere that is used to store the method's result.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The bounding sphere that encloses this bounding box.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="getCenter" translate="no">.<a href="#getCenter">getCenter</a><span class="signature">( target : <span class="param-type"><a href="Vector3.html">Vector3</a></span> )</span><span class="type-signature"> : <a href="Vector3.html">Vector3</a></span> </h3>
- <div class="method">
- <div class="description">
- <p>Returns the center point of this box.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>target</strong>
- </td>
- <td class="description last">
- <p>The target vector that is used to store the method's result.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The center point.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="getParameter" translate="no">.<a href="#getParameter">getParameter</a><span class="signature">( point : <span class="param-type"><a href="Vector3.html">Vector3</a></span>, target : <span class="param-type"><a href="Vector3.html">Vector3</a></span> )</span><span class="type-signature"> : <a href="Vector3.html">Vector3</a></span> </h3>
- <div class="method">
- <div class="description">
- <p>Returns a point as a proportion of this box's width, height and depth.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>point</strong>
- </td>
- <td class="description last">
- <p>A point in 3D space.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>target</strong>
- </td>
- <td class="description last">
- <p>The target vector that is used to store the method's result.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> A point as a proportion of this box's width, height and depth.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="getSize" translate="no">.<a href="#getSize">getSize</a><span class="signature">( target : <span class="param-type"><a href="Vector3.html">Vector3</a></span> )</span><span class="type-signature"> : <a href="Vector3.html">Vector3</a></span> </h3>
- <div class="method">
- <div class="description">
- <p>Returns the dimensions of this box.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>target</strong>
- </td>
- <td class="description last">
- <p>The target vector that is used to store the method's result.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The size.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="intersect" translate="no">.<a href="#intersect">intersect</a><span class="signature">( box : <span class="param-type"><a href="Box3.html">Box3</a></span> )</span><span class="type-signature"> : <a href="Box3.html">Box3</a></span> </h3>
- <div class="method">
- <div class="description">
- <p>Computes the intersection of this bounding box and the given one, 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. If
- there's no overlap, makes this box empty.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>box</strong>
- </td>
- <td class="description last">
- <p>The bounding box to intersect with.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> A reference to this bounding box.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="intersectsBox" translate="no">.<a href="#intersectsBox">intersectsBox</a><span class="signature">( box : <span class="param-type"><a href="Box3.html">Box3</a></span> )</span><span class="type-signature"> : boolean</span> </h3>
- <div class="method">
- <div class="description">
- <p>Returns <code>true</code> if the given bounding box intersects with this bounding box.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>box</strong>
- </td>
- <td class="description last">
- <p>The bounding box to test.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> Whether the given bounding box intersects with this bounding box.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="intersectsPlane" translate="no">.<a href="#intersectsPlane">intersectsPlane</a><span class="signature">( plane : <span class="param-type"><a href="Plane.html">Plane</a></span> )</span><span class="type-signature"> : boolean</span> </h3>
- <div class="method">
- <div class="description">
- <p>Returns <code>true</code> if the given plane intersects with this bounding box.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>plane</strong>
- </td>
- <td class="description last">
- <p>The plane to test.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> Whether the given plane intersects with this bounding box.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="intersectsSphere" translate="no">.<a href="#intersectsSphere">intersectsSphere</a><span class="signature">( sphere : <span class="param-type"><a href="Sphere.html">Sphere</a></span> )</span><span class="type-signature"> : boolean</span> </h3>
- <div class="method">
- <div class="description">
- <p>Returns <code>true</code> if the given bounding sphere intersects with this bounding box.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>sphere</strong>
- </td>
- <td class="description last">
- <p>The bounding sphere to test.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> Whether the given bounding sphere intersects with this bounding box.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="intersectsTriangle" translate="no">.<a href="#intersectsTriangle">intersectsTriangle</a><span class="signature">( triangle : <span class="param-type"><a href="Triangle.html">Triangle</a></span> )</span><span class="type-signature"> : boolean</span> </h3>
- <div class="method">
- <div class="description">
- <p>Returns <code>true</code> if the given triangle intersects with this bounding box.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>triangle</strong>
- </td>
- <td class="description last">
- <p>The triangle to test.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> Whether the given triangle intersects with this bounding box.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="isEmpty" translate="no">.<a href="#isEmpty">isEmpty</a><span class="signature">()</span><span class="type-signature"> : boolean</span> </h3>
- <div class="method">
- <div class="description">
- <p>Returns true if this box includes zero points within its bounds.
- Note that a box with equal lower and upper bounds still includes one
- point, the one both bounds share.</p>
- </div>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> Whether this box is empty or not.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="makeEmpty" translate="no">.<a href="#makeEmpty">makeEmpty</a><span class="signature">()</span><span class="type-signature"> : <a href="Box3.html">Box3</a></span> </h3>
- <div class="method">
- <div class="description">
- <p>Makes this box empty which means in encloses a zero space in 3D.</p>
- </div>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> A reference to this bounding box.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="set" translate="no">.<a href="#set">set</a><span class="signature">( min : <span class="param-type"><a href="Vector3.html">Vector3</a></span>, max : <span class="param-type"><a href="Vector3.html">Vector3</a></span> )</span><span class="type-signature"> : <a href="Box3.html">Box3</a></span> </h3>
- <div class="method">
- <div class="description">
- <p>Sets the lower and upper boundaries of this box.
- Please note that this method only copies the values from the given objects.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>min</strong>
- </td>
- <td class="description last">
- <p>The lower boundary of the box.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>max</strong>
- </td>
- <td class="description last">
- <p>The upper boundary of the box.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> A reference to this bounding box.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="setFromArray" translate="no">.<a href="#setFromArray">setFromArray</a><span class="signature">( array : <span class="param-type">Array.<number></span> )</span><span class="type-signature"> : <a href="Box3.html">Box3</a></span> </h3>
- <div class="method">
- <div class="description">
- <p>Sets the upper and lower bounds of this box so it encloses the position data
- in the given array.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>array</strong>
- </td>
- <td class="description last">
- <p>An array holding 3D position data.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> A reference to this bounding box.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="setFromBufferAttribute" translate="no">.<a href="#setFromBufferAttribute">setFromBufferAttribute</a><span class="signature">( attribute : <span class="param-type"><a href="BufferAttribute.html">BufferAttribute</a></span> )</span><span class="type-signature"> : <a href="Box3.html">Box3</a></span> </h3>
- <div class="method">
- <div class="description">
- <p>Sets the upper and lower bounds of this box so it encloses the position data
- in the given buffer attribute.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>attribute</strong>
- </td>
- <td class="description last">
- <p>A buffer attribute holding 3D position data.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> A reference to this bounding box.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="setFromCenterAndSize" translate="no">.<a href="#setFromCenterAndSize">setFromCenterAndSize</a><span class="signature">( center : <span class="param-type"><a href="Vector3.html">Vector3</a></span>, size : <span class="param-type"><a href="Vector3.html">Vector3</a></span> )</span><span class="type-signature"> : <a href="Box3.html">Box3</a></span> </h3>
- <div class="method">
- <div class="description">
- <p>Centers this box on the given center vector and sets this box's width, height and
- depth to the given size values.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>center</strong>
- </td>
- <td class="description last">
- <p>The center of the box.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>size</strong>
- </td>
- <td class="description last">
- <p>The x, y and z dimensions of the box.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> A reference to this bounding box.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="setFromObject" translate="no">.<a href="#setFromObject">setFromObject</a><span class="signature">( object : <span class="param-type"><a href="Object3D.html">Object3D</a></span>, precise : <span class="param-type">boolean</span> )</span><span class="type-signature"> : <a href="Box3.html">Box3</a></span> </h3>
- <div class="method">
- <div class="description">
- <p>Computes the world-axis-aligned bounding box for the given 3D object
- (including its children), accounting for the object's, and children's,
- world transforms. The function may result in a larger box than strictly necessary.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>object</strong>
- </td>
- <td class="description last">
- <p>The 3D object to compute the bounding box for.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>precise</strong>
- </td>
- <td class="description last">
- <p>If set to <code>true</code>, the method computes the smallest
- world-axis-aligned bounding box at the expense of more computation.</p>
- <p>Default is <code>false</code>.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> A reference to this bounding box.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="setFromPoints" translate="no">.<a href="#setFromPoints">setFromPoints</a><span class="signature">( points : <span class="param-type">Array.<<a href="Vector3.html">Vector3</a>></span> )</span><span class="type-signature"> : <a href="Box3.html">Box3</a></span> </h3>
- <div class="method">
- <div class="description">
- <p>Sets the upper and lower bounds of this box so it encloses the position data
- in the given array.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>points</strong>
- </td>
- <td class="description last">
- <p>An array holding 3D position data as instances of <a href="Vector3.html">Vector3</a>.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> A reference to this bounding box.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="toJSON" translate="no">.<a href="#toJSON">toJSON</a><span class="signature">()</span><span class="type-signature"> : Object</span> </h3>
- <div class="method">
- <div class="description">
- <p>Returns a serialized structure of the bounding box.</p>
- </div>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> Serialized structure with fields representing the object state.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="translate" translate="no">.<a href="#translate">translate</a><span class="signature">( offset : <span class="param-type"><a href="Vector3.html">Vector3</a></span> )</span><span class="type-signature"> : <a href="Box3.html">Box3</a></span> </h3>
- <div class="method">
- <div class="description">
- <p>Adds the given offset to both the upper and lower bounds of this bounding box,
- effectively moving it in 3D space.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>offset</strong>
- </td>
- <td class="description last">
- <p>The offset that should be used to translate the bounding box.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> A reference to this bounding box.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="union" translate="no">.<a href="#union">union</a><span class="signature">( box : <span class="param-type"><a href="Box3.html">Box3</a></span> )</span><span class="type-signature"> : <a href="Box3.html">Box3</a></span> </h3>
- <div class="method">
- <div class="description">
- <p>Computes the union of this box and another and the given one, 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>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>box</strong>
- </td>
- <td class="description last">
- <p>The bounding box that will be unioned with this instance.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> A reference to this bounding box.</dt>
- </dl>
- </div>
- <h2 class="subsection-title">Source</h2>
- <p>
- <a href="https://github.com/mrdoob/three.js/blob/master/src/math/Box3.js" translate="no" target="_blank" rel="noopener">src/math/Box3.js</a>
- </p>
- </article>
- </section>
- <script src="../scripts/linenumber.js"></script>
- <script src="../scripts/page.js"></script>
- </body>
- </html>
|