1
0

OBB.html 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8" />
  5. <base href="../../../" />
  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. <p class="desc">
  12. Represents an oriented bounding box (OBB) in 3D space.
  13. </p>
  14. <h2>Import</h2>
  15. <p>
  16. [name] is an add-on, and must be imported explicitly.
  17. See [link:#manual/introduction/Installation Installation / Addons].
  18. </p>
  19. <code>
  20. import { OBB } from 'three/addons/math/OBB.js';
  21. </code>
  22. <h2>Examples</h2>
  23. <p>
  24. [example:webgl_math_obb]
  25. </p>
  26. <h2>Constructor</h2>
  27. <h3>[name]( [param:Vector3 center], [param:Vector3 halfSize], [param:Matrix3 rotation] )</h3>
  28. <p>
  29. [page:Vector3 center] — The center of the [name]. (optional)<br />
  30. [page:Vector3 halfSize] — Positive halfwidth extents of the [name] along each axis. (optional)<br />
  31. [page:Matrix3 rotation] — The rotation of the [name]. (optional)
  32. </p>
  33. <p>
  34. Creates a new [name].
  35. </p>
  36. <h2>Properties</h2>
  37. <h3>[property:Vector3 center]</h3>
  38. <p>
  39. The center of the [name]. Default is *( 0, 0, 0 )*.
  40. </p>
  41. <h3>[property:Vector3 halfSize]</h3>
  42. <p>
  43. Positive halfwidth extents of the [name] along each axis. Default is *( 0, 0, 0 )*.
  44. </p>
  45. <h3>[property:Matrix3 rotation]</h3>
  46. <p>
  47. The rotation of the [name]. Default is the identity matrix.
  48. </p>
  49. <h2>Methods</h2>
  50. <h3>[method:this applyMatrix4]( [param:Matrix4 matrix] )</h3>
  51. <p>
  52. [page:Matrix4 matrix] — A 4x4 transformation matrix.
  53. </p>
  54. <p>
  55. Applies the given transformation matrix to this [name]. This method can be used to transform the
  56. bounding volume with the world matrix of a 3D object in order to keep both entities in sync.
  57. </p>
  58. <h3>[method:Vector3 clampPoint]( [param:Vector3 point], [param:Vector3 clampedPoint] )</h3>
  59. <p>
  60. [page:Vector3 point] — The point that should be clamped within the bounds of this [name].<br />
  61. [page:Matrix3 clampedPoint] — The result will be copied into this vector.
  62. </p>
  63. <p>
  64. Clamps the given point within the bounds of this [name].
  65. </p>
  66. <h3>[method:OBB clone]()</h3>
  67. <p>
  68. Creates a cloned [name] for this instance.
  69. </p>
  70. <h3>[method:Boolean containsPoint]( [param:Vector3 point] )</h3>
  71. <p>
  72. [page:Vector3 point] — The point to test.
  73. </p>
  74. <p>
  75. Whether the given point lies within this [name] or not.
  76. </p>
  77. <h3>[method:this copy]( [param:OBB obb] )</h3>
  78. <p>
  79. [page:OBB obb] — The [name] to copy.
  80. </p>
  81. <p>
  82. Copies the properties of the given [name] to this [name].
  83. </p>
  84. <h3>[method:Boolean equals]( [param:OBB obb] )</h3>
  85. <p>
  86. [page:OBB obb] — The [name] to test.
  87. </p>
  88. <p>
  89. Whether the given [name] is equal to this [name] or not.
  90. </p>
  91. <h3>[method:this fromBox3]( [param:Box3 box3] )</h3>
  92. <p>
  93. [page:Box3 box3] — An AABB.
  94. </p>
  95. <p>
  96. Defines an [name] based on the given AABB.
  97. </p>
  98. <h3>[method:Vector3 getSize]( [param:Vector3 size] )</h3>
  99. <p>
  100. [page:Vector3 size] — The result will be copied into this vector.
  101. </p>
  102. <p>
  103. Returns the size of this [name] into the given vector.
  104. </p>
  105. <h3>[method:Boolean intersectsBox3]( [param:Box3 box3] )</h3>
  106. <p>
  107. [page:Box3 box3] — The AABB to test.
  108. </p>
  109. <p>
  110. Whether the given AABB intersects this [name] or not.
  111. </p>
  112. <h3>[method:Boolean intersectsSphere]( [param:Sphere sphere] )</h3>
  113. <p>
  114. [page:Sphere sphere] — The bounding sphere to test.
  115. </p>
  116. <p>
  117. Whether the given bounding sphere intersects this [name] or not.
  118. </p>
  119. <h3>[method:Boolean intersectsOBB]( [param:OBB obb], [param:Number epsilon] )</h3>
  120. <p>
  121. [page:OBB obb] — The OBB to test.<br />
  122. [page:Number epsilon] — An optional numeric value to counteract arithmetic errors. Default is `Number.EPSILON`.
  123. </p>
  124. <p>
  125. Whether the given [name] intersects this [name] or not.
  126. </p>
  127. <h3>[method:Boolean intersectsPlane]( [param:Plane plane] )</h3>
  128. <p>
  129. [page:Plane plane] — The plane to test.
  130. </p>
  131. <p>
  132. Whether the given plane intersects this [name] or not.
  133. </p>
  134. <h3>[method:Boolean intersectsRay]( [param:Ray ray] )</h3>
  135. <p>
  136. [page:Ray ray] — The ray to test.
  137. </p>
  138. <p>
  139. Whether the given ray intersects this [name] or not.
  140. </p>
  141. <h3>[method:Vector3 intersectRay]( [param:Ray ray], [param:Vector3 intersectionPoint] )</h3>
  142. <p>
  143. [page:Ray ray] — The ray to test.<br />
  144. [page:Vector3 intersectionPoint] — The result will be copied into this vector.
  145. </p>
  146. <p>
  147. Performs a Ray/OBB intersection test and stores the intersection point to the given 3D vector.
  148. If no intersection is detected, `null` is returned.
  149. </p>
  150. <h3>[method:this set]( [param:Vector3 center], [param:Vector3 halfSize], [param:Matrix3 rotation] )</h3>
  151. <p>
  152. [page:Vector3 center] — The center of the [name].<br />
  153. [page:Vector3 halfSize] — Positive halfwidth extents of the [name] along each axis.<br />
  154. [page:Matrix3 rotation] — The rotation of the [name].
  155. </p>
  156. <p>
  157. Defines the [name] for the given values.
  158. </p>
  159. <h2>Source</h2>
  160. <p>
  161. [link:https://github.com/mrdoob/three.js/blob/master/examples/jsm/math/OBB.js examples/jsm/math/OBB.js]
  162. </p>
  163. </body>
  164. </html>