Spline.html 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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. <h1>[name]</h1>
  12. <div class="desc">
  13. Class representing a [link:https://en.wikipedia.org/wiki/Spline_(mathematics) spline].<br /><br />
  14. </div>
  15. <h2>Examples</h2>
  16. <div>
  17. [example:webgl_lines_splines WebGL / lines / splines]<br />
  18. [example:webgl_lines_dashed WebGL / lines / dashed]<br />
  19. [example:software_sandbox Software / sandbox]<br />
  20. [example:canvas_lines_dashed Canvas / lines / dashed]
  21. </div>
  22. <h2>Constructor</h2>
  23. <h3>[name]( [page:Array points] )</h3>
  24. <div>
  25. Initialises the spline with [page:Array points], which are the [page:Vector3 Vector3s]
  26. through which the spline will pass.
  27. </div>
  28. <h2>Properties</h2>
  29. <h3>[property:Array points]</h3>
  30. <h2>Methods</h2>
  31. <h3>[method:Array getControlPointsArray]( )</h3>
  32. <div>
  33. Returns an array with triplets of [ x, y, z ] coordinates that correspond to the
  34. current control points.
  35. </div>
  36. <h3>[method:Vector3 getPoint]( [page:Integer k] )</h3>
  37. <div>
  38. [page:Integer k] — point index<br /><br />
  39. Return the interpolated point at [page:Integer k].
  40. </div>
  41. <h3>[method:Object getLength]( [page:Integer nSubDivisions] )</h3>
  42. <div>
  43. [page:Integer nSubDivisions] — number of subdivisions between control points. Default is *100*.<br /><br />
  44. Returns an object with the two properties. The property <strong>[page:Number total]</strong> contains
  45. the length of the spline when using [page:Integer nSubDivisions]. The property [page:Array chunkLength]
  46. contains an array with the total length from the beginning of the spline to the end of that chunk.
  47. </div>
  48. <h3>[method:null initFromArray]( [page:Array a] )</h3>
  49. <div>
  50. [page:Array a] — array of the form
  51. <code>
  52. var a = [ [x1, y1, z1], [x2, y2, z2], ... ];
  53. </code>
  54. from which to initialise the points array.<br /><br />
  55. Initialises using the data in the array as a series of points. Each value in *a* must
  56. be another array with three values, where a[n] is v, the value for the *nth* point,
  57. and v[0], v[1] and v[2] are the x, y and z coordinates of that point n, respectively.
  58. </div>
  59. <h3>[method:Vector3 interpolate]( p0, p1, p2, p3, t, t2, t3 )</h3>
  60. <div>
  61. </div>
  62. <h3>[method:null reparametrizeByArcLength]( [page:Float samplingCoef] )</h3>
  63. <div>
  64. [page:Float samplingCoef] — how many intermediate values to use between spline points<br /><br />
  65. Modifies the spline so that it looks similar to the original but has its points distributed
  66. in such way that moving along the spline it's done at a more or less constant speed.
  67. The points should also appear more uniformly spread along the curve.
  68. This is done by resampling the original spline, with the density of sampling controlled by [page:Float samplingCoef].
  69. Here it's interesting to note that denser sampling is not necessarily better:
  70. if sampling is too high, you may get weird kinks in curvature.
  71. </div>
  72. <h2>Source</h2>
  73. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  74. </body>
  75. </html>