| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="utf-8">
- <title>SplineCurve - Three.js Docs</title>
- <meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
- <script src="../scripts/highlight.min.js"></script>
- <link type="text/css" rel="stylesheet" href="../styles/highlight-three.css">
- <link type="text/css" rel="stylesheet" href="../styles/page.css">
- </head>
- <body>
- <p class="inheritance" translate="no"><a href="Curve.html">Curve</a> → </p>
- <h1 translate="no">SplineCurve</h1>
- <section>
- <header>
- <div class="class-description"><p>A curve representing a 2D spline curve.</p></div>
- <h2>Code Example</h2>
- <div translate="no"><pre><code class="language-js">// Create a sine-like wave
- const curve = new THREE.SplineCurve( [
- new THREE.Vector2( -10, 0 ),
- new THREE.Vector2( -5, 5 ),
- new THREE.Vector2( 0, 0 ),
- new THREE.Vector2( 5, -5 ),
- new THREE.Vector2( 10, 0 )
- ] );
- const points = curve.getPoints( 50 );
- const geometry = new THREE.BufferGeometry().setFromPoints( points );
- const material = new THREE.LineBasicMaterial( { color: 0xff0000 } );
- // Create the final object to add to the scene
- const splineObject = new THREE.Line( geometry, material );
- </code></pre></div>
- </header>
- <article>
- <div class="container-overview">
- <h2>Constructor</h2>
- <h3 class="name name-method" id="SplineCurve" translate="no">new <a href="#SplineCurve">SplineCurve</a><span class="signature">( points : <span class="param-type">Array.<<a href="Vector2.html">Vector2</a>></span> )</span> </h3>
- <div class="method">
- <div class="description">
- <p>Constructs a new 2D spline curve.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>points</strong>
- </td>
- <td class="description last">
- <p>An array of 2D points defining the curve.</p>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- </div>
- <h2 class="subsection-title">Properties</h2>
- <div class="member">
- <h3 class="name" id="isSplineCurve" translate="no">.<a href="#isSplineCurve">isSplineCurve</a><span class="type-signature"> : boolean</span> <span class="type-signature">(readonly) </span></h3>
- <div class="description">
- <p>This flag can be used for type testing.</p>
- <p>Default is <code>true</code>.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="points" translate="no">.<a href="#points">points</a><span class="type-signature"> : Array.<<a href="Vector2.html">Vector2</a>></span> </h3>
- <div class="description">
- <p>An array of 2D points defining the curve.</p>
- </div>
- </div>
- <h2 class="subsection-title">Methods</h2>
- <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="Vector2.html">Vector2</a></span> )</span><span class="type-signature"> : <a href="Vector2.html">Vector2</a></span> </h3>
- <div class="method">
- <div class="description">
- <p>Returns a point on the curve.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>t</strong>
- </td>
- <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>
- </tr>
- <tr>
- <td class="name">
- <strong>optionalTarget</strong>
- </td>
- <td class="description last">
- <p>The optional target vector the result is written to.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Curve.html#getPoint">Curve#getPoint</a></dt>
- </dl>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The position on the curve.</dt>
- </dl>
- </div>
- <h2 class="subsection-title">Source</h2>
- <p>
- <a href="https://github.com/mrdoob/three.js/blob/master/src/extras/curves/SplineCurve.js" translate="no" target="_blank" rel="noopener">src/extras/curves/SplineCurve.js</a>
- </p>
- </article>
- </section>
- <script src="../scripts/linenumber.js"></script>
- <script src="../scripts/page.js"></script>
- </body>
- </html>
|