How does GetCursorPos() really work?

Hi All!
I am new here on the Rhino forum, however I am not new Rhino user.
Recently I started to play with Python scripting and now I wonder how does the GetCursorPos() function work, more precisely: in what way are 2D screen coordinates translated to world/3D coordinates?

I’ve created a script that puts a line between camera position and cursor position:

import rhinoscriptsyntax as rs
def main():
    something=rs.GetPoint("indicate point")
    cursordata=rs.GetCursorPos()
    if not cursordata: return
    rs.AddLine(rs.ViewCamera(),cursordata[0])
if __name__ =="__main__":
    main()

The effect is visible below:


Here I “shooted” lines towards the same object (camera target was set at it), with the same zoom, but at different angles. And lengths of the lines are completely different!
Can anybody answer how is depth of the cursor position calculated in the GetCursorPos() function?

Regards,
Andrzej