BoundingBoxHelper.html 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8" />
  5. <base href="../../../" />
  6. <script src="list.js"></script>
  7. <script src="page.js"></script>
  8. <link type="text/css" rel="stylesheet" href="page.css" />
  9. </head>
  10. <body>
  11. [page:Mesh] &rarr;
  12. <h1>[name]</h1>
  13. <div class="desc">A helper object to show the world-axis-aligned bounding box for an object.</div>
  14. <h2>Example</h2>
  15. <code>var hex = 0xff0000;
  16. var sphereMaterial = new THREE.MeshLambertMaterial( {color: 0x00ff00} );
  17. var sphere = new THREE.Mesh( new THREE.SphereGeometry( 30, 12, 12), sphereMaterial );
  18. scene.add( sphere );
  19. var bbox = new THREE.BoundingBoxHelper( sphere, hex );
  20. bbox.update();
  21. scene.add( bbox );
  22. </code>
  23. <div>
  24. Note that this helper will create a wireframe [page:Mesh] object with a [page:BoxGeometry];
  25. the resulting bounding box object will therefore have face diagonals. You may want to
  26. use [page:BoxHelper], which generates a [page:LineSegments] object without face diagonals.
  27. </div>
  28. <h2>Constructor</h2>
  29. <h3>[name]( [page:Object3D object], [page:Number hex] )</h3>
  30. <div>
  31. [page:Object3D object] -- Object3D -- the object3D to show the world-axis-aligned boundingbox.<br />
  32. [page:Number hex] -- hexadecimal value that defines the box's color. Default is 0x888888.
  33. </div>
  34. <h2>Properties</h2>
  35. <div>See the base [page:Mesh] class for common properties.</div>
  36. <h3>[property:Object3D object]</h3>
  37. <div>Contains the object3D to show the world-axis-aligned boundingbox.</div>
  38. <h3>[property:Box3 box]</h3>
  39. <div>Contains the bounding box of the object.</div>
  40. <h2>Methods</h2>
  41. <div>See the base [page:LineSegments] class for common methods.</div>
  42. <h3>[method:null update]()</h3>
  43. <div>Updates the BoundingBoxHelper based on the object property.</div>
  44. <h2>Source</h2>
  45. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  46. </body>
  47. </html>