绘制外观平滑的极坐标方程
我正在尝试用 Java 绘制极坐标方程。天真地绘制各个点会导致非常混乱的结果。我认为这是因为抗锯齿功能无法处理由非常短的线段组成的图形。
有一种众所周知的绘制平滑 XY 图的算法。本质上,您可以用线段来近似该函数。然后递归地细分每个线段,直到它在一定的公差范围内拟合曲线。这非常有效。
我尝试通过计算 XY 坐标并使用相同的算法来适应极坐标图,但它似乎不起作用 - 我怀疑这是因为这些点在 x 上分布不均匀。线段太明显,但减小容差以更紧密地拟合会导致曲线的其他部分再次变得凹凸不平。
有谁知道平滑绘制极坐标方程的算法吗?
I am trying to plot a polar equation in Java. Naively plotting the individual points leads to a very lumpy result. I think this is because the anti-aliasing cannot work with a graph made up of very short line segments.
There is a well known algorithm for plotting smooth XY graphs. Essentially you approximate the function with line segments. Each line segment is then subdivided recursively until it fits the curve within some tolerance. This works very well.
I tried to adapt this for polar plots by calculating the XY coordinates and using the same algorithm, but it doesn't seem to work - I suspect it is because the points are not evenly distributed in x. The line segments are too visible, but decreasing the tolerance to fit more closely results in some other parts of the curve getting lumpy again.
Does anyone know an algorithm for plotting a polar equation smoothly?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论