I need to connect three points by a smooth curve. I've looked at the same questions already answered on StackOverflow but they all suggest using Path.quadTo()
. I do not understand why this is considered a correct answer as Bezier curve is only approaching middle (control) point but not going through it. In my case I have to go exactly through it. So how can I achieve that?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
True, what you need is Catmull Rom splines which are guaranted to go through each point. However, I don't know any function in the Android API to draw them. You could also "trick" the quadTo function and pass it a virtual middle point that you compute according to the current point and the next one.
回答2:
What about the cubicTo (or rCubicTo if you need it from a relative point) function? http://developer.android.com/reference/android/graphics/Path.html#cubicTo(float, float, float, float, float, float)
回答3:
Here is a very nice, illustrated howto for javascript, but all the used methods are usual and there is an analogue in Androids Path Class