iterate over the images row by row (faster)
small cleanups
use a struct for faster memory accesses
use float for sin/cos