The COORD2TO3 function converts normalized X and Y screen coordinates to 3D 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 coord2to3.pro in the lib subdirectory of the IDL distribution.

Examples


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

;Make sure a transformation matrix exists.
CREATE_VIEW
XYOUTS, 0.5, [0.55, 0.50], ALIGNMENT=0.5, CHARSIZE=2.0, $
   ['Click in the window to display', $
   'mouse position in data coordinates']
;Get the normalized mouse coords.
CURSOR, X, Y, /NORM
;Print the 3D coordinates.
PRINT, COORD2TO3(X, Y, 2, 10.0)

Syntax


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

Return Value


Returns a three-element vector containing 3D data coordinates given the normalized X and Y screen coordinates and one of the three data coordinates.

Arguments


Mx, My

The normalized X and Y screen coordinates.

Dim

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.

D0

The value of the fixed data coordinate.

PTI

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.

Keywords


None.

See Also


CROSSP, CV_COORD