The COORD2TO3 function returns a three-element vector containing 3D data coordinates given the normalized X and Y screen coordinates and one of the three data coordinates. Note: A valid 3D transform must exist in !P.T or be specified by the PTI keyword. The axis scaling variables, !X.S, !Y.S and !Z.S must be valid.

This routine is written in the IDL language. Its source code can be found in the file in the lib subdirectory of the IDL distribution.

Calling Sequence

Result = COORD2TO3( Mx, My, Dim, D0 [, PTI] )


Mx, My

The normalized X and Y screen coordinates.


A parameter used to specify which data coordinate is fixed. Use 0 for a fixed X data coordinate, 1 for a fixed Y data coordinate, or 2 for a fixed Z data coordinate.


The value of the fixed data coordinate.


The inverse of !P.T. If this parameter is not supplied, or set to 0, COORD2TO3 computes the inverse. If this routine is to be used in a loop, the caller should supply PTI for highest efficiency.


To return the data coordinates of the mouse, fixing the data Z value at 10, enter the commands:

CREATE_VIEW ; Make sure a transformation matrix exists.

CURSOR, X, Y, /NORM ; Get the normalized mouse coords.

PRINT, COORD2TO3(X, Y, 2, 10.0) ; Print the 3D coordinates.

See Also