clipping routine ported over from Java
change to using 2d array