Coordinate Conversions

Depending upon the data and type of visualization, you may want to convert between normalized, data or device coordinates (described in IDL Coordinate Systems). This section details two-dimensional and three-dimensional coordinate system characteristics and provides resources for various coordinate conversions. See the following for details:

Two-Dimensional Coordinate Conversion

This section describes the formulae for conversions to and from each coordinate system. In the following discussion, Dx is a data coordinate, Nx is a normalized coordinate, and Rx is a raw device coordinate. Let Vx and Vy represent the size of the visible area of the currently selected display or drawing surface.

The field S is a two-element array of scaling factors used to convert X coordinates from data units to normalized units. S contains the parameters of the linear equation, converting data coordinates to normalized coordinates. S[0] is the intercept, and S[1] is the slope. Also, let Dx be the data coordinate, Nx the normalized coordinate, Rx the device coordinate, Vx the device X size (in device coordinates).

With the above variables defined, the linear two-dimensional coordinate conversions for the x coordinate can be written as follows:

Table 5-1: Equations for X-axis Coordinate Conversion

Coordinate Conversion
Linear
Logarithmic

Data to normal

Coordinate_Conversions-01.jpg

Coordinate_Conversions-02.jpg

Data to device

Coordinate_Conversions-03.jpg

Coordinate_Conversions-04.jpg

Normal to device

Coordinate_Conversions-05.jpg

Coordinate_Conversions-06.jpg

Normal to data

Coordinate_Conversions-07.jpg

Coordinate_Conversions-08.jpg

Device to data

Coordinate_Conversions-09.jpg

Coordinate_Conversions-10.jpg

Device to normal

Coordinate_Conversions-11.jpg

Coordinate_Conversions-12.jpg

The y- and z-axis coordinates are converted in exactly the same manner, with the exception that there is no z device coordinate and that logarithmic z-axes are not permitted.

This coordinate conversion functionality is built into object graphics through the XCOORD_CONVERT and YCOORD_CONVERT properties or each type of visualization object. If you are working with a Direct Graphics display, you can use the CONVERT_COORD function.

Three-Dimensional Coordinate Conversion

To convert from a three-dimensional coordinate to a two-dimensional coordinate, IDL follows these steps:

Using Coordinate Conversions

How coordinate conversions are defined depend upon the display type as follows: