CMPS-3480 Computer Graphics
Lab-4 notes Several things can go wrong in lab-4 when working with barycentric coordinates. 1. The area of a triangle might be zero. But due to how floating-point numbers are handled by the processor, the area might be negative zero. This will cause the square-root function to produce a NaN error result. sqrt(0) = 0 sqrt(-0) = NaN ERROR An aceptable way to handle this in our lab4 program is to check triangle area, and if negative, set it to zero. 2. Barycentric coordinates might be invalid. When calling the getBarycentric function, always check the return value and make sure it is TRUE. If not TRUE, then do not use those u, v, w values. Skip them.