idllib

Personal IDL library for M. Galloy

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

analysis/

mg_linear_function.pro


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 and returns the coefficients.

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: Tue Sep 13 16:21:31 2011
Lines: 40
Docformat: rst rst
Personal library of Michael Galloy
Contact me if you have enhancement requests or bug fixes.