Leave no Call Stack Unturned

 

For my Computer Graphics class, we had an assignment to draw a triangle on the Raster and then fill it with Lerped color.

 
 
Triangle.png
 
 

The result should have looked like something on the left, but mine looked like something on the right.

We were using the Bary Centric formula to colour the triangle and the formula used the Implicit Line formula. To fill the triangles, I was calling a lot of functions, and colouring the triangle depended on a lot of ratios and values derived from the 3 points of the triangle. 

The formulas that I was using had a sub-formulas and I had dived the small formulas, into functions for reusability. I tried everything to fix the formula. I used breakpoints, tracepoints, printing values to the console. Everything I could think of. I went through to each an every function call that could cause this problem. Failing to fix this problem I turned to my Lab specialist. 

He looked at the code and quickly realised that the problem was not with formulas but something. He then through all the function calls instead of the "ones that could have caused it". He found the problem and fixed it!

In my pixel plotting function, I was checking whether the alpha of the colour that was being plotted was 255 and only then was I plotting it. I had done this for blending purposes but I removed the blending code. 

My lab specialist went through to the whole call stack instead of just assuming where the problem could be allowing him to notice the functon doing something wrong.

 
Previous
Previous

Programmer's Instinct

Next
Next

Multitasking Only Exists in the Task Manager