Modern IDL by Michael Galloy

API documentation for example code

single page | use frames     summary     class     fields     routine details     file attributes

programming/

mg_linear_function.pro


Routines

top source mg_linear_function

result = mg_linear_function(in_range, out_range)

Create a function which maps in_range to out_range with a linear function.

Return value

2-element array of type of in_range and out_range

Parameters

in_range in required type=2-element numeric array

input range

out_range in required type=2-element numeric array

output range

Examples

To create a linear function that maps the x-range of a surface object to the range -0.75 to 0.75 use:

osurface->getProperty, xrange=xr xc = mg_linear_function(xr, [-0.75, 0.75]) osurface->setProperty, xcoord_conv=xc
This provides a more flexible method of creating linear functions than the typical:
osurface->getProperty, xrange=xr xc = norm_coord(xr) xr[0] -= 0.5 osurface->setProperty, xcoord_conv
which can only "normalize" the dimension i.e. make its size equal to 1 (not an aribitrary size like the MG_LINEAR_FUNCTION example).

File attributes

Modification date: Mon Apr 28 23:24:21 2008
Lines: 5
Docformat: rst rst