CatmullRomCurve3.html 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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. <p class="desc">Create a smooth 3d spline curve from a series of points using the
  14. [link:https://en.wikipedia.org/wiki/Centripetal_Catmull-Rom_spline Catmull-Rom] algorithm.</p>
  15. <h2>Example</h2>
  16. <code>
  17. //Create a closed wavey loop
  18. var curve = new THREE.CatmullRomCurve3( [
  19. new THREE.Vector3( -10, 0, 10 ),
  20. new THREE.Vector3( -5, 5, 5 ),
  21. new THREE.Vector3( 0, 0, 0 ),
  22. new THREE.Vector3( 5, -5, 5 ),
  23. new THREE.Vector3( 10, 0, 10 )
  24. ] );
  25. var points = curve.getPoints( 50 );
  26. var geometry = new THREE.BufferGeometry().setFromPoints( points );
  27. var material = new THREE.LineBasicMaterial( { color : 0xff0000 } );
  28. // Create the final object to add to the scene
  29. var curveObject = new THREE.Line( geometry, material );
  30. </code>
  31. <h3>[example:webgl_geometry_extrude_splines geometry / extrude / splines]</h3>
  32. <h2>Constructor</h2>
  33. <h3>[name]( [param:Array points], [param:Boolean closed], [param:String curveType], [param:Float tension] )</h3>
  34. <p>
  35. points – An array of [page:Vector3] points<br/>
  36. closed – Whether the curve is closed. Default is *false*.<br/>
  37. curveType – Type of the curve. Default is *centripetal*.<br/>
  38. tension – Tension of the curve. Default is *0.5*.
  39. </p>
  40. <h2>Properties</h2>
  41. <p>See the base [page:Curve] class for common properties.</p>
  42. <h3>[property:Boolean isCatmullRomCurve3]</h3>
  43. <p>
  44. Used to check whether this or derived classes are CatmullRomCurve3s. Default is *true*.<br /><br />
  45. You should not change this, as it used internally for optimisation.
  46. </p>
  47. <h3>[property:Array points]</h3>
  48. <p>The array of [page:Vector3] points that define the curve. It needs at least two entries.</p>
  49. <h3>[property:Boolean closed]</h3>
  50. <p>The curve will loop back onto itself when this is true.</p>
  51. <h3>[property:String curveType]</h3>
  52. <p>Possible values are *centripetal*, *chordal* and *catmullrom*.</p>
  53. <h3>[property:float tension]</h3>
  54. <p>When [page:.type] is *catmullrom*, defines catmullrom's tension.</p>
  55. <h2>Methods</h2>
  56. <p>See the base [page:Curve] class for common methods.</p>
  57. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  58. </body>
  59. </html>