开发者

Rasterizing a Cubic Polynomial

开发者 https://www.devze.com 2023-02-03 12:56 出处:网络
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 sam

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?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消