NURBSCurve.html 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>NURBSCurve - 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">NURBSCurve</h1>
  14. <section>
  15. <header>
  16. <div class="class-description"><p>This class represents a NURBS curve.</p>
  17. <p>Implementation is based on <code>(x, y [, z=0 [, w=1]])</code> control points with <code>w=weight</code>.</p></div>
  18. </header>
  19. <article>
  20. <h2 class="subsection-title">Import</h2>
  21. <p><span translate="no">NURBSCurve</span> is an addon, and must be imported explicitly, see <a href="https://threejs.org/manual/#en/installation" target="_blank">Installation#Addons</a>.</p>
  22. <pre><code class="language-js">import { NURBSCurve } from 'three/addons/curves/NURBSCurve.js';</code></pre>
  23. <div class="container-overview">
  24. <h2>Constructor</h2>
  25. <h3 class="name name-method" id="NURBSCurve" translate="no">new <a href="#NURBSCurve">NURBSCurve</a><span class="signature">( degree : <span class="param-type">number</span>, knots : <span class="param-type">Array.&lt;number></span>, controlPoints : <span class="param-type">Array.&lt;(Vector2|Vector3|Vector4)></span>, startKnot : <span class="param-type">number</span>, endKnot : <span class="param-type">number</span> )</span> </h3>
  26. <div class="method">
  27. <div class="description">
  28. <p>Constructs a new NURBS curve.</p>
  29. </div>
  30. <table class="params">
  31. <tbody>
  32. <tr>
  33. <td class="name"><code>degree</code></td>
  34. <td class="description last"><p>The NURBS degree.</p></td>
  35. </tr>
  36. <tr>
  37. <td class="name"><code>knots</code></td>
  38. <td class="description last"><p>The knots as a flat array of numbers.</p></td>
  39. </tr>
  40. <tr>
  41. <td class="name"><code>controlPoints</code></td>
  42. <td class="description last"><p>An array holding control points.</p></td>
  43. </tr>
  44. <tr>
  45. <td class="name"><code>startKnot</code></td>
  46. <td class="description last"><p>Index of the start knot into the <code>knots</code> array.</p></td>
  47. </tr>
  48. <tr>
  49. <td class="name"><code>endKnot</code></td>
  50. <td class="description last"><p>Index of the end knot into the <code>knots</code> array.</p></td>
  51. </tr>
  52. </tbody>
  53. </table>
  54. </div>
  55. </div>
  56. <h2 class="subsection-title">Properties</h2>
  57. <div class="member">
  58. <h3 class="name" id="controlPoints" translate="no">.<a href="#controlPoints">controlPoints</a><span class="type-signature"> : Array.&lt;<a href="Vector4.html">Vector4</a>></span> </h3>
  59. <div class="description">
  60. <p>An array of control points.</p>
  61. </div>
  62. </div>
  63. <div class="member">
  64. <h3 class="name" id="degree" translate="no">.<a href="#degree">degree</a><span class="type-signature"> : number</span> </h3>
  65. <div class="description">
  66. <p>The NURBS degree.</p>
  67. </div>
  68. </div>
  69. <div class="member">
  70. <h3 class="name" id="endKnot" translate="no">.<a href="#endKnot">endKnot</a><span class="type-signature"> : number</span> </h3>
  71. <div class="description">
  72. <p>Index of the end knot into the <code>knots</code> array.</p>
  73. </div>
  74. </div>
  75. <div class="member">
  76. <h3 class="name" id="knots" translate="no">.<a href="#knots">knots</a><span class="type-signature"> : Array.&lt;number></span> </h3>
  77. <div class="description">
  78. <p>The knots as a flat array of numbers.</p>
  79. </div>
  80. </div>
  81. <div class="member">
  82. <h3 class="name" id="startKnot" translate="no">.<a href="#startKnot">startKnot</a><span class="type-signature"> : number</span> </h3>
  83. <div class="description">
  84. <p>Index of the start knot into the <code>knots</code> array.</p>
  85. </div>
  86. </div>
  87. <h2 class="subsection-title">Methods</h2>
  88. <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">Vector3</span> )</span><span class="type-signature"> : <a href="Vector3.html">Vector3</a></span> </h3>
  89. <div class="method">
  90. <div class="description">
  91. <p>This method returns a vector in 3D space for the given interpolation factor.</p>
  92. </div>
  93. <table class="params">
  94. <tbody>
  95. <tr>
  96. <td class="name"><code>t</code></td>
  97. <td class="description last"><p>A interpolation factor representing a position on the curve. Must be in the range <code>[0,1]</code>.</p></td>
  98. </tr>
  99. <tr>
  100. <td class="name"><code>optionalTarget</code></td>
  101. <td class="description last"><p>The optional target vector the result is written to.</p></td>
  102. </tr>
  103. </tbody>
  104. </table>
  105. <dl class="details">
  106. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Curve.html#getPoint">Curve#getPoint</a></dt>
  107. </dl>
  108. <dl class="details">
  109. <dt class="tag-returns"><strong>Returns:</strong> The position on the curve.</dt>
  110. </dl>
  111. </div>
  112. <h3 class="name name-method" id="getTangent" translate="no">.<a href="#getTangent">getTangent</a><span class="signature">( t : <span class="param-type">number</span>, optionalTarget : <span class="param-type">Vector3</span> )</span><span class="type-signature"> : <a href="Vector3.html">Vector3</a></span> </h3>
  113. <div class="method">
  114. <div class="description">
  115. <p>Returns a unit vector tangent for the given interpolation factor.</p>
  116. </div>
  117. <table class="params">
  118. <tbody>
  119. <tr>
  120. <td class="name"><code>t</code></td>
  121. <td class="description last"><p>The interpolation factor.</p></td>
  122. </tr>
  123. <tr>
  124. <td class="name"><code>optionalTarget</code></td>
  125. <td class="description last"><p>The optional target vector the result is written to.</p></td>
  126. </tr>
  127. </tbody>
  128. </table>
  129. <dl class="details">
  130. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Curve.html#getTangent">Curve#getTangent</a></dt>
  131. </dl>
  132. <dl class="details">
  133. <dt class="tag-returns"><strong>Returns:</strong> The tangent vector.</dt>
  134. </dl>
  135. </div>
  136. <h2 class="subsection-title">Source</h2>
  137. <p>
  138. <a href="https://github.com/mrdoob/three.js/blob/master/examples/jsm/curves/NURBSCurve.js" target="_blank" rel="noopener" translate="no">examples/jsm/curves/NURBSCurve.js</a>
  139. </p>
  140. </article>
  141. </section>
  142. <script src="../scripts/linenumber.js"></script>
  143. <script src="../scripts/page.js"></script>
  144. </body>
  145. </html>
粤ICP备19079148号