Comparing points in a list is not working!

Hi guys,

I know it is a simple question but am stuck here, I want to delete duplication of points in a list so I used the node List.unique items and it is not working as shown. then I tried to compare 2 equal points from the list, they are actually equal but the test gives a false result I cant understand what is happening

Point.PruneDuplicates is your friend.

2 Likes

Hi @Andreas_Dieckmann

I tried this node it is also not working it should work in the example below right?

Have you tried setting a tolerance?

Yes I tried it but same outcome

Sounds like a bug. You should create a minimal reproducible example and submit it on GitHub:


In the meantime you could use this workaround:

@ali.safiaddine - You might not be getting the results you expect because your points might not be equal. So, a few tips:

(1) Even if your points appear to be equal in the preview/watch nodes they might not actually be equal because of the precision of the number format you have chosen. Take the example that I pasted below. These two points are actually off by 0.00002 in the Z, but due to the number format they both appear as 10.455 in the preview bubble.

(2) Additionally, the == node does not find equality of objects but if values are equal(typically booleans, numbers, or strings). To compare points, you could use the “Equals” node. For other geometry, you can try using the “Geometry.IsAlmostEqualTo” node (but it might not work as expected for complex geometry).

I have attached a dyn for you to play with if you want. Hope that helps.
EqualsGeometry.dyn (17.8 KB)

2 Likes

I know this thread is old, but your example with Point.PruneDuplicates is wrong. Your points are actually different: X1 = 19585.748 and X2 = 19385.748.
PruneDuplicates should work in your case.