1
0

OBB.html 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  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. 表示三维空间中的定向包围盒(OBB)。
  13. </p>
  14. <h2>导入</h2>
  15. <p>
  16. [name] 是一个附加组件,必须显式导入。请参阅 [link:#manual/introduction/Installation Installation / Addons]。
  17. </p>
  18. <code>
  19. import { OBB } from 'three/addons/math/OBB.js';
  20. </code>
  21. <h2>例子</h2>
  22. <p>
  23. [example:webgl_math_obb]
  24. </p>
  25. <h2>构造函数</h2>
  26. <h3>[name]( [param:Vector3 center], [param:Vector3 halfSize], [param:Matrix3 rotation] )</h3>
  27. <p>
  28. [page:Vector3 center] — [name] 的中心。(可选)<br />
  29. [page:Vector3 halfSize] — [name] 沿每个轴的正半宽范围。(可选)<br />
  30. [page:Matrix3 rotation] — [name] 的旋转。(可选)
  31. </p>
  32. <p>
  33. 创建一个新的 [name]。
  34. </p>
  35. <h2>属性</h2>
  36. <h3>[property:Vector3 center]</h3>
  37. <p>
  38. [name] 的中心。默认值为 *( 0, 0, 0 )*。
  39. </p>
  40. <h3>[property:Vector3 halfSize]</h3>
  41. <p>
  42. [name] 沿每个轴的正半宽范围。默认值为 *( 0, 0, 0 )*。
  43. </p>
  44. <h3>[property:Matrix3 rotation]</h3>
  45. <p>
  46. [name] 的旋转。默认为单位矩阵。
  47. </p>
  48. <h2>方法</h2>
  49. <h3>[method:this applyMatrix4]( [param:Matrix4 matrix] )</h3>
  50. <p>
  51. [page:Matrix4 matrix] — 一个 4x4 变换矩阵。
  52. </p>
  53. <p>
  54. 将给定的变换矩阵应用于此 [name]。此方法可用于将包围体与 3D 对象的世界矩阵进行转换,以保持两个实体同步。
  55. </p>
  56. <h3>[method:Vector3 clampPoint]( [param:Vector3 point], [param:Vector3 clampedPoint] )</h3>
  57. <p>
  58. [page:Vector3 point] — 应该被限制在该 [name] 范围内的点。<br />
  59. [page:Matrix3 clampedPoint] — 结果将被复制到此向量中。
  60. </p>
  61. <p>
  62. 将给定点限制在该 [name] 范围内。
  63. </p>
  64. <h3>[method:OBB clone]()</h3>
  65. <p>
  66. 创建此实例的克隆。
  67. </p>
  68. <h3>[method:Boolean containsPoint]( [param:Vector3 point] )</h3>
  69. <p>
  70. [page:Vector3 point] — 要测试的点。
  71. </p>
  72. <p>
  73. 给定点是否位于此 [name] 内。
  74. </p>
  75. <h3>[method:this copy]( [param:OBB obb] )</h3>
  76. <p>
  77. [page:OBB obb] — 要复制的 [name]。
  78. </p>
  79. <p>
  80. 将给定 [name] 的属性复制到此 [name]。
  81. </p>
  82. <h3>[method:Boolean equals]( [param:OBB obb] )</h3>
  83. <p>
  84. [page:OBB obb] — 要测试的 [name]。
  85. </p>
  86. <p>
  87. 给定的 [name] 是否等于此 [name]。
  88. </p>
  89. <h3>[method:this fromBox3]( [param:Box3 box3] )</h3>
  90. <p>
  91. [page:Box3 box3] — AABB
  92. </p>
  93. <p>
  94. 根据给定的 AABB 定义 [name]。
  95. </p>
  96. <h3>[method:Vector3 getSize]( [param:Vector3 size] )</h3>
  97. <p>
  98. [page:Vector3 size] — 结果将被复制到此向量中。
  99. </p>
  100. <p>
  101. 将此 [name] 的大小返回到给定向量中。
  102. </p>
  103. <h3>[method:Boolean intersectsBox3]( [param:Box3 box3] )</h3>
  104. <p>
  105. [page:Box3 box3] — 要测试的 AABB。
  106. </p>
  107. <p>
  108. 给定的 AABB 是否与此 [name] 相交。
  109. </p>
  110. <h3>[method:Boolean intersectsSphere]( [param:Sphere sphere] )</h3>
  111. <p>
  112. [page:Sphere sphere] — 要测试的边界球体。
  113. </p>
  114. <p>
  115. 给定的边界球体是否与此 [name] 相交。
  116. </p>
  117. <h3>[method:Boolean intersectsOBB]( [param:OBB obb], [param:Number epsilon] )</h3>
  118. <p>
  119. [page:OBB obb] — 要测试的 [name]<br />
  120. [page:Number epsilon] — 一个可选的数值,用于抵消算术错误。默认为 `Number.EPSILON`。
  121. </p>
  122. <p>
  123. 给定的 [name] 是否与此 [name] 相交。
  124. </p>
  125. <h3>[method:Boolean intersectsPlane]( [param:Plane plane] )</h3>
  126. <p>
  127. [page:Plane plane] — 要测试的平面。
  128. </p>
  129. <p>
  130. 给定平面是否与此 [name] 相交。
  131. </p>
  132. <h3>[method:Boolean intersectsRay]( [param:Ray ray] )</h3>
  133. <p>
  134. [page:Ray ray] — 要测试的射线。
  135. </p>
  136. <p>
  137. 给定射线是否与此 [name] 相交。
  138. </p>
  139. <h3>[method:Vector3 intersectRay]( [param:Ray ray], [param:Vector3 intersectionPoint] )</h3>
  140. <p>
  141. [page:Ray ray] — 要测试的射线。<br />
  142. [page:Vector3 intersectionPoint] — 结果将被复制到此向量中。
  143. </p>
  144. <p>
  145. 执行 射线/OBB 相交测试并将相交点存储到给定的 3D 向量。如果没有检测到交叉点则返回 `null`。
  146. </p>
  147. <h3>[method:this set]( [param:Vector3 center], [param:Vector3 halfSize], [param:Matrix3 rotation] )</h3>
  148. <p>
  149. [page:Vector3 center] — [name] 的中心。<br />
  150. [page:Vector3 halfSize] — [name] 沿每个轴的正半宽范围。<br />
  151. [page:Matrix3 rotation] — [name] 的旋转。
  152. </p>
  153. <p>
  154. 定义给定值的 [name]。
  155. </p>
  156. <h2>源代码</h2>
  157. <p>
  158. [link:https://github.com/mrdoob/three.js/blob/master/examples/jsm/math/OBB.js examples/jsm/math/OBB.js]
  159. </p>
  160. </body>
  161. </html>