Closest point: why does the index not match between lists?

Something that’s been puzzling me, from a Closest point matching, I can’t use the index value, because it does not list the two corresponding points. Instead, I need to perform a second matching.


The closest points retrieved by the first component are correct, but the indices aren’t useable downstream as the file below demonstrates.


Closest point index.gh (11.8 KB)

in (A) you have created a data tree where -on each branch- one single item is missing

this means that depending on which branch you consider, you can either be in the situation where the matching item has a previous index -relative to the index that was culled- and in that case the indexes will just match (for instance at {0:5} )

or you can be in the case where the matching happens with an item that has already passed the culled index, and in that case all the remaining items have “index minus one” as one item was removed and they all have shifted one position backwards:

image

that is the reason why sometimes you get the correct match, and some other times you get the i-1 mismatch


[edit] I’d suggest to use Point Groups instead, which does what you are trying to achieve but uses just a single component :+1: then you can filter data in such a way isolated points (which are branches with a single item) are culled out:

Closest point index_Point_Groups.gh (22.0 KB)

final result is the same:

1 Like

Thanks! That’s a much better solution :slight_smile:

1 Like