CatmullRomCurve3.html 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>CatmullRomCurve3 - 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. <p class="inheritance" translate="no"><a href="Curve.html">Curve</a> → </p>
  13. <h1 translate="no">CatmullRomCurve3</h1>
  14. <section>
  15. <header>
  16. <div class="class-description"><p>A curve representing a Catmull-Rom spline.</p></div>
  17. <h2>Code Example</h2>
  18. <div translate="no"><pre><code class="language-js">//Create a closed wavey loop
  19. const curve = new THREE.CatmullRomCurve3( [
  20. new THREE.Vector3( -10, 0, 10 ),
  21. new THREE.Vector3( -5, 5, 5 ),
  22. new THREE.Vector3( 0, 0, 0 ),
  23. new THREE.Vector3( 5, -5, 5 ),
  24. new THREE.Vector3( 10, 0, 10 )
  25. ] );
  26. const points = curve.getPoints( 50 );
  27. const geometry = new THREE.BufferGeometry().setFromPoints( points );
  28. const material = new THREE.LineBasicMaterial( { color: 0xff0000 } );
  29. // Create the final object to add to the scene
  30. const curveObject = new THREE.Line( geometry, material );
  31. </code></pre></div>
  32. </header>
  33. <article>
  34. <div class="container-overview">
  35. <h2>Constructor</h2>
  36. <h3 class="name name-method" id="CatmullRomCurve3" translate="no">new <a href="#CatmullRomCurve3">CatmullRomCurve3</a><span class="signature">( points : <span class="param-type">Array.&lt;<a href="Vector3.html">Vector3</a>></span>, closed : <span class="param-type">boolean</span>, curveType : <span class="param-type">'centripetal' | 'chordal' | 'catmullrom'</span>, tension : <span class="param-type">number</span> )</span> </h3>
  37. <div class="method">
  38. <div class="description">
  39. <p>Constructs a new Catmull-Rom curve.</p>
  40. </div>
  41. <table class="params">
  42. <tbody>
  43. <tr>
  44. <td class="name">
  45. <strong>points</strong>
  46. </td>
  47. <td class="description last">
  48. <p>An array of 3D points defining the curve.</p>
  49. </td>
  50. </tr>
  51. <tr>
  52. <td class="name">
  53. <strong>closed</strong>
  54. </td>
  55. <td class="description last">
  56. <p>Whether the curve is closed or not.</p>
  57. <p>Default is <code>false</code>.</p>
  58. </td>
  59. </tr>
  60. <tr>
  61. <td class="name">
  62. <strong>curveType</strong>
  63. </td>
  64. <td class="description last">
  65. <p>The curve type.</p>
  66. <p>Default is <code>'centripetal'</code>.</p>
  67. </td>
  68. </tr>
  69. <tr>
  70. <td class="name">
  71. <strong>tension</strong>
  72. </td>
  73. <td class="description last">
  74. <p>Tension of the curve.</p>
  75. <p>Default is <code>0.5</code>.</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="closed" translate="no">.<a href="#closed">closed</a><span class="type-signature"> : boolean</span> </h3>
  85. <div class="description">
  86. <p>Whether the curve is closed or not.</p>
  87. <p>Default is <code>false</code>.</p>
  88. </div>
  89. </div>
  90. <div class="member">
  91. <h3 class="name" id="curveType" translate="no">.<a href="#curveType">curveType</a><span class="type-signature"> : 'centripetal' | 'chordal' | 'catmullrom'</span> </h3>
  92. <div class="description">
  93. <p>The curve type.</p>
  94. <p>Default is <code>'centripetal'</code>.</p>
  95. </div>
  96. </div>
  97. <div class="member">
  98. <h3 class="name" id="isCatmullRomCurve3" translate="no">.<a href="#isCatmullRomCurve3">isCatmullRomCurve3</a><span class="type-signature"> : boolean</span> <span class="type-signature">(readonly) </span></h3>
  99. <div class="description">
  100. <p>This flag can be used for type testing.</p>
  101. <p>Default is <code>true</code>.</p>
  102. </div>
  103. </div>
  104. <div class="member">
  105. <h3 class="name" id="points" translate="no">.<a href="#points">points</a><span class="type-signature"> : Array.&lt;<a href="Vector3.html">Vector3</a>></span> </h3>
  106. <div class="description">
  107. <p>An array of 3D points defining the curve.</p>
  108. </div>
  109. </div>
  110. <div class="member">
  111. <h3 class="name" id="tension" translate="no">.<a href="#tension">tension</a><span class="type-signature"> : number</span> </h3>
  112. <div class="description">
  113. <p>Tension of the curve.</p>
  114. <p>Default is <code>0.5</code>.</p>
  115. </div>
  116. </div>
  117. <h2 class="subsection-title">Methods</h2>
  118. <h3 class="name name-method" id="getPoint" translate="no">.<a href="#getPoint">getPoint</a><span class="signature">( t : <span class="param-type">number</span>, optionalTarget : <span class="param-type"><a href="Vector3.html">Vector3</a></span> )</span><span class="type-signature"> : <a href="Vector3.html">Vector3</a></span> </h3>
  119. <div class="method">
  120. <div class="description">
  121. <p>Returns a point on the curve.</p>
  122. </div>
  123. <table class="params">
  124. <tbody>
  125. <tr>
  126. <td class="name">
  127. <strong>t</strong>
  128. </td>
  129. <td class="description last">
  130. <p>A interpolation factor representing a position on the curve. Must be in the range <code>[0,1]</code>.</p>
  131. </td>
  132. </tr>
  133. <tr>
  134. <td class="name">
  135. <strong>optionalTarget</strong>
  136. </td>
  137. <td class="description last">
  138. <p>The optional target vector the result is written to.</p>
  139. </td>
  140. </tr>
  141. </tbody>
  142. </table>
  143. <dl class="details">
  144. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Curve.html#getPoint">Curve#getPoint</a></dt>
  145. </dl>
  146. <dl class="details">
  147. <dt class="tag-returns"><strong>Returns:</strong> The position on the curve.</dt>
  148. </dl>
  149. </div>
  150. <h2 class="subsection-title">Source</h2>
  151. <p>
  152. <a href="https://github.com/mrdoob/three.js/blob/master/src/extras/curves/CatmullRomCurve3.js" translate="no" target="_blank" rel="noopener">src/extras/curves/CatmullRomCurve3.js</a>
  153. </p>
  154. </article>
  155. </section>
  156. <script src="../scripts/linenumber.js"></script>
  157. <script src="../scripts/page.js"></script>
  158. </body>
  159. </html>
粤ICP备19079148号