Welcome to the L3 Harris Geospatial documentation center. Here you will find reference guides and help documents.
﻿
>  Docs Center  >  Using IDL  >  Coordinate Conversions

### Coordinate Conversions

Coordinate Conversions

Depending upon the data and type of visualization, you may want to convert between normalized, data or device coordinates. 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:

 Coordinate Conversion Linear Logarithmic Data to normal Data to device Normal to device Normal to data Device to data Device to normal

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:

• Data coordinates are converted to three-dimensional normalized coordinates. To convert the x coordinate from data to normalized coordinates, use the formula Nx = X0 + X1Dx. The same process is used to convert the y and z coordinates using !Y.S and !Z.S.
• The three-dimensional normalized coordinate, P = (Nx, Ny, Nz), whose homogeneous representation is (Nx, Ny, Nz, 1), is multiplied by the concatenated transformation matrix !P.T:
• P′ = P!P.T
• The vector P′ is scaled by dividing by w, and the normalized two-dimensional coordinates are extracted:
• Nx = Px/Pw and Ny = Py/Pw
• The normalized xy coordinate is converted to device coordinates.

## Using Coordinate Conversions

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

• iTools: In an iTool display, the interactive nature of the tool makes coordinate conversions transparent. There is no need to programmatically configure the transformation matrices of the objects.
• Object Graphics: Converting an object’s data coordinates into normalized coordinates for display is a common task.
• Direct Graphics: The IDL Direct Graphics system automatically positions and sizes static visualizations so there is no need to set up a transformation matrix. However, you can convert between the supported coordinate systems.

© 2020 Harris Geospatial Solutions, Inc. |  Legal