I don't know what you're using pb_MatrixFilter for (Never seen that compound before), but basically what you are doing is: For each point on the curve you get the closest location on the sphere, output the closest position of the point that is the closest to the sphere. However, you are comparing the x/y/z values of the vector between the point and the closest location rather than comparing their DISTANCE. You want to plug the vector into a length node first.
The result of this operation will depend on which happens to be nearest to the sphere, so it's not really a usable solution. You must remember that getting the pointposition of a curve returns the CONTROL POINTS, not smoothed points along the curve.
____________
At the beginning of the ice tree we use UV to Location to get a number of smooth positions along the curve. UV to Location + array of values between 0-1 = object-context array of smoothed point positions along curve.
Normally could have each of these points get the vector to the next point in the array and raycast against the sphere to get our intersections. However, because the array is in the object context (just a long array of positions) this would be single-threaded. Softimage also has a tendency to crash if you try to plug multiple arrays into raycast (even in 2015). So instead of doing this we generate a sample set.
A sample set is essentially identical to a particle, in that each particle can store values separately from the other particles, and can be executed independently too. Generate Sample set will generate one of these "particles" for each item in the array of positions, then, using its own index, each sample will select the values of one of these points.
This takes of from this:
For object
position 1
position 2
position 3
position 4
...
To this:
For object
Sample 1
position 1
Sample 2
position 2
Sample 3
position 3
...
We do the same for the vector from each position to the next position, and then we simply have each sample perform a single raycast operation. Building an array from this set of data gives us
an array of intersections along the curve. You will need to keep in mind that the order of these intersections will depend on the location of the first control point of the curve. The first intersection in the array will be the first intersection starting from CP0