Bezier curve algorithm in objective-c

邮差的信 提交于 2019-12-05 21:35:53
dman

I used this Bezier function with my xy plotter and found a small error with the 'to'. The to.x to.y and b.x b.y need to be switched so that the pen starts at from and ends at to.

qx = q1*from.x + q2*a.x + q3*b.x + q4*to.x;
qy = q1*from.y + q2*a.y + q3*b.y + q4*to.y;

It looks to me like you have the wrong coefficients with each point and that one of your adds became a multiply. I think what you want is this:

    qx = q1*from.x + q2*a.x + q3*to.x + q4*b.x;
    qy = q1*from.y + q2*a.y + q3*to.y + q4*b.y;
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!