This commit fixes the getEstimatedArcLength and getDecimatedVertices methods of Spline2D.js and Spline3D.js. The bug in getEstimatedArcLength was that in the original Java the arcLenIndex array is instantiated with a length (arcLenIndex = new float[vertices.size()];). As this isn't really possible in JS, the loop following the instantiation wasn't running at all. In addition, index 0 (arcLenIndex[0]) must always be set to 0 so that the calculations in getDecimatedVertices work correctly. In the Java this is again a result of the arcLenIndex instantiation as the loop which fills this array always begins at 1. There was also another small syntax error in getDecimatedVertices where the uniform array is referenced as a property of the object rather than a local variable.
This commit fixes the
getEstimatedArcLength
andgetDecimatedVertices
methods ofSpline2D.js
andSpline3D.js
. The bug ingetEstimatedArcLength
was that in the original Java thearcLenIndex
array is instantiated with a length (arcLenIndex = new float[vertices.size()];
). As this isn't really possible in JS, the loop following the instantiation wasn't running at all. In addition, index 0 (arcLenIndex[0]
) must always be set to 0 so that the calculations ingetDecimatedVertices
work correctly. In the Java this is again a result of thearcLenIndex
instantiation as the loop which fills this array always begins at 1. There was also another small syntax error ingetDecimatedVertices
where theuniform
array is referenced as a property of the object rather than a local variable.