List.AllIndicesOf not working

I have a graph where I am using ClosetPointTo. This generated a list of points. I am then comparing that to a list of vertices for several polycurves. I am then trying to find the index of each of the points from the closestTo list on the polycurve list. I have 13 polycurves. When I plug these into the List.AllIndiciesOf node, it gives results for 8 points, but for some reason 5 of them are coming up as empty lists. However, if I visually inspect, there is a match. So I cannot figure out why it will not report it. (See index 6 in the attached image as an example).

Any suggestions are welcome. Thank you.

@Paul_Aubin You could try to deconstruct the points and reconstruct with rounded off coordinates.

Hrmm, so even though they look the same in the watch, you think that maybe one version is reporting more decimal places than the other so they come up as different.

So I would extract the X, Y and Z coordinates, round them off, then reassemble them as points and try again?

OK, I’ll give it a go. Thanks.

Very weird. The Y coordinate is supposed to be zero for everything. But somehow on some of the points it is off. When it says e-13 or something is really small scientific notation right?

3.22550164997579e-14 is 3.22550164997579 x 10^-14 (10 to the power of -14)
It is a very small number, effectively 0.

Right. That’s what I figured. Well, I am just replacing them with actual zeros. Thanks.

Two quick comments:

  1. Try to use “Geometry.IsAlmostEqualTo” instead of "AllIndicesOf"
    2)If you need to round the point coordinates, clockwork has a “Point.RoundToPrecision” node.

Thanks. I will give that a try later today.

I have been meaning to post about Clockwork as well, when I install it, my Code Blocks go blank and you can’t type anything in. I think it needs an update. I am using 1.1.


I tried IsAlmostEqualTo and it all came up false, so I suppose I would have to use this on each component of the point. Meanwhile, Zach Kron and I were speaking and he gave me an alternative approach to what I was trying to do. He suggested Geometry.DistanceTo instead of ClosetPointTo. And also, using IndexOf as the combinator for a List.Combine. I never knew you could even do that!
It is now giving me what I need!

Thanks for all the help everyone. Always appreciated!

@Paul_Aubin An alternate approach without IndexOf or ClosestPointTo

Cool. Thanks.

1 Like