整个矢量迭代中的贝塞尔曲线
目前我有一个程序可以演示下旋轮线和外旋轮线(又名 Spirograph http://www.math.psu.edu/dlittle/java/parametricequations/spirograph/index.html)。
起初,我只使用直线绘制形状,但意识到锯齿状边缘不太好。然后,我引入了一条 curveTo() 贝塞尔曲线,它使用两次圆形旋转迭代(以及生成的 x、y 点),一次用于控制点,一次用于端点(二次曲线)。
现在形状更加弯曲,但仍然不够弯曲,它仍然有一些锐角而不是平滑的形状。
有谁知道如何使用 curveTo() 方法或其他具有恒定曲线的实现来渲染更弯曲的线?
我在想也许可以使用跨越锯齿状边缘的圆形切线,然后用圆的切线部分替换当前线。
我怎样才能着手实施这样的事情呢?
编辑:- 我应该补充一点,我正在使用动画线程来渲染线条。
该图像显示仅分段线条是弯曲的 http://dl.dropbox.com/u/12814074/Screen%20shot%202011-04-02%20at%2007.31.56.png
At the moment I have a program that demonstrates hypotrochoids and epitrochoids (aka Spirograph http://www.math.psu.edu/dlittle/java/parametricequations/spirograph/index.html ).
At first I was drawing the shape using just straight lines, but realised the jagged edges weren't so good. I then introduced a curveTo() Bezier curve using two iterations of circular rotations (and resulting x, y points), one for the control point and one for the endpoint (a quadratic curve).
Now the shape is curvier but it's still not curvy enough, it still has some sharp angles instead of a smooth shape.
Does anyone know how I can render a more curved line, using either the curveTo() method or some other implementation for having constant curves?
I was thinking maybe using the circular tangential across the jagged edge, and then replacing the current line with the part of the circle that is tangential.
How could I go about implementing something like that?
EDIT:- I should add that I'm using the animation thread to render the lines.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
听起来控制点应该与曲线相切。如果您只是使用曲线上的另一个点,则情况并非如此。尝试将控制点放置在 2 点切线相交的位置:
PS 您的意思是“使用动画”线”?
It sounds like the control points should be tangential to the curve. If you're just using another point on the curve, this is not the case. Try placing the control point where the tangents of 2 points meet:
P.S. What do you mean "using the animation thread"?