这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@baseten
Copy link

@baseten baseten commented Feb 5, 2015

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.

…e2D.js and Spline3D.js in geom package, new build
@hapticdata
Copy link
Owner

Thank you for this fix, as well as for the explanation. That is a tricky one to spot. Thanks again it is greatly appreciated!

hapticdata added a commit that referenced this pull request Feb 7, 2015
Fixed methods of Spline2D.js and Spline3D.js in geom package
@hapticdata hapticdata merged commit 3bb41a2 into hapticdata:master Feb 7, 2015
@baseten
Copy link
Author

baseten commented Feb 17, 2015

No worries. You've done a great job porting this to JS, really useful!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants