Box3.html 6.9 KB

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