2D flattening