Box2.html 5.9 KB

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