[vtkusers] transformation problem on vtkActor &vtkBoxWidget

Kevin Tiow Wee Tan twtan at cheerful.com
Wed Feb 12 14:07:36 EST 2003


Hi Will,
Thanks for the new .cxx file... That new file definitely fixed the
problem...

I am now require combining a few actors into one single one vtkAssembly,
then used SetProp3D method to add this vtkAssembly into one single
vtkBoxWidget.  The vtkBoxWidget fitted the outline perfectly around all
the actors (which is very nice), all actors are manipulate the same time
but similar problem occurs on rotation and scaling...  Seems to me like
the actors getting out from the vtkBoxWidget outline...

Can you please advice what shall I do with this problem ?  Any advice
would be much appreciated...

I had also attached my code at the end of the mail...

By the way, according to the help on vtkAssembly, it is advisable to use
vtkPropAssembly regarding to rendering efficiency.  However, I don't
think I can use vtkPropAssembly because vtkBoxWidget does not allow
adding vtkPropAssembly... 

Is that possible to add extra method for that?


package require vtk

vtkConeSource cone1
cone1 SetDirection 0 1 0

vtkPolyDataMapper coneMapper1
coneMapper1 SetInput [cone1 GetOutput]

vtkActor coneActor1
coneActor1 SetMapper coneMapper1
coneActor1 SetPosition 5 0 0

vtkConeSource cone2
cone2 SetDirection 0 1 0

vtkPolyDataMapper coneMapper2
coneMapper2 SetInput [cone2 GetOutput]

vtkActor coneActor2
coneActor2 SetMapper coneMapper2

vtkConeSource cone3
cone3 SetDirection 0 1 0

vtkPolyDataMapper coneMapper3
coneMapper3 SetInput [cone3 GetOutput]

vtkActor coneActor3
coneActor3 SetMapper coneMapper3
coneActor3 SetPosition 10 0 0

#vtkPropAssembly cones
vtkAssembly cones
cones AddPart coneActor1
cones AddPart coneActor2
cones AddPart coneActor3
cones SetPosition 0 4 0

vtkRenderer ren1 
ren1 AddActor cones
ren1 SetBackground 0.1 0.2 0.4

vtkRenderWindow renWin
renWin AddRenderer ren1
renWin SetSize 300 300

vtkRenderWindowInteractor iren
iren SetRenderWindow renWin

vtkInteractorStyleTrackballCamera style
iren SetInteractorStyle style

vtkBoxWidget boxWidget
boxWidget SetInteractor iren
boxWidget SetPlaceFactor 1.25

boxWidget SetProp3D cones
boxWidget PlaceWidget
boxWidget AddObserver InteractionEvent TransformActor
boxWidget On

iren AddObserver UserEvent {wm deiconify .vtkInteract}

iren Initialize

wm withdraw .

vtkTransform t
proc TransformActor {} {
   boxWidget GetTransform t
   cones SetUserTransform t

#without using SetUserTransform method on the cones,
#the following lines work perfectly on the old vtkBoxWidget code
#BUT ONLY when the vtkAssembly does not use SetPosition at initial
#   cones SetOrigin 5 0 0
#   set bounds [t GetOrientation]
#   cones SetOrientation [lindex $bounds 0]  [lindex $bounds 1] [lindex
$bounds 2] 
#   set bounds [t GetScale]
#   cones SetScale [lindex $bounds 0]  [lindex $bounds 1] [lindex
$bounds 2] 
#   set bounds [t GetPosition]
#   cones SetPosition [lindex $bounds 0]  [lindex $bounds 1] [lindex
$bounds 2] 

}


Will Schroeder wrote:
> 
> Hi Kevin-
> 
> This is a bug. I appreciate your feedback. I have fixed the problem....can
> you test it for me? (i.e., are you compiling the source code?) Here's a new
> .cxx file.
> 
> Will
> 

--
Thanks
Kevin
**********************************
Manchester Material Science Centre
University of Manchester
----------------------------------
Centre for Virtual Environments
University of Salford
**********************************



More information about the vtkusers mailing list