programming/
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.
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 Nov 29 18:34:16 2010 |
Lines: | 39 |
Docformat: | rst rst |