The IDLgrModel::Scale procedure method scales the model by the specified scaling factors. IDL computes and maintains the resulting transform matrix in double-precision floating-point.

Syntax


Obj->[IDLgrModel::]Scale, Sx, Sy, Sz [, /PREMULTIPLY]

Arguments


Sx, Sy, Sz

The floating-point scaling factors in the x, y, and z dimensions by which the model is to be scaled. For example, specifying a value of 0.5 for Sx scales the model to 50% of its original size in the x dimension.

Note: Because scale factors are multiplied together with the three-dimensional transformation matrix, specifying negative values for Sx, Sy, or Sz has the effect of reversing the corresponding axis. For example, specifying a value of -1.0 for Sy leaves the scale unchanged at 100%, but flips the model around the y axis.

Keywords


PREMULTIPLY

Set this keyword to cause the scaling matrix specified by Sx, Sy, Sz to be pre-multiplied to the model’s transformation matrix. By default, the scaling matrix is post-multiplied.

Example


Changing the scale factors used by the IDLgrModel object is one way to change the “zoom” of a displayed graphic.

First, we create an IDLgrWindow containing a simple plot:

mywindow = OBJ_NEW('IDLgrWindow', RETAIN=2)
myview = OBJ_NEW('IDLgrView', VIEWPLANE_RECT=[-10,-10,20,20])
mymodel = OBJ_NEW('IDLgrModel')
x = (FINDGEN(21) / 10.0 - 1.0) * 10.0
y = RANDOMU(seed, 21) * 10.0 - 5.0
myplot1 = OBJ_NEW('IDLgrPlot', x, y)
myview->Add, mymodel
mymodel->Add, myplot1
mywindow->Draw, myview

Next, change the scale of the x dimension to 80% of the current value, leaving the scale in the y and z dimensions unchanged:

mymodel->Scale, .8, 1.0, 1.0
mywindow->Draw, myview

When you have finished with the example, destroy the IDLgrWindow and IDLgrView objects:

OBJ_DESTROY, mywindow
OBJ_DESTROY, myview

Version History


5.0

Introduced

See Also


Translating, Rotating and Scaling Objects