[vtkusers] origin problems

bthomas bthomas at engineering.uiowa.edu
Wed Jun 12 14:12:20 EDT 2002


I am helping to develop a image rendering tool using python and vtk.  I have 
set up the rendering window so that rotations actually rotate the objects in 
the scene and not the camera.  Now I am trying to put in text and write a 
method that will allow my text to be similar to a vtkFollower object where it 
always faces the camera.  The problem is I can't seem to change the origin of 
the text object so I can rotate it about its local origin instead of the world 
origin so I end up just getting text that doesn't move at all because it 
negates the original rotation.  Is it only possible to have one origin for all 
rotations or can I have a seperate origin for each object that can be changed?

This is part of my code:

    def FaceCamera(self, w, x, y, z):
	""" used for text so that it rotates back about its local axis to face
  the camera"""

	origin = self.actor.GetOrigin()
	self.actor.SetOrigin(self.localOrigin[0], self.localOrigin[1],            
self.localOrigin[2])
	#rotate opposite original rotation about own origin
	self.actor.RotateWXYZ(-w, x, y, z)
	self.actor.SetOrigin(origin[0], origin[1], origin[2])

But the rotation takes place about the origin instead of the self.localOrigin.
 Why?

Thanks for any help.

Benjamin Thomas




More information about the vtkusers mailing list