catmull-rom splines for Android

给你一囗甜甜゛ 提交于 2019-12-02 03:32:33

问题


I'm trying to find a way to implement catmull-rom splines on the android platform for the purpose of smoothly drawing a line through n points. Ideally I would be able to adapt cubic beziers via the Path and its cubicTo method as alluded to in this thread: How do I draw a curve through tree points in Android?

Unfortunately, I wasnt able to follow the implementation there so I'm hoping somebody out there has already done this and can share a few lines of sample code.

Thanks!


回答1:


This game development library for Android seems to have Catmull-Rom splines implemented: http://code.google.com/p/libgdx/.

p.s., you tagged Bezier, that's incorrect -- that's the type of curve that uses control points outside the curve which have external influences :)




回答2:


I was facing the same problem and there is solution I have found:

Smooth Bézier Spline Through Prescribed Points

It is implemented in JavaScript, but it can be easily rewritten to Java - result is natural spline drawn using Path.quadTo().



来源:https://stackoverflow.com/questions/5602584/catmull-rom-splines-for-android

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