Graphics algorithm implementation with C++