The problem with Point Index to Location and deleted points

This is a gotcha that has cost people some time

To demonstrate this, I’ve set up a simple point cloud where I Add Points using a grid primitive. I’ve added AttributeDisplay properties to the point cloud, to show the point IDs and PointPositions.

So far, so good. But if I now delete some points, notice how the point IDs don’t change (there’s none of that “reshuffling” of point IDs that the docs say will happen) because point IDs are unique. So after I delete every second point, my point IDs are 1, 3, 5, and 7, not 0, 1, 2, and 3.

Consequently, if I use Build Array from Point Data to build an array of point positions, I get the positions for points 0, 1, 2, 3, which is incorrect. For point IDs 0 and 2, all I get is (0,0,0).

The problem is that Point Index to Location returns a valid location even when I give it the ID of a deleted point but that location doesn’t resolve to the correct point position (Build Array from Point Data uses Point Index to Location to build the array).

One workaround would be to do something like this in Point Index to Location:

hat tip: Grahame Fuller