COORD2TO3

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 coord2to3.pro in the lib subdirectory of the IDL distribution.

Calling Sequence

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

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.

Example

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

CONVERT_COORD , CREATE_VIEW , CV_COORD , SCALE3 , T3D