| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="utf-8">
- <title>Line - 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="EventDispatcher.html">EventDispatcher</a> → <a href="Object3D.html">Object3D</a> → </p>
- <h1 translate="no">Line</h1>
- <section>
- <header>
- <div class="class-description"><p>A continuous line. The line are rendered by connecting consecutive
- vertices with straight lines.</p></div>
- <h2>Code Example</h2>
- <div translate="no"><pre><code class="language-js">const material = new THREE.LineBasicMaterial( { color: 0x0000ff } );
- const points = [];
- points.push( new THREE.Vector3( - 10, 0, 0 ) );
- points.push( new THREE.Vector3( 0, 10, 0 ) );
- points.push( new THREE.Vector3( 10, 0, 0 ) );
- const geometry = new THREE.BufferGeometry().setFromPoints( points );
- const line = new THREE.Line( geometry, material );
- scene.add( line );
- </code></pre></div>
- </header>
- <article>
- <div class="container-overview">
- <h2>Constructor</h2>
- <h3 class="name name-method" id="Line" translate="no">new <a href="#Line">Line</a><span class="signature">( geometry : <span class="param-type"><a href="BufferGeometry.html">BufferGeometry</a></span>, material : <span class="param-type"><a href="Material.html">Material</a> | Array.<<a href="Material.html">Material</a>></span> )</span> </h3>
- <div class="method">
- <div class="description">
- <p>Constructs a new line.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>geometry</strong>
- </td>
- <td class="description last">
- <p>The line geometry.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>material</strong>
- </td>
- <td class="description last">
- <p>The line material.</p>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- </div>
- <h2 class="subsection-title">Properties</h2>
- <div class="member">
- <h3 class="name" id="geometry" translate="no">.<a href="#geometry">geometry</a><span class="type-signature"> : <a href="BufferGeometry.html">BufferGeometry</a></span> </h3>
- <div class="description">
- <p>The line geometry.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="isLine" translate="no">.<a href="#isLine">isLine</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="material" translate="no">.<a href="#material">material</a><span class="type-signature"> : <a href="Material.html">Material</a> | Array.<<a href="Material.html">Material</a>></span> </h3>
- <div class="description">
- <p>The line material.</p>
- <p>Default is <code>LineBasicMaterial</code>.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="morphTargetDictionary" translate="no">.<a href="#morphTargetDictionary">morphTargetDictionary</a><span class="type-signature"> : Object.<String, number> | undefined</span> </h3>
- <div class="description">
- <p>A dictionary representing the morph targets in the geometry. The key is the
- morph targets name, the value its attribute index. This member is <code>undefined</code>
- by default and only set when morph targets are detected in the geometry.</p>
- <p>Default is <code>undefined</code>.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="morphTargetInfluences" translate="no">.<a href="#morphTargetInfluences">morphTargetInfluences</a><span class="type-signature"> : Array.<number> | undefined</span> </h3>
- <div class="description">
- <p>An array of weights typically in the range <code>[0,1]</code> that specify how much of the morph
- is applied. This member is <code>undefined</code> by default and only set when morph targets are
- detected in the geometry.</p>
- <p>Default is <code>undefined</code>.</p>
- </div>
- </div>
- <h2 class="subsection-title">Methods</h2>
- <h3 class="name name-method" id="computeLineDistances" translate="no">.<a href="#computeLineDistances">computeLineDistances</a><span class="signature">()</span><span class="type-signature"> : <a href="Line.html">Line</a></span> </h3>
- <div class="method">
- <div class="description">
- <p>Computes an array of distance values which are necessary for rendering dashed lines.
- For each vertex in the geometry, the method calculates the cumulative length from the
- current point to the very beginning of the line.</p>
- </div>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> A reference to this line.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="raycast" translate="no">.<a href="#raycast">raycast</a><span class="signature">( raycaster : <span class="param-type"><a href="Raycaster.html">Raycaster</a></span>, intersects : <span class="param-type">Array.<Object></span> )</span> </h3>
- <div class="method">
- <div class="description">
- <p>Computes intersection points between a casted ray and this line.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>raycaster</strong>
- </td>
- <td class="description last">
- <p>The raycaster.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>intersects</strong>
- </td>
- <td class="description last">
- <p>The target array that holds the intersection points.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Object3D.html#raycast">Object3D#raycast</a></dt>
- </dl>
- </div>
- <h3 class="name name-method" id="updateMorphTargets" translate="no">.<a href="#updateMorphTargets">updateMorphTargets</a><span class="signature">()</span> </h3>
- <div class="method">
- <div class="description">
- <p>Sets the values of <a href="Line.html#morphTargetDictionary">Line#morphTargetDictionary</a> and <a href="Line.html#morphTargetInfluences">Line#morphTargetInfluences</a>
- to make sure existing morph targets can influence this 3D object.</p>
- </div>
- </div>
- <h2 class="subsection-title">Source</h2>
- <p>
- <a href="https://github.com/mrdoob/three.js/blob/master/src/objects/Line.js" translate="no" target="_blank" rel="noopener">src/objects/Line.js</a>
- </p>
- </article>
- </section>
- <script src="../scripts/linenumber.js"></script>
- <script src="../scripts/page.js"></script>
- </body>
- </html>
|