Sort point cloud XYZ - to best fit lines

I’m trying to sort a slice of point cloud to create best fit lines in the points as shown below. Tried sorting, shuffeling, grouping in various reasons (for example sort points as perimeter by sastrugi) but I’m stuck on this for waaay too long. Does someone have any idea how to get this to work? :slight_smile:

1 Like

(@Marcel_Rijsmus, I need #sastrugi to be a thing :smile:)

Not at the PC, but give this a go.

  1. Use Point.Average from the clockwork package on your point data set.

  2. Sort the points by Distance.To this new center point.

  3. Take the first 100 or so closest points. This should give you 4 point groups, each about halfway along the square sides.

  4. Create Vectors from the center point to each of the 100 points.

  5. Group the vectors/points by their Vector.AngleWithVector to the X or Y axis of the Dynamo coordinate system (or generate a new plane using the Plane.ByBestFitThroughPoints on your point data set and use its X or Y axis)

  6. Use the Line.ByBestFitThroughPoints node on these new point groups.

  7. Extend the lines to create a new square profile that is an approximation of the input cloud point geometry.

Hope that helps :wink:




@Ewan_Opie Thank you, thou got stuck at grouping / sorting…

I imagine this might work (got to a point where 2 walls are sorted out / not grouped thou :p)
Got any idea about how this might work for more complex shapes? not only square slices of cloud points?

1 Like

The workflow as described above. :sunglasses:
(For different shapes more advanced sorting is required)



thanks works perfectly :slight_smile: as usuall :wink:

What I’m after is to create whole floor sections - gonna have to think it over thou, for more complicated shapes.
Thanks again

1 Like