|
From: <HBB...@t-...> - 2007-02-06 21:22:02
|
Daniel J Sebald wrote: > I've looked through the code a bit and your examples. (What command > does one need to compile this program?) I'd have to think about your > approach to be certain about the result. You've broken the thing down > into a series of one dimensional linearities, first along the sides of > the triangle to get a color, and then across the x dimension to further > interpolate between those two. Seems logical, but it may be open for > rounding problems. And, more importantly, it's a bit biased, which tends to turn into a robustness problem. The bias lies in the arbitrary choice of one vertex to be shared by the two first interpolations. It can be better to go via barycentric coordinates. It's effectively a method to find three numbers s, t, and u such that: s+t+u=1 s*A + t*B + u*C = X for the point, and its colour. I.e. you solve the equation for s,t,u given a point X, then substitute them into the equation to find the target colour. |