<div dir="ltr">You'll need to translate your cube by the negated center of the cube, then rotate. You can do this all in the same vtkTransform object.<div><br></div><div>- Cory</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jul 22, 2015 at 1:58 PM, ishantembhekar <span dir="ltr"><<a href="mailto:ishan.tembhekar@caltech.edu" target="_blank">ishan.tembhekar@caltech.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><<a href="http://vtk.1045678.n5.nabble.com/file/n5733047/Screen_Shot_2015-07-22_at_10.png" rel="noreferrer" target="_blank">http://vtk.1045678.n5.nabble.com/file/n5733047/Screen_Shot_2015-07-22_at_10.png</a>><br>
<br>
Hi Cory,<br>
<br>
Thank you so much for your immediate response! The<br>
vtkTransformPolyDataFilter worked and it now gives me a rotated cube. I<br>
replaced the mapper and the actor with the following lines:<br>
<br>
//create a rotation object<br>
    vtkSmartPointer<vtkTransform> rotation =<br>
      vtkSmartPointer<vtkTransform>::New();<br>
    //the angle is measured in degrees for some reason<br>
    rotation->RotateZ(45.);<br>
 //use this rotation object in a transformFilter<br>
    vtkSmartPointer<vtkTransformPolyDataFilter> transformFilter =<br>
      vtkSmartPointer<vtkTransformPolyDataFilter>::New();<br>
    transformFilter->SetInputConnection(cubeSource->GetOutputPort());<br>
    transformFilter->SetTransform(rotation);<br>
    transformFilter->Update();<br>
<br>
However, it is rotating about the z-axis and the origin (as shown in the<br>
image I attached). What can I do for it to rotate about the center of the<br>
cube? I tried using SetCenter for both the vtkTransform and the<br>
PolyDataFilter but they do not have that method. Any ideas?<br>
<br>
Thanks once again!<br>
<br>
-Ishan<br>
<br>
<br>
<br>
--<br>
View this message in context: <a href="http://vtk.1045678.n5.nabble.com/Writing-a-rotated-vtkcubesource-in-a-vtp-file-tp5733044p5733047.html" rel="noreferrer" target="_blank">http://vtk.1045678.n5.nabble.com/Writing-a-rotated-vtkcubesource-in-a-vtp-file-tp5733044p5733047.html</a><br>
Sent from the VTK - Users mailing list archive at Nabble.com.<br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<span class="im HOEnZb"><br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
</span><span class="im HOEnZb">Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" rel="noreferrer" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
</span><span class="im HOEnZb">Search the list archives at: <a href="http://markmail.org/search/?q=vtkusers" rel="noreferrer" target="_blank">http://markmail.org/search/?q=vtkusers</a><br>
<br>
</span><div class="HOEnZb"><div class="h5">Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/vtkusers" rel="noreferrer" target="_blank">http://public.kitware.com/mailman/listinfo/vtkusers</a><br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature">Cory Quammen<br>R&D Engineer<br>Kitware, Inc.</div>
</div>