2d geometry utilities