CatmullRomCurve3.html 2.2 KB

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