[vtkusers] Modifying actor rotation behaviour

Jeff Baumes jeff.baumes at kitware.com
Fri Dec 18 11:16:20 EST 2009


On Fri, Dec 18, 2009 at 11:11 AM, Zamir Khan <zkhan at modusmed.com> wrote:
> Hi,
>
> I am using VTK to build what is likely best described as a compass control.
> A 2-d dial with labels and arrows. Most of the control is fixed in position
> (and the camera is fixed to view the X-Y plane only), but I want to allow
> the user to rotate the arrows about the center of the compass. Here is where
> I am running into problems. I need to:
>
> 1) Modify the arrow actor such that its rotation occurs about the bottom of
> its shaft rather than the center of the actor. However, it appears thus far
> that setting the origin of the actor merely moves the actor to another
> location in the scene, where it still rotates about its center. Am I
> misusing SetOrigin, or is there another way to make an actor rotate about a
> point that is not its center, when manipulated by the user?
>
> 2) Limit the rotation of the actor to stay within the x-y plane. My first
> thought is that I'll need to add an event handler to the appropriate
> callback for this actor, modifying any rotations to only rotate the object
> about the z-axis. Is there a better way? If not, if someone has done
> something similar before, what event would you recommend intercepting?

I'd suggest you take a look at vtkCompassWidget in VTK/Geovis.

Jeff



More information about the vtkusers mailing list