How to get Index of points for terrain in the path of sspline?

Continuing the discussion from How to get points index for plane in The path of spline?: