How to select vertices with a specific colour, and fit curve through a subset of these vertices?


Hi all,
I’m currently trying to write a grasshopper definition that takes a mesh (3d scan imported as an obj file with color) and converts coloured lines on the mesh to curves.

I’m able to get only the vertices with a certain color. But in a next step i want to fit a curve through a subset of these vertices.

In rhino this works fine with the CurveThroughPt command.

But when i try to achieve the same in grasshopper I end up with a curve like the one in the image below.

I guess the problem is that the points in my list are not in the right order.
I’ve been searching the forum but i cannot find a good way to solve this.
color based (2.6 MB)



In this case, Sequential Closest Points from neoarchaic could be useful.

color based (2.6 MB)


That’s exactly what i was looking for