Order of points in space

If I am sure that a list of points forms a certain flat surface, can I reorder them?
My goal is to get the correct order to create adaptive family. Is it possible to sort points in clockwise or counterclockwise?

Yes.

Find the average of the points.
Fins the vector from the average point to all others,
Find the angle from the Y axis to each vector about the Z axis.
Find the X value of each point and the center point.
Check if the points X value is less than the center point.
If so add 180 to the angle, if not return just the angle.
Sort the list of points by that key.

1 Like

The other thing is that you’ll need to define a start point for your sorting… For example, I numbered doors from the Entrance door, so a vector from the average x,y to the Entrance door location point defined the start…

Here’s a graph with an arbitrary start vector based on the first item in the list… There will be many ways of doing this :slight_smile:

Hope that’s of interest,

Mark

2 Likes

Return A List of Points From Intersect That Create a Clockwise Polygon

After doing some research, I found out that this guy did it. I haven’t completely understood the solution, I have copied and pasted it into my own workspace and it gave the exact solution that I wanted. (I hate myself)

Don’t hate yourself, Vikram is a god, he does things noone else (apart from Kulkul, Konrad, JP, Jacob and a few others) can :slight_smile: as you noted, the beauty of his method is that it works on any list of points.

I’ve had a go at annotating what he’s done (it’s a great way of understanding what the heck is going on) hopefully it’s reasonably correct and a bit useful to you…

Cheers,

Mark

6 Likes

Thank you very much for explaining whats happening. I just asked him through pm to explain a bit how is that beauty working. And you have explained:) Wish I had wished something else:) Thank you very much again guys.

1 Like