| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="utf-8">
- <title>CatmullRomCurve3 - 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">CatmullRomCurve3</h1>
- <section>
- <header>
- <div class="class-description"><p>A curve representing a Catmull-Rom spline.</p></div>
- <h2>Code Example</h2>
- <div translate="no"><pre><code class="language-js">//Create a closed wavey loop
- const curve = new THREE.CatmullRomCurve3( [
- new THREE.Vector3( -10, 0, 10 ),
- new THREE.Vector3( -5, 5, 5 ),
- new THREE.Vector3( 0, 0, 0 ),
- new THREE.Vector3( 5, -5, 5 ),
- new THREE.Vector3( 10, 0, 10 )
- ] );
- 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 curveObject = new THREE.Line( geometry, material );
- </code></pre></div>
- </header>
- <article>
- <div class="container-overview">
- <h2>Constructor</h2>
- <h3 class="name name-method" id="CatmullRomCurve3" translate="no">new <a href="#CatmullRomCurve3">CatmullRomCurve3</a><span class="signature">( points : <span class="param-type">Array.<<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>
- <div class="method">
- <div class="description">
- <p>Constructs a new Catmull-Rom curve.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>points</strong>
- </td>
- <td class="description last">
- <p>An array of 3D points defining the curve.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>closed</strong>
- </td>
- <td class="description last">
- <p>Whether the curve is closed or not.</p>
- <p>Default is <code>false</code>.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>curveType</strong>
- </td>
- <td class="description last">
- <p>The curve type.</p>
- <p>Default is <code>'centripetal'</code>.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>tension</strong>
- </td>
- <td class="description last">
- <p>Tension of the curve.</p>
- <p>Default is <code>0.5</code>.</p>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- </div>
- <h2 class="subsection-title">Properties</h2>
- <div class="member">
- <h3 class="name" id="closed" translate="no">.<a href="#closed">closed</a><span class="type-signature"> : boolean</span> </h3>
- <div class="description">
- <p>Whether the curve is closed or not.</p>
- <p>Default is <code>false</code>.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="curveType" translate="no">.<a href="#curveType">curveType</a><span class="type-signature"> : 'centripetal' | 'chordal' | 'catmullrom'</span> </h3>
- <div class="description">
- <p>The curve type.</p>
- <p>Default is <code>'centripetal'</code>.</p>
- </div>
- </div>
- <div class="member">
- <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>
- <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="Vector3.html">Vector3</a>></span> </h3>
- <div class="description">
- <p>An array of 3D points defining the curve.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="tension" translate="no">.<a href="#tension">tension</a><span class="type-signature"> : number</span> </h3>
- <div class="description">
- <p>Tension of the curve.</p>
- <p>Default is <code>0.5</code>.</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="Vector3.html">Vector3</a></span> )</span><span class="type-signature"> : <a href="Vector3.html">Vector3</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/CatmullRomCurve3.js" translate="no" target="_blank" rel="noopener">src/extras/curves/CatmullRomCurve3.js</a>
- </p>
- </article>
- </section>
- <script src="../scripts/linenumber.js"></script>
- <script src="../scripts/page.js"></script>
- </body>
- </html>
|