AnsweredAssumed Answered

Ordering 3D points to draw a spline

Question asked by Harold Black on Jan 29, 2019
Latest reply on Jan 29, 2019 by Josh Brady

I'm developing a macro through Excel that takes a point cloud and extracts the points that belong to unique profiles and draws a spline for each profile through the points that make up that profile. I've accomplished separating the points for each profile. In order to draw a spline through the points, I first need to order the points in clockwise or counter-clockwise fashion. I do this by finding the angle that is formed by point(n), centroid, point(n+1). With these calculations, a table is autocreated and sorted from minimum to maximum angle. The sort works. However, the spline goes through points it is not supposed to go through. This is the original data in x, y, z in columns.

 

original.png

After I sort the table by angle, I get the following result below. The numbers in the red outline are the order in which the spline connects the points in reference to the spline picture. I'm expecting the spline to connect through points 1, 2, 3, 4, 5, 6, 7, 1. Is there a different algorithm I can use that would result in the spline connecting properly?

 

angle sort.png

spline.png

Outcomes