找到三次贝塞尔曲线上的点的切线 [英] Find the tangent of a point on a cubic bezier curve

查看:438
本文介绍了找到三次贝塞尔曲线上的点的切线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于具有通常的四个点a,b,c和d的立方Bézier曲线,

For a cubic Bézier curve with the usual four points a, b, c and d,

对于给定值t,

如何最优雅地找到切线

推荐答案

曲线的正切只是它的导数。 Michal使用的参数方程:

The tangent of a curve is simply its derivative. The parametric equation that Michal uses:

P(t) = (1 - t)^3 * P0 + 3t(1-t)^2 * P1 + 3t^2 (1-t) * P2 + t^3 * P3

应该有一个衍生物

dP(t) / dt =  -3(1-t)^2 * P0 + 3(1-t)^2 * P1 - 6t(1-t) * P1 - 3t^2 * P2 + 6t(1-t) * P2 + 3t^2 * P3 

顺便说一句,在你之前的问题中,这似乎是错误的。我相信你在那里使用斜率为二次Bezier曲线,而不是立方。

Which, by the way, appears to be wrong in your earlier question. I believe you're using the slope for a quadratic Bezier curve there, not cubic.

从那里,实现执行此计算的C函数应该是微不足道的,像Michal已经提供了曲线本身。

From there, it should be trivial to implement a C function that performs this calculation, like Michal has already provided for the curve itself.

这篇关于找到三次贝塞尔曲线上的点的切线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆