Polygon from a grid of squares
问题 I'm looking for an algorithm to find the polygon that surrounds a contiguous grid of squares without holes as shown here: . I already have each of the grid squares storing data about the kind of edges with the surrounding area that they are composed of (i.e. top, top-right, top-bottom, no edges, etc.), so I'm thinking that this data could be utilized by the algorithm. If someone could provide some pseudocode for such an algorithm that would also be great. The input to the algorithm would be a