Frustum.html 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>Frustum - Three.js Docs</title>
  6. <meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
  7. <script src="../scripts/highlight.min.js"></script>
  8. <link type="text/css" rel="stylesheet" href="../styles/highlight-three.css">
  9. <link type="text/css" rel="stylesheet" href="../styles/page.css">
  10. </head>
  11. <body>
  12. <h1 translate="no">Frustum</h1>
  13. <section>
  14. <header>
  15. <div class="class-description"><p>Frustums are used to determine what is inside the camera's field of view.
  16. They help speed up the rendering process - objects which lie outside a camera's
  17. frustum can safely be excluded from rendering.</p>
  18. <p>This class is mainly intended for use internally by a renderer.</p></div>
  19. </header>
  20. <article>
  21. <div class="container-overview">
  22. <h2>Constructor</h2>
  23. <h3 class="name name-method" id="Frustum" translate="no">new <a href="#Frustum">Frustum</a><span class="signature">( p0 : <span class="param-type">Plane</span>, p1 : <span class="param-type">Plane</span>, p2 : <span class="param-type">Plane</span>, p3 : <span class="param-type">Plane</span>, p4 : <span class="param-type">Plane</span>, p5 : <span class="param-type">Plane</span> )</span> </h3>
  24. <div class="method">
  25. <div class="description">
  26. <p>Constructs a new frustum.</p>
  27. </div>
  28. <table class="params">
  29. <tbody>
  30. <tr>
  31. <td class="name"><code>p0</code></td>
  32. <td class="description last"><p>The first plane that encloses the frustum.</p></td>
  33. </tr>
  34. <tr>
  35. <td class="name"><code>p1</code></td>
  36. <td class="description last"><p>The second plane that encloses the frustum.</p></td>
  37. </tr>
  38. <tr>
  39. <td class="name"><code>p2</code></td>
  40. <td class="description last"><p>The third plane that encloses the frustum.</p></td>
  41. </tr>
  42. <tr>
  43. <td class="name"><code>p3</code></td>
  44. <td class="description last"><p>The fourth plane that encloses the frustum.</p></td>
  45. </tr>
  46. <tr>
  47. <td class="name"><code>p4</code></td>
  48. <td class="description last"><p>The fifth plane that encloses the frustum.</p></td>
  49. </tr>
  50. <tr>
  51. <td class="name"><code>p5</code></td>
  52. <td class="description last"><p>The sixth plane that encloses the frustum.</p></td>
  53. </tr>
  54. </tbody>
  55. </table>
  56. </div>
  57. </div>
  58. <h2 class="subsection-title">Properties</h2>
  59. <div class="member">
  60. <h3 class="name" id="planes" translate="no">.<a href="#planes">planes</a><span class="type-signature"> : Array.&lt;<a href="Plane.html">Plane</a>></span> </h3>
  61. <div class="description">
  62. <p>This array holds the planes that enclose the frustum.</p>
  63. </div>
  64. </div>
  65. <h2 class="subsection-title">Methods</h2>
  66. <h3 class="name name-method" id="clone" translate="no">.<a href="#clone">clone</a><span class="signature">()</span><span class="type-signature"> : <a href="Frustum.html">Frustum</a></span> </h3>
  67. <div class="method">
  68. <div class="description">
  69. <p>Returns a new frustum with copied values from this instance.</p>
  70. </div>
  71. <dl class="details">
  72. <dt class="tag-returns"><strong>Returns:</strong> A clone of this instance.</dt>
  73. </dl>
  74. </div>
  75. <h3 class="name name-method" id="containsPoint" translate="no">.<a href="#containsPoint">containsPoint</a><span class="signature">( point : <span class="param-type">Vector3</span> )</span><span class="type-signature"> : boolean</span> </h3>
  76. <div class="method">
  77. <div class="description">
  78. <p>Returns <code>true</code> if the given point lies within the frustum.</p>
  79. </div>
  80. <table class="params">
  81. <tbody>
  82. <tr>
  83. <td class="name"><code>point</code></td>
  84. <td class="description last"><p>The point to test.</p></td>
  85. </tr>
  86. </tbody>
  87. </table>
  88. <dl class="details">
  89. <dt class="tag-returns"><strong>Returns:</strong> Whether the point lies within this frustum or not.</dt>
  90. </dl>
  91. </div>
  92. <h3 class="name name-method" id="copy" translate="no">.<a href="#copy">copy</a><span class="signature">( frustum : <span class="param-type">Frustum</span> )</span><span class="type-signature"> : <a href="Frustum.html">Frustum</a></span> </h3>
  93. <div class="method">
  94. <div class="description">
  95. <p>Copies the values of the given frustum to this instance.</p>
  96. </div>
  97. <table class="params">
  98. <tbody>
  99. <tr>
  100. <td class="name"><code>frustum</code></td>
  101. <td class="description last"><p>The frustum to copy.</p></td>
  102. </tr>
  103. </tbody>
  104. </table>
  105. <dl class="details">
  106. <dt class="tag-returns"><strong>Returns:</strong> A reference to this frustum.</dt>
  107. </dl>
  108. </div>
  109. <h3 class="name name-method" id="intersectsBox" translate="no">.<a href="#intersectsBox">intersectsBox</a><span class="signature">( box : <span class="param-type">Box3</span> )</span><span class="type-signature"> : boolean</span> </h3>
  110. <div class="method">
  111. <div class="description">
  112. <p>Returns <code>true</code> if the given bounding box is intersecting this frustum.</p>
  113. </div>
  114. <table class="params">
  115. <tbody>
  116. <tr>
  117. <td class="name"><code>box</code></td>
  118. <td class="description last"><p>The bounding box to test.</p></td>
  119. </tr>
  120. </tbody>
  121. </table>
  122. <dl class="details">
  123. <dt class="tag-returns"><strong>Returns:</strong> Whether the bounding box is intersecting this frustum or not.</dt>
  124. </dl>
  125. </div>
  126. <h3 class="name name-method" id="intersectsObject" translate="no">.<a href="#intersectsObject">intersectsObject</a><span class="signature">( object : <span class="param-type">Object3D</span> )</span><span class="type-signature"> : boolean</span> </h3>
  127. <div class="method">
  128. <div class="description">
  129. <p>Returns <code>true</code> if the 3D object's bounding sphere is intersecting this frustum.</p>
  130. <p>Note that the 3D object must have a geometry so that the bounding sphere can be calculated.</p>
  131. </div>
  132. <table class="params">
  133. <tbody>
  134. <tr>
  135. <td class="name"><code>object</code></td>
  136. <td class="description last"><p>The 3D object to test.</p></td>
  137. </tr>
  138. </tbody>
  139. </table>
  140. <dl class="details">
  141. <dt class="tag-returns"><strong>Returns:</strong> Whether the 3D object's bounding sphere is intersecting this frustum or not.</dt>
  142. </dl>
  143. </div>
  144. <h3 class="name name-method" id="intersectsSphere" translate="no">.<a href="#intersectsSphere">intersectsSphere</a><span class="signature">( sphere : <span class="param-type">Sphere</span> )</span><span class="type-signature"> : boolean</span> </h3>
  145. <div class="method">
  146. <div class="description">
  147. <p>Returns <code>true</code> if the given bounding sphere is intersecting this frustum.</p>
  148. </div>
  149. <table class="params">
  150. <tbody>
  151. <tr>
  152. <td class="name"><code>sphere</code></td>
  153. <td class="description last"><p>The bounding sphere to test.</p></td>
  154. </tr>
  155. </tbody>
  156. </table>
  157. <dl class="details">
  158. <dt class="tag-returns"><strong>Returns:</strong> Whether the bounding sphere is intersecting this frustum or not.</dt>
  159. </dl>
  160. </div>
  161. <h3 class="name name-method" id="intersectsSprite" translate="no">.<a href="#intersectsSprite">intersectsSprite</a><span class="signature">( sprite : <span class="param-type">Sprite</span> )</span><span class="type-signature"> : boolean</span> </h3>
  162. <div class="method">
  163. <div class="description">
  164. <p>Returns <code>true</code> if the given sprite is intersecting this frustum.</p>
  165. </div>
  166. <table class="params">
  167. <tbody>
  168. <tr>
  169. <td class="name"><code>sprite</code></td>
  170. <td class="description last"><p>The sprite to test.</p></td>
  171. </tr>
  172. </tbody>
  173. </table>
  174. <dl class="details">
  175. <dt class="tag-returns"><strong>Returns:</strong> Whether the sprite is intersecting this frustum or not.</dt>
  176. </dl>
  177. </div>
  178. <h3 class="name name-method" id="set" translate="no">.<a href="#set">set</a><span class="signature">( p0 : <span class="param-type">Plane</span>, p1 : <span class="param-type">Plane</span>, p2 : <span class="param-type">Plane</span>, p3 : <span class="param-type">Plane</span>, p4 : <span class="param-type">Plane</span>, p5 : <span class="param-type">Plane</span> )</span><span class="type-signature"> : <a href="Frustum.html">Frustum</a></span> </h3>
  179. <div class="method">
  180. <div class="description">
  181. <p>Sets the frustum planes by copying the given planes.</p>
  182. </div>
  183. <table class="params">
  184. <tbody>
  185. <tr>
  186. <td class="name"><code>p0</code></td>
  187. <td class="description last"><p>The first plane that encloses the frustum.</p></td>
  188. </tr>
  189. <tr>
  190. <td class="name"><code>p1</code></td>
  191. <td class="description last"><p>The second plane that encloses the frustum.</p></td>
  192. </tr>
  193. <tr>
  194. <td class="name"><code>p2</code></td>
  195. <td class="description last"><p>The third plane that encloses the frustum.</p></td>
  196. </tr>
  197. <tr>
  198. <td class="name"><code>p3</code></td>
  199. <td class="description last"><p>The fourth plane that encloses the frustum.</p></td>
  200. </tr>
  201. <tr>
  202. <td class="name"><code>p4</code></td>
  203. <td class="description last"><p>The fifth plane that encloses the frustum.</p></td>
  204. </tr>
  205. <tr>
  206. <td class="name"><code>p5</code></td>
  207. <td class="description last"><p>The sixth plane that encloses the frustum.</p></td>
  208. </tr>
  209. </tbody>
  210. </table>
  211. <dl class="details">
  212. <dt class="tag-returns"><strong>Returns:</strong> A reference to this frustum.</dt>
  213. </dl>
  214. </div>
  215. <h3 class="name name-method" id="setFromProjectionMatrix" translate="no">.<a href="#setFromProjectionMatrix">setFromProjectionMatrix</a><span class="signature">( m : <span class="param-type">Matrix4</span>, coordinateSystem : <span class="param-type">WebGLCoordinateSystem | WebGPUCoordinateSystem</span>, reversedDepth : <span class="param-type">boolean</span> )</span><span class="type-signature"> : <a href="Frustum.html">Frustum</a></span> </h3>
  216. <div class="method">
  217. <div class="description">
  218. <p>Sets the frustum planes from the given projection matrix.</p>
  219. </div>
  220. <table class="params">
  221. <tbody>
  222. <tr>
  223. <td class="name"><code>m</code></td>
  224. <td class="description last"><p>The projection matrix.</p></td>
  225. </tr>
  226. <tr>
  227. <td class="name"><code>coordinateSystem</code></td>
  228. <td class="description last"><p>The coordinate system.</p></td>
  229. </tr>
  230. <tr>
  231. <td class="name"><code>reversedDepth</code></td>
  232. <td class="description last"><p>Whether to use a reversed depth.<br/>Default is <code>false</code>.</p></td>
  233. </tr>
  234. </tbody>
  235. </table>
  236. <dl class="details">
  237. <dt class="tag-returns"><strong>Returns:</strong> A reference to this frustum.</dt>
  238. </dl>
  239. </div>
  240. <h2 class="subsection-title">Source</h2>
  241. <p>
  242. <a href="https://github.com/mrdoob/three.js/blob/master/src/math/Frustum.js" target="_blank" rel="noopener" translate="no">src/math/Frustum.js</a>
  243. </p>
  244. </article>
  245. </section>
  246. <script src="../scripts/linenumber.js"></script>
  247. <script src="../scripts/page.js"></script>
  248. </body>
  249. </html>
粤ICP备19079148号