Box3.html 8.4 KB

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