Box2.html 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  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 2D space.</div>
  13. <h2>Constructor</h2>
  14. <h3>[name]( [page:Vector2 min], [page:Vector2 max] )</h3>
  15. <div>
  16. min -- Lower (x, y) boundary of the box.<br>
  17. max -- Upper (x, y) 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:Vector2 min]</h3>
  24. <div>
  25. Lower (x, y) boundary of this box.
  26. </div>
  27. <h3>[property:Vector2 max]</h3>
  28. <div>
  29. Upper (x, y) boundary of this box.
  30. </div>
  31. <h2>Methods</h2>
  32. <h3>[method:Box2 set]( [page:Vector2 min], [page:Vector2 max] ) [page:Box2 this]</h3>
  33. <div>
  34. min -- Lower (x, y) boundary of the box. <br>
  35. max -- Upper (x, y) boundary of the box.
  36. </div>
  37. <div>
  38. Sets the lower and upper (x, y) boundaries of this box.
  39. </div>
  40. <h3>[method:Box2 expandByPoint]( [page:Vector2 point] ) [page:Box2 this]</h3>
  41. <div>
  42. point -- Point that should be included in the box.
  43. </div>
  44. <div>
  45. Expands the boundaries of this box to include *point*.
  46. </div>
  47. <h3>[method:Vector2 clampPoint]( [page:Vector2 point], [page:Vector2 optionalTarget] ) [page:Box2 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:Box2 box] ) [page:Box2 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:Box2 setFromPoints]( [page:Array points] ) [page:Box2 this]</h3>
  63. <div>
  64. points -- Set of points that the resulting box will envelop.
  65. </div>
  66. <div>
  67. Sets the upper and lower bounds of this box to include all of the points in *points*.
  68. </div>
  69. <h3>[method:Vector2 getSize]( [page:Vector2 optionalTarget] ) [page:Box2 this]</h3>
  70. <div>
  71. optionalTarget -- If specified, the result will be copied here.
  72. </div>
  73. <div>
  74. Returns the width and height of this box.
  75. </div>
  76. <h3>[method:Box2 union]( [page:Box2 box] ) [page:Box2 this]</h3>
  77. <div>
  78. box -- Box that will be unioned with this box.
  79. </div>
  80. <div>
  81. Unions this box with *box* setting the upper bound of this box to the greater of the <br>
  82. two boxes' upper bounds and the lower bound of this box to the lesser of the two boxes' <br>
  83. lower bounds.
  84. </div>
  85. <h3>[method:Vector2 getParameter]( [page:Vector2 point], [page:Vector2 optionalTarget] ) [page:Box2 this]</h3>
  86. <div>
  87. point -- [page:Vector2]<br/>
  88. optionalTarget -- [page:Vector2]<br/>
  89. </div>
  90. <div>
  91. Returns a point as a proportion of this box's width and height.
  92. </div>
  93. <h3>[method:Box2 expandByScalar]( [page:float scalar] ) [page:Box2 this]</h3>
  94. <div>
  95. scalar -- Distance to expand.
  96. </div>
  97. <div>
  98. Expands each dimension of the box by *scalar*. If negative, the dimensions of the box <br>
  99. will be contracted.
  100. </div>
  101. <h3>[method:Box2 intersect]( [page:Box2 box] ) [page:Box2 this]</h3>
  102. <div>
  103. box -- Box to intersect with.
  104. </div>
  105. <div>
  106. Returns the intersection of this and *box*, setting the upper bound of this box to the lesser <br>
  107. of the two boxes' upper bounds and the lower bound of this box to the greater of the two boxes' <br>
  108. lower bounds.
  109. </div>
  110. <h3>[method:Boolean containsBox]( [page:Box2 box] ) [page:Box2 this]</h3>
  111. <div>
  112. box -- Box to test for inclusion.
  113. </div>
  114. <div>
  115. Returns true if this box includes the entirety of *box*. If this and *box* overlap exactly, <br>
  116. this function also returns true.
  117. </div>
  118. <h3>[method:Box2 translate]( [page:Vector2 offset] ) [page:Box2 this]</h3>
  119. <div>
  120. offset -- Direction and distance of offset.
  121. </div>
  122. <div>
  123. Adds *offset* to both the upper and lower bounds of this box, effectively moving this box <br>
  124. *offset* units in 2D space.
  125. </div>
  126. <h3>[method:Boolean isEmpty]() [page:Box2 this]</h3>
  127. <div>
  128. Returns true if this box includes zero points within its bounds.<br>
  129. Note that a box with equal lower and upper bounds still includes one point, the <br>
  130. one both bounds share.
  131. </div>
  132. <h3>[method:Box2 clone]() [page:Box2 this]</h3>
  133. <div>
  134. Returns a copy of this box.
  135. </div>
  136. <h3>[method:Boolean equals]( [page:Box2 box] ) [page:Box2 this]</h3>
  137. <div>
  138. box -- Box to compare.
  139. </div>
  140. <div>
  141. Returns true if this box and *box* share the same lower and upper bounds.
  142. </div>
  143. <h3>[method:Box2 expandByVector]( [page:Vector2 vector] ) [page:Box2 this]</h3>
  144. <div>
  145. vector -- Amount to expand this box in each dimension.
  146. </div>
  147. <div>
  148. Expands this box equilaterally by *vector*. The width of this box will be <br>
  149. expanded by the x component of *vector* in both directions. The height of <br>
  150. this box will be expanded by the y component of *vector* in both directions.
  151. </div>
  152. <h3>[method:Box2 copy]( [page:Box2 box] ) [page:Box2 this]</h3>
  153. <div>
  154. box -- Box to copy.
  155. </div>
  156. <div>
  157. Copies the values of *box* to this box.
  158. </div>
  159. <h3>[method:Box2 makeEmpty]() [page:Box2 this]</h3>
  160. <div>
  161. Makes this box empty.
  162. </div>
  163. <h3>[method:Vector2 getCenter]( [page:Vector2 optionalTarget] ) [page:Box2 this]</h3>
  164. <div>
  165. optionalTarget -- If specified, the result will be copied here.
  166. </div>
  167. <div>
  168. Returns the center point of this box.
  169. </div>
  170. <h3>[method:Float distanceToPoint]( [page:Vector2 point] ) [page:Box2 this]</h3>
  171. <div>
  172. point -- Point to measure distance to.
  173. </div>
  174. <div>
  175. Returns the distance from any edge of this box to the specified point. <br>
  176. If the point lies inside of this box, the distance will be 0.
  177. </div>
  178. <h3>[method:Boolean containsPoint]( [page:Vector2 point] ) [page:Box2 this]</h3>
  179. <div>
  180. point -- [page:Vector2] to check for inclusion.
  181. </div>
  182. <div>
  183. Returns true if the specified point lies within the boundaries of this box.
  184. </div>
  185. <h3>[method:Box2 setFromCenterAndSize]( [page:Vector2 center], [page:Vector2 size] ) [page:Box2 this]</h3>
  186. <div>
  187. center -- Desired center position of the box. <br>
  188. size -- Desired x and y dimensions of the box.
  189. </div>
  190. <div>
  191. Centers this box on *center* and sets this box's width and height to the values specified <br>
  192. in *size*.
  193. </div>
  194. <h2>Source</h2>
  195. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  196. </body>
  197. </html>