I am search for efficient algorithm and/or code to rasterize curved polygons. In best case such algorithm would support anti-aliasing with sub pixel accuracy. My goal is to understand and implement such algorithm in c++.
Point-In-Spline-Polygon Algorithm Here is the code to detect if point is inside such curved polygon, and of course one could use brute-force to rasterize this, but it would be too slow.
Essentially I need fast c++ code to produce images presented in this article.
Brute force code would look something like this.
// draw a single pixel at x,y coordinates.
void draw_pixel(int x, int y, int coverage);
// slow code without anti-aliasing
void brute_force(int x_res, int y_res, double *poly) {
for(int y = 0; y < y_res; ++y) {
const double fy = double(y);
for(int x = 0; x < x_res; ++x) {
const double fx = double(x);
if (pointInSplinePoly(poly, fx, fy)) {
draw_pixel(x,y, 0xFF);
}
}
}
}