光栅化三次多项式
给定使用最小二乘回归估计的三次多项式,我对一种简单的算法感兴趣,该算法可以光栅化曲线以在图像中显示。我最初的直觉是对 x 的每个整数值的曲线进行采样,但这会在高斜率区域留下间隙。由于三次方可以具有任意高斜率的区域,因此进一步提高采样率只能是权宜之计。
Matlab、Gnuplot等专业绘图工具是如何解决这个问题的呢?是否有适合实时应用的“足够好”的近似值?
Given a cubic polynomial estimated using least-squares regression, I am interested in a simple algorithm that rasterizes the curve to display in an image. My initial intuition is to sample the curve for every integer value of x, but this leaves gaps in regions of high slope. Because the cubic can have regions of arbitrarily high slope, further increasing the sample rate would only be a stop-gap measure.
How do professional graphing tools, such as Matlab and Gnuplot solve this problem? Are there any "good enough" approximations that are suitable for real-time applications?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以从在点之间画一条线开始,但它看起来并不平滑。
一个更好看的解决方案是在 x 维度上进行超级采样,沿着该维度绘制一条具有厚度的线,然后二次采样回到您想要显示的比例。
You could start by drawing a line between the points, but it won't look smooth.
A better looking solution would be to supersample in the x dimension, draw a line with thickness along that dimension, then subsampling back to the scale you want to display.