Frustum.html 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334
  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"><a href="Plane.html">Plane</a></span>, p1 : <span class="param-type"><a href="Plane.html">Plane</a></span>, p2 : <span class="param-type"><a href="Plane.html">Plane</a></span>, p3 : <span class="param-type"><a href="Plane.html">Plane</a></span>, p4 : <span class="param-type"><a href="Plane.html">Plane</a></span>, p5 : <span class="param-type"><a href="Plane.html">Plane</a></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">
  32. <strong>p0</strong>
  33. </td>
  34. <td class="description last">
  35. <p>The first plane that encloses the frustum.</p>
  36. </td>
  37. </tr>
  38. <tr>
  39. <td class="name">
  40. <strong>p1</strong>
  41. </td>
  42. <td class="description last">
  43. <p>The second plane that encloses the frustum.</p>
  44. </td>
  45. </tr>
  46. <tr>
  47. <td class="name">
  48. <strong>p2</strong>
  49. </td>
  50. <td class="description last">
  51. <p>The third plane that encloses the frustum.</p>
  52. </td>
  53. </tr>
  54. <tr>
  55. <td class="name">
  56. <strong>p3</strong>
  57. </td>
  58. <td class="description last">
  59. <p>The fourth plane that encloses the frustum.</p>
  60. </td>
  61. </tr>
  62. <tr>
  63. <td class="name">
  64. <strong>p4</strong>
  65. </td>
  66. <td class="description last">
  67. <p>The fifth plane that encloses the frustum.</p>
  68. </td>
  69. </tr>
  70. <tr>
  71. <td class="name">
  72. <strong>p5</strong>
  73. </td>
  74. <td class="description last">
  75. <p>The sixth plane that encloses the frustum.</p>
  76. </td>
  77. </tr>
  78. </tbody>
  79. </table>
  80. </div>
  81. </div>
  82. <h2 class="subsection-title">Properties</h2>
  83. <div class="member">
  84. <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>
  85. <div class="description">
  86. <p>This array holds the planes that enclose the frustum.</p>
  87. </div>
  88. </div>
  89. <h2 class="subsection-title">Methods</h2>
  90. <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>
  91. <div class="method">
  92. <div class="description">
  93. <p>Returns a new frustum with copied values from this instance.</p>
  94. </div>
  95. <dl class="details">
  96. <dt class="tag-returns"><strong>Returns:</strong> A clone of this instance.</dt>
  97. </dl>
  98. </div>
  99. <h3 class="name name-method" id="containsPoint" translate="no">.<a href="#containsPoint">containsPoint</a><span class="signature">( point : <span class="param-type"><a href="Vector3.html">Vector3</a></span> )</span><span class="type-signature"> : boolean</span> </h3>
  100. <div class="method">
  101. <div class="description">
  102. <p>Returns <code>true</code> if the given point lies within the frustum.</p>
  103. </div>
  104. <table class="params">
  105. <tbody>
  106. <tr>
  107. <td class="name">
  108. <strong>point</strong>
  109. </td>
  110. <td class="description last">
  111. <p>The point to test.</p>
  112. </td>
  113. </tr>
  114. </tbody>
  115. </table>
  116. <dl class="details">
  117. <dt class="tag-returns"><strong>Returns:</strong> Whether the point lies within this frustum or not.</dt>
  118. </dl>
  119. </div>
  120. <h3 class="name name-method" id="copy" translate="no">.<a href="#copy">copy</a><span class="signature">( frustum : <span class="param-type"><a href="Frustum.html">Frustum</a></span> )</span><span class="type-signature"> : <a href="Frustum.html">Frustum</a></span> </h3>
  121. <div class="method">
  122. <div class="description">
  123. <p>Copies the values of the given frustum to this instance.</p>
  124. </div>
  125. <table class="params">
  126. <tbody>
  127. <tr>
  128. <td class="name">
  129. <strong>frustum</strong>
  130. </td>
  131. <td class="description last">
  132. <p>The frustum to copy.</p>
  133. </td>
  134. </tr>
  135. </tbody>
  136. </table>
  137. <dl class="details">
  138. <dt class="tag-returns"><strong>Returns:</strong> A reference to this frustum.</dt>
  139. </dl>
  140. </div>
  141. <h3 class="name name-method" id="intersectsBox" translate="no">.<a href="#intersectsBox">intersectsBox</a><span class="signature">( box : <span class="param-type"><a href="Box3.html">Box3</a></span> )</span><span class="type-signature"> : boolean</span> </h3>
  142. <div class="method">
  143. <div class="description">
  144. <p>Returns <code>true</code> if the given bounding box is intersecting this frustum.</p>
  145. </div>
  146. <table class="params">
  147. <tbody>
  148. <tr>
  149. <td class="name">
  150. <strong>box</strong>
  151. </td>
  152. <td class="description last">
  153. <p>The bounding box to test.</p>
  154. </td>
  155. </tr>
  156. </tbody>
  157. </table>
  158. <dl class="details">
  159. <dt class="tag-returns"><strong>Returns:</strong> Whether the bounding box is intersecting this frustum or not.</dt>
  160. </dl>
  161. </div>
  162. <h3 class="name name-method" id="intersectsObject" translate="no">.<a href="#intersectsObject">intersectsObject</a><span class="signature">( object : <span class="param-type"><a href="Object3D.html">Object3D</a></span> )</span><span class="type-signature"> : boolean</span> </h3>
  163. <div class="method">
  164. <div class="description">
  165. <p>Returns <code>true</code> if the 3D object's bounding sphere is intersecting this frustum.</p>
  166. <p>Note that the 3D object must have a geometry so that the bounding sphere can be calculated.</p>
  167. </div>
  168. <table class="params">
  169. <tbody>
  170. <tr>
  171. <td class="name">
  172. <strong>object</strong>
  173. </td>
  174. <td class="description last">
  175. <p>The 3D object to test.</p>
  176. </td>
  177. </tr>
  178. </tbody>
  179. </table>
  180. <dl class="details">
  181. <dt class="tag-returns"><strong>Returns:</strong> Whether the 3D object's bounding sphere is intersecting this frustum or not.</dt>
  182. </dl>
  183. </div>
  184. <h3 class="name name-method" id="intersectsSphere" translate="no">.<a href="#intersectsSphere">intersectsSphere</a><span class="signature">( sphere : <span class="param-type"><a href="Sphere.html">Sphere</a></span> )</span><span class="type-signature"> : boolean</span> </h3>
  185. <div class="method">
  186. <div class="description">
  187. <p>Returns <code>true</code> if the given bounding sphere is intersecting this frustum.</p>
  188. </div>
  189. <table class="params">
  190. <tbody>
  191. <tr>
  192. <td class="name">
  193. <strong>sphere</strong>
  194. </td>
  195. <td class="description last">
  196. <p>The bounding sphere to test.</p>
  197. </td>
  198. </tr>
  199. </tbody>
  200. </table>
  201. <dl class="details">
  202. <dt class="tag-returns"><strong>Returns:</strong> Whether the bounding sphere is intersecting this frustum or not.</dt>
  203. </dl>
  204. </div>
  205. <h3 class="name name-method" id="intersectsSprite" translate="no">.<a href="#intersectsSprite">intersectsSprite</a><span class="signature">( sprite : <span class="param-type"><a href="Sprite.html">Sprite</a></span> )</span><span class="type-signature"> : boolean</span> </h3>
  206. <div class="method">
  207. <div class="description">
  208. <p>Returns <code>true</code> if the given sprite is intersecting this frustum.</p>
  209. </div>
  210. <table class="params">
  211. <tbody>
  212. <tr>
  213. <td class="name">
  214. <strong>sprite</strong>
  215. </td>
  216. <td class="description last">
  217. <p>The sprite to test.</p>
  218. </td>
  219. </tr>
  220. </tbody>
  221. </table>
  222. <dl class="details">
  223. <dt class="tag-returns"><strong>Returns:</strong> Whether the sprite is intersecting this frustum or not.</dt>
  224. </dl>
  225. </div>
  226. <h3 class="name name-method" id="set" translate="no">.<a href="#set">set</a><span class="signature">( p0 : <span class="param-type"><a href="Plane.html">Plane</a></span>, p1 : <span class="param-type"><a href="Plane.html">Plane</a></span>, p2 : <span class="param-type"><a href="Plane.html">Plane</a></span>, p3 : <span class="param-type"><a href="Plane.html">Plane</a></span>, p4 : <span class="param-type"><a href="Plane.html">Plane</a></span>, p5 : <span class="param-type"><a href="Plane.html">Plane</a></span> )</span><span class="type-signature"> : <a href="Frustum.html">Frustum</a></span> </h3>
  227. <div class="method">
  228. <div class="description">
  229. <p>Sets the frustum planes by copying the given planes.</p>
  230. </div>
  231. <table class="params">
  232. <tbody>
  233. <tr>
  234. <td class="name">
  235. <strong>p0</strong>
  236. </td>
  237. <td class="description last">
  238. <p>The first plane that encloses the frustum.</p>
  239. </td>
  240. </tr>
  241. <tr>
  242. <td class="name">
  243. <strong>p1</strong>
  244. </td>
  245. <td class="description last">
  246. <p>The second plane that encloses the frustum.</p>
  247. </td>
  248. </tr>
  249. <tr>
  250. <td class="name">
  251. <strong>p2</strong>
  252. </td>
  253. <td class="description last">
  254. <p>The third plane that encloses the frustum.</p>
  255. </td>
  256. </tr>
  257. <tr>
  258. <td class="name">
  259. <strong>p3</strong>
  260. </td>
  261. <td class="description last">
  262. <p>The fourth plane that encloses the frustum.</p>
  263. </td>
  264. </tr>
  265. <tr>
  266. <td class="name">
  267. <strong>p4</strong>
  268. </td>
  269. <td class="description last">
  270. <p>The fifth plane that encloses the frustum.</p>
  271. </td>
  272. </tr>
  273. <tr>
  274. <td class="name">
  275. <strong>p5</strong>
  276. </td>
  277. <td class="description last">
  278. <p>The sixth plane that encloses the frustum.</p>
  279. </td>
  280. </tr>
  281. </tbody>
  282. </table>
  283. <dl class="details">
  284. <dt class="tag-returns"><strong>Returns:</strong> A reference to this frustum.</dt>
  285. </dl>
  286. </div>
  287. <h3 class="name name-method" id="setFromProjectionMatrix" translate="no">.<a href="#setFromProjectionMatrix">setFromProjectionMatrix</a><span class="signature">( m : <span class="param-type"><a href="Matrix4.html">Matrix4</a></span>, coordinateSystem : <span class="param-type"><a href="global.html#WebGLCoordinateSystem">WebGLCoordinateSystem</a> | <a href="global.html#WebGPUCoordinateSystem">WebGPUCoordinateSystem</a></span>, reversedDepth : <span class="param-type">boolean</span> )</span><span class="type-signature"> : <a href="Frustum.html">Frustum</a></span> </h3>
  288. <div class="method">
  289. <div class="description">
  290. <p>Sets the frustum planes from the given projection matrix.</p>
  291. </div>
  292. <table class="params">
  293. <tbody>
  294. <tr>
  295. <td class="name">
  296. <strong>m</strong>
  297. </td>
  298. <td class="description last">
  299. <p>The projection matrix.</p>
  300. </td>
  301. </tr>
  302. <tr>
  303. <td class="name">
  304. <strong>coordinateSystem</strong>
  305. </td>
  306. <td class="description last">
  307. <p>The coordinate system.</p>
  308. </td>
  309. </tr>
  310. <tr>
  311. <td class="name">
  312. <strong>reversedDepth</strong>
  313. </td>
  314. <td class="description last">
  315. <p>Whether to use a reversed depth.</p>
  316. <p>Default is <code>false</code>.</p>
  317. </td>
  318. </tr>
  319. </tbody>
  320. </table>
  321. <dl class="details">
  322. <dt class="tag-returns"><strong>Returns:</strong> A reference to this frustum.</dt>
  323. </dl>
  324. </div>
  325. <h2 class="subsection-title">Source</h2>
  326. <p>
  327. <a href="https://github.com/mrdoob/three.js/blob/master/src/math/Frustum.js" translate="no" target="_blank" rel="noopener">src/math/Frustum.js</a>
  328. </p>
  329. </article>
  330. </section>
  331. <script src="../scripts/linenumber.js"></script>
  332. <script src="../scripts/page.js"></script>
  333. </body>
  334. </html>
粤ICP备19079148号