★ Rotating about non-origin point
posted Wed 7 Oct 2009 by Michael Galloy under IDL, Object graphicsIn object graphics, it is very easy to rotate graphics atoms around the origin using the IDLgrModel::rotate
method. But this rotation is always rotating around the origin. What if you want to rotate about a non-origin point? The technique is simple: translate the point of rotation to the origin, rotate, and translate back.
VISgrModel
(docs) is a replacement for IDLgrModel
that makes this a bit less of a hassle. It is created in the same way as IDLgrModel
and used like this:
model->rotate, [0, 1, 0], 1, about=[-0.5, 0., 0.]
The default value for ABOUT
is [0., 0., 0.]
, so it falls back to the standard IDLgrModel
behavior.