Polygon, filling in between points

Hello
I need your help with something. There are 4 different points in PG. If I put them in a certain order, I get the result I want to achieve in SS, but what I want to do is to reach a shape like in SS without touching the point order. That is, to fill in between all the points.
In this project I will do, I need the locations because they won’t come to me in order.
What can I do about it? Can you help?

image

Box Examples | Babylon.js Playground (babylonjs.com)

The points need to be specified in counterclockwise order. Since you won’t able to know the correct order before hand, you could use something like convex hull algorithms to find out: A gentle introduction to the convex hull problem | by Pascal Sommer | Medium

3 Likes

Thanks for your recommendation. The way you recommend could have tired me out a little, both in terms of performance and technically. I used CreateTube as solution. This is how I found a solution to the problem.

Box Examples | Babylon.js Playground (babylonjs.com)