marching squares

Implement the marching squares algorithm to support contour algorithm needs