0

I want to determine a polygon's visual centre point in 3D space. Doing some initial research, I've come across this article by Vladimir Agafonkin describing one potential algorithm. However, the example implementations rely on other libraries and are tailored specifically for 2D space.

While rudimentary approaches (average, centroid, bounding box centre, etc.) work for simpler shapes such as regular convex polygons, it certainly gets hairier with irregular or concave polygons.

To help illustrate what I'm after, take these 2 example polygons:

enter image description here

The point that I'm interested in would be the red dot (as a Vector3 [x, y, z]).

Is there a way to achieve this in 3D space using vanilla Python (no third party modules)? Or another algorithm one of you have come across in your travels that may apply to this situation — or at the very least point me in the right direction?

Speedy
  • 367
  • 1
  • 5
  • 15
  • Is this helpfull? https://stackoverflow.com/questions/1203135. If your shapes have straight walls it might also be easier to approach them as 2D, then place the centroid just in the vertical middle. And why no third party modules? Don't reinvent the wheel :) – user_cr May 24 '22 at 09:32

0 Answers0