<p>I've implemented the marching squares algorithm following Wikipedia's <a href="https://en.wikipedia.org/wiki/Marching_squares" rel="nofollow noreferrer">https://en.wikipedia.org/wiki/Marching_squares</a>. The output I got is a set of edges, to which each contouring cell contributes 0, 1, or 4 edges.</p>
<p>How do I modify or post-process this algorithm to obtain a set of distinct polygons from these edges?<br />
Oh and I want to do so in parallel.</p>
<p>I guess the sequential approach would be to pick an edge and follow it until it comes back to the beginning, then move on to another unprocessed edge.</p>

CC BY-SA 4.0
2022-03-22T11:00:49.437Z
what should your output look like? list of points and a list of connections (from point to point)? Or adjacency list of points? What do you mean with parallel? Like executing in parallel some code for each vertex? I would recommend, to give us an example.
Thomas
CC BY-SA 4.0
2022-03-24T00:05:56.060Z
i would like to output a list of polygons. a polygons is a list of vertices in counterclockwise order. in parallel means with multi-threading. i would like an algorithm that is parallizable.
Huy Le
<computational-geometry><polygon><2d-graphics>
Generate polygons after marching squares in parallel
Huy Le
# Generate polygons after marching squares in parallel

(Asked by: username_0 on 2022-03-19)

I've implemented the marching squares algorithm following Wikipedia's <https://en.wikipedia.org/wiki/Marching_squares>. The output I got is a set of edges, to which each contouring cell contributes 0, 1, or 4 edges.

How do I modify or post-process this algorithm to obtain a set of distinct polygons from these edges?  
Oh and I want to do so in parallel.

I guess the sequential approach would be to pick an edge and follow it until it comes back to the beginning, then move on to another unprocessed edge.

**Tags:** computational-geometry, polygon, 2d-graphics

> **Comments:**
> **username_1**: what should your output look like? list of points and a list of connections (from point to point)? Or adjacency list of points? What do you mean with parallel? Like executing in parallel some code for each vertex? I would recommend, to give us an example.  
> **username_0**: i would like to output a list of polygons. a polygons is a list of vertices in counterclockwise order. in parallel means with multi-threading. i would like an algorithm that is parallizable.  

---

## 0 answers

