3 ms·
Line drawing algorithms can be surprisingly tricky. I don't think what you describe would be easier than a basic raytracer, which would be about a page of code,
by tbabb 10y ago
Line drawing algorithms can be surprisingly tricky. I don't think what you describe would be easier than a basic raytracer, which would be about a page of code, and the most complex math involved is the quadratic formula.
- clarry 10y agoSurprisingly tricky being something around two or three dozen lines of C for filling a triangle (with some constraints), after it's been transformed appropriately. But that is not the only way. You can iterate over a plane and test whether the coordinates are within a triangle. It ends up being very similar to the code you'd have for ray tracing a triangle.