Follow

Coding question 

So I am struggling to understand what algorithm to use to solve the following problem:

Given a closed shape with N vertex placed randomly on a plane, how do I get the list of all visible polygons created by the vertex and line intersections?

Alternatively, is there a way to get a polygon given a point? For example if I probe a point on the plane, how do I get the polygon that contains it?

Any ideas?

Coding question 

@curved_ruler I'm so tempted to give up and use pixel-space! hahaha

I'd really like to solve it for a vector-space. Thank you very much about the suggestion with the triangulation! It makes all sense!

I am so lost that I'm thinking about line follower robots 😂

Coding question 

@curved_ruler This is indeed gold! The idea of checking if a point is inside a circle is great!

Coding question 

@curved_ruler So far the most promising approach has been the round trip to the pixel-space and back to vector space using Python's OpenCV2 `approxPolyDP` function. medium.com/simply-dev/detectin

Looks promising!

Coding question 

@curved_ruler opencv is totally a humongous gun, not to mention having to import numpy 🙄

I think for what I want to do right now it's not a problem but both the triangulation+merge and the "visible" vertices are pretty good ideas! Probably something to look at if this approach hit some walls (or just for fun :B )

Coding question 

@curved_ruler I think the winner is:

- Space fill
- Get contour
- Ramer–Douglas–Peucker

en.wikipedia.org/wiki/Ramer%E2

Sign in to participate in the conversation
Sunbeam City 🌻

Sunbeam City is a anticapitalist, antifascist solarpunk instance that is run collectively.