So the index of the x,y and z vectors is not their location in the 3D world, but their joint values are, yet you are using the vector index as a position:
Yes, you are right about confusing.

but what 'somevalue' is, I don't know, its not visible in your code, maybe reflectance[i]?
No, in qvector x, y and z are the coordinates in a real 3D space of the points of the surface.