SplineCurve.html 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8" />
  5. <base href="../../../" />
  6. <script src="list.js"></script>
  7. <script src="page.js"></script>
  8. <link type="text/css" rel="stylesheet" href="page.css" />
  9. </head>
  10. <body>
  11. [page:Curve] &rarr;
  12. <h1>[name]</h1>
  13. <div class="desc">
  14. Create a smooth 2d spline curve from a series of points. Internally this uses
  15. [page:Interpolations.CatmullRom] to create the curve.
  16. </div>
  17. <h2>Example</h2>
  18. <code>
  19. // Create a sine-like wave
  20. var curve = new THREE.SplineCurve( [
  21. new THREE.Vector2( -10, 0 ),
  22. new THREE.Vector2( -5, 5 ),
  23. new THREE.Vector2( 0, 0 ),
  24. new THREE.Vector2( 5, -5 ),
  25. new THREE.Vector2( 10, 0 )
  26. ] );
  27. var geometry = new THREE.Geometry();
  28. var points = curve.getPoints( 50 );
  29. for ( var i = 0, l = points.length; i < l; i ++ ) {
  30. var point = points[ i ];
  31. geometry.vertices.push( new THREE.Vector3( point.x, point.y, 0 ) );
  32. }
  33. var material = new THREE.LineBasicMaterial( { color : 0xff0000 } );
  34. // Create the final object to add to the scene
  35. var splineObject = new THREE.Line( geometry, material );
  36. </code>
  37. <h2>Constructor</h2>
  38. <h3>[name]( [page:Array points] )</h3>
  39. <div>points – An array of [page:Vector2] points that define the curve.</div>
  40. <h2>Properties</h2>
  41. <div>See the base [page:Curve] class for common properties.</div>
  42. <h3>[property:Boolean isSplineCurve]</h3>
  43. <div>
  44. Used to check whether this or derived classes are SplineCurves. Default is *true*.<br /><br />
  45. You should not change this, as it used internally for optimisation.
  46. </div>
  47. <h3>[property:Array points]</h3>
  48. <div>The array of [page:Vector3] points that define the curve.</div>
  49. <h2>Methods</h2>
  50. <div>See the base [page:Curve] class for common methods.</div>
  51. <h2>Source</h2>
  52. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  53. </body>
  54. </html>