[vtkusers] Rotation matrix 4x4

Jothybasu Selvaraj jothybasu at gmail.com
Fri Feb 10 04:17:10 EST 2012


Can you try mapper.ScalarVisibilityOff() ?

Jothy

On Fri, Feb 10, 2012 at 9:06 AM, Oldřich Švec <oldrich.svec at centrum.cz>wrote:

>
> I try to rotate a sphere by a rotation matrix. For that I have 3 vectors
> (R1, R2, R3) representing 3 axes of the rotated coordinate system. I create
> the rotation matrix in the following way:
>
> R1X R2X R3X  0
> R1Y R2Y R3Y  0
> R1Z R2Z R3Z  0
> 0      0       0       1
>
> When I rotate the sphere, the sphere becomes black. See the code bellow.
> Do you have any idea why it becomes black?
>
> open Kitware.VTK
>
> let sphereSource = vtkSphereSource.New()
> let fil = new vtkTransformPolyDataFilter ()
> let tr = new vtkTransform ()
>
> let mat = vtkMatrix4x4.New ()
> mat.SetElement(0,0,-0.404)
> mat.SetElement(1,0,0.0763)
> mat.SetElement(2,0,0.912)
> mat.SetElement(0,1,-0.777)
> mat.SetElement(1,1,0.498)
> mat.SetElement(2,1,-0.385)
> mat.SetElement(0,2,0.484)
> mat.SetElement(1,2,0.864)
> mat.SetElement(2,2,0.142)
> mat.SetElement (3,3,1.)
>
> tr.SetMatrix mat
> fil.SetTransform tr
> fil.SetInputConnection (sphereSource.GetOutputPort())
>
> let mapper = vtkPolyDataMapper.New()
> mapper.SetInputConnection (fil.GetOutputPort())
> let actor = vtkActor.New()
> actor.SetMapper mapper
>
> let renderer = vtkRenderer.New()
> let renderWindow = vtkRenderWindow.New()
> renderWindow.AddRenderer renderer
> let renderWindowInteractor = vtkRenderWindowInteractor.New()
> renderWindowInteractor.SetRenderWindow renderWindow
>
> renderer.AddActor actor
>
> renderer.ResetCamera()
> renderWindow.Render()
> renderWindowInteractor.Start()
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>



-- 
Jothy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20120210/a217bc89/attachment.htm>


More information about the vtkusers mailing list