CatmullRomCurve3.html 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <!DOCTYPE html>
  2. <html lang="it">
  3. <head>
  4. <meta charset="utf-8" />
  5. <base href="../../../../" />
  6. <script src="page.js"></script>
  7. <link type="text/css" rel="stylesheet" href="page.css" />
  8. </head>
  9. <body>
  10. [page:Curve] &rarr;
  11. <h1>[name]</h1>
  12. <p class="desc"> Crea una curva spline 3D smooth (uniforme) da una serie di punti utilizzando l'algoritmo
  13. [link:https://en.wikipedia.org/wiki/Centripetal_Catmull-Rom_spline Catmull-Rom].</p>
  14. <h2>Codice di Esempio</h2>
  15. <code>
  16. // Crea un circuito ondulato chiuso
  17. const curve = new THREE.CatmullRomCurve3( [
  18. new THREE.Vector3( -10, 0, 10 ),
  19. new THREE.Vector3( -5, 5, 5 ),
  20. new THREE.Vector3( 0, 0, 0 ),
  21. new THREE.Vector3( 5, -5, 5 ),
  22. new THREE.Vector3( 10, 0, 10 )
  23. ] );
  24. const points = curve.getPoints( 50 );
  25. const geometry = new THREE.BufferGeometry().setFromPoints( points );
  26. const material = new THREE.LineBasicMaterial( { color: 0xff0000 } );
  27. // Crea l'oggetto finale da aggiungere alla scena
  28. const curveObject = new THREE.Line( geometry, material );
  29. </code>
  30. <h2>Esempi</h2>
  31. <p>
  32. [example:webgl_geometry_extrude_splines WebGL / geometry / extrude / splines]
  33. </p>
  34. <h2>Costruttore</h2>
  35. <h3>[name]( [param:Array points], [param:Boolean closed], [param:String curveType], [param:Float tension] )</h3>
  36. <p>
  37. points – Un array di punti [page:Vector3]<br/>
  38. closed – Se la curva è chiusa. Il valore predefinito è `false`.<br/>
  39. curveType – Tipo di curva. Il valore predefinito è `centripetal`.<br/>
  40. tension – Tensione della curva. Il valore predefinito è `0.5`.
  41. </p>
  42. <h2>Proprietà</h2>
  43. <p>Vedi la classe [page:Curve] per le proprità comuni.</p>
  44. <h3>[property:Array points]</h3>
  45. <p>L'array di punti [page:Vector3] che definisce la curva. Ha bisogno di almeno due entries.</p>
  46. <h3>[property:Boolean closed]</h3>
  47. <p>Quando questa proprietà viene impostata su `true` la curva ritornerà su se stessa.</p>
  48. <h3>[property:String curveType]</h3>
  49. <p>I valori possibili sono `centripetal`, `chordal` e `catmullrom`.</p>
  50. <h3>[property:Float tension]</h3>
  51. <p>Quando [page:.curveType] è `catmullrom`, definisce la tensione di catmullrom.</p>
  52. <h2>Metodi</h2>
  53. <p>Vedi la classe [page:Curve] per i metodi comuni.</p>
  54. <h2>Source</h2>
  55. <p>
  56. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  57. </p>
  58. </body>
  59. </html>