changed code to reuse existing bresenham-algorith