OBB.html 4.7 KB

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