Remove points close to each other alone curve

I sort the points alone curve (a close loop rectangular)
I would like to remove some points if they are very close.
for example:
if point A DistanceTo point B is less than 1, remove point B and keep point A
if point B is a corner point remove point A and keep point B
Is a way to done this by dynamo nodes? suggestions. Thanks

I have it work this time with python scrip,but I think there should be a better way. I’m also new to python. any suggestions to my code would be appreciate. Thanks

Check out Point.PruneDuplicates.

1 Like

Thanks Nick
But how can I ensure the points right at the corner/a specific point is not being remove?

If there are certain points you need to make sure come through, I would recommend getting them before you prune your points and just adding them back to the list afterwards. This is really easy with corners because you can just grab the start/end points of the line.

1 Like

If you have a list of curves or just points in space which have created a polyline, then endpoints won’t likely work.

If that is the case you can try the following:

This basically creates a set of every possible combination of 3 points and attempts to make a surface, and grabs the second point from each of the set of 3 points when it was successful.

There are a few other ways to do this, some of which may be better suited for your specific situation.

  • Line by adjacent points and attempt to intersect with the middle point - if null it’s a corner.
  • Create a line by total length of all lines and vector of each curve in the network - if it doesn’t intersect the next point endpoint of the next curve it’s a corner.
  • Vector of each line compared to the vector of the next line in the list - if not equal it’s a corner.

I’m certain I missed other options, but I’d need more info about what you’re trying to do and where you started to know which method would be best in this situation.

You need only corners points or some along the curves? Or you wanna find points close to corner within some distance and remove?

sorry for the late reply guys.
yes, I add all corner points back after pruneDuplicates and remove points close to the corner by script. this trick works.

Thank Jacob
This project is kinds complicate for me to describe. (plus English is not my native language) So I was trying to break it up into smaller technical sectors when asking questions. I will start a new topic to explain what I like to achieve.
I think with all the helps form you guy I’m very close to it.