[vtkusers] Getting the transform matrix

D.M.P.Davies dmpd at onetel.net.uk
Tue Apr 29 14:22:59 EDT 2003



"Andrew J. P. Maclean" wrote:

> After performing a mouse interaction on a scene is it possible to get
> the transform matrix that is being used to update the actors in the
> scene?
>
In tcl where I want a vtkCutter (vTK_CUTF)  to face the camera  I do:-

vtkMatrix4x4 vTK_Matrix
Reset_Matrix  [camera GetViewTransformMatrix] vTK_Matrix
vtkMatrixToHomogeneousTransform vTK_MHT
              vTK_MHT SetInput  vTK_Matrix
vtkTransformPolyDataFilter vTK_PFilter
             vTK_PFilter SetInput [vTK_CUTF  GetOutput]
             vTK_PFilter SetTransform   [vTK_MHT GetInverse]

Where  the called  procedure is :

proc Reset_Matrix {  mat tempmat} {
        for {set i 0} {$i < 3} {incr i} {
       for {set j 0} {$j < 3} {incr j} {
               eval "$tempmat  SetElement $i $j [$mat GetElement $i $j]"

                                }
                            }
                                                        }

It works but you have to fix your own translations (i.e cols and rows 4
in the proc.)

Hope This Helps

Dave Davies
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20030429/274983b3/attachment.htm>


More information about the vtkusers mailing list