LibGDX CatmullRomSpline Derivative Meaning?

前提是你 提交于 2020-01-07 03:04:05

问题


When calling the derivative method on the CatmullRomSpline, what exactly does this value represent? It’s been a while since calculus, but if my memory serves me correctly taking the derivative of the position with respect to time gives you the velocity at that point in time. But with CatmullRomSpline the “time” value is a percentage, so is the resulting derivative in pixels/percent?

I printed out the derivative values (vector length) along my path and the values go as high as “989.6049”, which doesn’t really make sense to me as the total length of the path is 2039 (calculated using the “approxLength(1000)” method). I’ve tried a few things to get the derivative values into a range that makes sense (like dividing by total path length) but I’m still not making sense of it.

Essentially, I’m trying to figure out how to get a constant velocity along the path. My plan is to use the derivatives to get the rate at a given instant and compare that to what the rate should be if it was constant (calculated from the length of the path) and then adjust the percent value that is fed into the CatmullRomSpline valueAt() method so that the resulting speed will be constant throughout the path. Thanks.

来源:https://stackoverflow.com/questions/32642338/libgdx-catmullromspline-derivative-meaning

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!