<html><body><div style="color:#000; background-color:#fff; font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:12pt"><div><span>I realize I could put a stack of transforms in my interactor style, but looking at the source code, I get the impression that the possibility is already built into vtkTransform and I would like to take advantage of this</span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;"><br><span></span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;"><span>Maarten<br></span></div> <div class="qtdSeparateBR"><br><br></div><div style="display: block;" class="yahoo_quoted"> <div style="font-family: HelveticaNeue,
Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 12pt;"> <div style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 12pt;"> <div dir="ltr"> <font face="Arial" size="2"> On Monday, August 11, 2014 4:18:29 PM, "Meehan, Bernard" <MEEHANBT@nv.doe.gov> wrote:<br> </font> </div> <br><br> <div class="y_msg_container"><div id="yiv2858007659">
<div>
<div>forgot to hit reply all</div>
<div><br>
</div>
<span id="yiv2858007659OLK_SRC_BODY_SECTION">
<div style="font-family:Calibri;font-size:11pt;text-align:left;color:black;BORDER-BOTTOM:medium none;BORDER-LEFT:medium none;PADDING-BOTTOM:0in;PADDING-LEFT:0in;PADDING-RIGHT:0in;BORDER-TOP:#b5c4df 1pt solid;BORDER-RIGHT:medium none;PADDING-TOP:3pt;">
<span style="font-weight:bold;">From: </span><Meehan>, Tim Meehan <<a rel="nofollow" ymailto="mailto:meehanbt@nv.doe.gov" target="_blank" href="mailto:meehanbt@nv.doe.gov">meehanbt@nv.doe.gov</a>><br>
<span style="font-weight:bold;">Date: </span>Monday, August 11, 2014 12:59 PM<br>
<span style="font-weight:bold;">To: </span>Maarten Beek <<a rel="nofollow" ymailto="mailto:beekmaarten@yahoo.com" target="_blank" href="mailto:beekmaarten@yahoo.com">beekmaarten@yahoo.com</a>><br>
<span style="font-weight:bold;">Subject: </span>Re: [vtkusers] vtkTransform::Pop() and vtkTransform::Push()<br>
</div>
<div><br>
</div>
<div>
<div style="word-wrap:break-word;color:rgb(0, 0, 0);font-size:14px;font-family:Georgia, sans-serif;">
<div>Most of the transforms that I end up messing with look similar to:</div>
<div><a rel="nofollow" target="_blank" href="http://www.vtk.org/Wiki/VTK/Examples/Cxx/Widgets/AffineWidget">http://www.vtk.org/Wiki/VTK/Examples/Cxx/Widgets/AffineWidget</a></div>
<div><br>
</div>
<div>I'm not entirely sure how to use the Push/Pop thing ... can't figure out what the transform stack is either.</div>
<div><br>
</div>
<div>For the "undo" case, it seems like you could just copy the actors original transform. You then would operate directly on the actor's transform ... and if you decide that you liked it the way the old transform had it set up, just set the actors transform
to be the stored copy.</div>
<div><br>
</div>
<div>I haven't run or tested this, but perhaps something like:</div>
<div>
<div><br>
</div>
<div>cone = vtk.vtkConeSource()</div>
<div>mapper = vtk.vtkPolyDataMapper()</div>
<div>mapper.SetInputConnection(cone.GetOutputPort())</div>
<div><br>
</div>
<div>actor = vtk.vtkActor()</div>
<div>actor.SetMapper(mapper)</div>
<div><br>
</div>
<div>old_transform = vtkTransform()</div>
<div>if actor.GetUserTransform() is not None:</div>
<div> old_transform.DeepCopy(actor.GetUserTransform())</div>
</div>
<div><br>
</div>
<div><do stuff with the actor></div>
<div><br>
</div>
<div><set the transform to the old transform></div>
<div>actor.SetUserTransform(old_transform)</div>
<div><br>
</div>
<div><br>
</div>
<span id="yiv2858007659OLK_SRC_BODY_SECTION">
<div style="font-family:Calibri;font-size:11pt;text-align:left;color:black;BORDER-BOTTOM:medium none;BORDER-LEFT:medium none;PADDING-BOTTOM:0in;PADDING-LEFT:0in;PADDING-RIGHT:0in;BORDER-TOP:#b5c4df 1pt solid;BORDER-RIGHT:medium none;PADDING-TOP:3pt;">
<span style="font-weight:bold;">From: </span>Maarten Beek <<a rel="nofollow" ymailto="mailto:beekmaarten@yahoo.com" target="_blank" href="mailto:beekmaarten@yahoo.com">beekmaarten@yahoo.com</a>><br>
<span style="font-weight:bold;">Reply-To: </span>Maarten Beek <<a rel="nofollow" ymailto="mailto:beekmaarten@yahoo.com" target="_blank" href="mailto:beekmaarten@yahoo.com">beekmaarten@yahoo.com</a>><br>
<span style="font-weight:bold;">Date: </span>Monday, August 11, 2014 11:35 AM<br>
<span style="font-weight:bold;">To: </span>Tim Meehan <<a rel="nofollow" ymailto="mailto:meehanbt@nv.doe.gov" target="_blank" href="mailto:meehanbt@nv.doe.gov">meehanbt@nv.doe.gov</a>>, vtkusers <<a rel="nofollow" ymailto="mailto:vtkusers@vtk.org" target="_blank" href="mailto:vtkusers@vtk.org">vtkusers@vtk.org</a>><br>
<span style="font-weight:bold;">Subject: </span>Re: [vtkusers] vtkTransform::Pop() and vtkTransform::Push()<br>
</div>
<div><br>
</div>
<div>
<div>
<div style="color:#000;background-color:#fff;font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:12pt;">
<div><span>Aaa</span></div>
<div style="color:rgb(0, 0, 0);font-size:16px;font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;background-color:transparent;font-style:normal;">
<span>So I wouldn't be using:</span></div>
<div style="color:rgb(0, 0, 0);font-size:16px;font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;background-color:transparent;font-style:normal;">
<br>
<span></span></div>
<div style="color:rgb(0, 0, 0);font-size:16px;font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;background-color:transparent;font-style:normal;">
<span>vtkTransform* Y = vtkTransform::New();</span></div>
<div style="color:rgb(0, 0, 0);font-size:16px;font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;background-color:transparent;font-style:normal;">
<span>< do stuff with Y ></span></div>
<div style="color:rgb(0, 0, 0);font-size:16px;font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;background-color:transparent;font-style:normal;">
<span>X->Concatenate(Y);</span></div>
<div style="color:rgb(0, 0, 0);font-size:16px;font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;background-color:transparent;font-style:normal;">
<span>X->Push();</span></div>
<div style="color:rgb(0, 0, 0);font-size:16px;font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;background-color:transparent;font-style:normal;">
<span>Y->Delete();</span></div>
<div style="color:rgb(0, 0, 0);font-size:16px;font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;
background-color:transparent;font-style:normal;">
<br>
<span></span></div>
<div style="color:rgb(0, 0, 0);font-size:16px;font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;background-color:transparent;font-style:normal;">
<span>(X would be the usertransform of the actor - Y the subtransformation created by interaction)</span></div>
<div style="color:rgb(0, 0, 0);font-size:16px;font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;background-color:transparent;font-style:normal;">
<br>
<span></span></div>
<div style="color:rgb(0, 0, 0);font-size:16px;font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;background-color:transparent;font-style:normal;">
<span>Maarten<br>
</span></div>
<div style="color:rgb(0, 0, 0);font-size:16px;font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;background-color:transparent;
font-style:normal;">
<span><br>
</span></div>
<div class="yiv2858007659qtdSeparateBR"><br>
<br>
</div>
<div style="display:block;" class="yiv2858007659yahoo_quoted">
<div style="font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:12pt;">
<div style="font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:12pt;">
<div dir="ltr"><font face="Arial" size="2">On Monday, August 11, 2014 2:18:39 PM, "Meehan, Bernard" <<a rel="nofollow" ymailto="mailto:MEEHANBT@nv.doe.gov" target="_blank" href="mailto:MEEHANBT@nv.doe.gov">MEEHANBT@nv.doe.gov</a>> wrote:<br>
</font></div>
<br>
<br>
<div class="yiv2858007659y_msg_container">
<div id="yiv2858007659">
<div>
<div><br>
</div>
<div>Are you pre-multiplying or post-multiplying your transformations?</div>
<div>I got tangled up a bit before I realized that the default mode was premultiply ... which means that if you do this:</div>
<div><br>
</div>
<div>xform = vtk.vtkTransform()</div>
<div>xform.Push(A)</div>
<div>xform.Push(B)</div>
<div>xform.Push(C)</div>
<div><br>
</div>
<div>you get the following matrix operation on the vector x:</div>
<div><br>
</div>
<div>A B C x</div>
<div><br>
</div>
<div>when you might have wanted:</div>
<div><br>
</div>
<div>xform.PostMultiply()</div>
<div>
<div>xform.Push(A)</div>
<div>xform.Push(B)</div>
<div>xform.Push(C)</div>
</div>
<div><br>
</div>
<div>which would give you:</div>
<div><br>
</div>
<div>C B A x</div>
<span id="yiv2858007659OLK_SRC_BODY_SECTION">
<div style="font-family:Calibri;font-size:11pt;text-align:left;color:black;BORDER-BOTTOM:medium none;BORDER-LEFT:medium none;PADDING-BOTTOM:0in;PADDING-LEFT:0in;PADDING-RIGHT:0in;BORDER-TOP:#b5c4df 1pt solid;BORDER-RIGHT:medium none;PADDING-TOP:3pt;">
<span style="font-weight:bold;">From: </span>Maarten Beek via vtkusers <<a rel="nofollow" ymailto="mailto:vtkusers@vtk.org" target="_blank" href="mailto:vtkusers@vtk.org">vtkusers@vtk.org</a>><br>
<span style="font-weight:bold;">Reply-To: </span>Maarten Beek <<a rel="nofollow" ymailto="mailto:beekmaarten@yahoo.com" target="_blank" href="mailto:beekmaarten@yahoo.com">beekmaarten@yahoo.com</a>><br>
<span style="font-weight:bold;">Date: </span>Monday, August 11, 2014 10:49 AM<br>
<span style="font-weight:bold;">To: </span>vtkusers <<a rel="nofollow" ymailto="mailto:vtkusers@vtk.org" target="_blank" href="mailto:vtkusers@vtk.org">vtkusers@vtk.org</a>><br>
<span style="font-weight:bold;">Subject: </span>[vtkusers] vtkTransform::Pop() and vtkTransform::Push()<br>
</div>
<div><br>
</div>
<div>
<div>
<div style="color:#000;background-color:#fff;font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:12pt;">
<div>Hi all,</div>
<div><br>
</div>
<div style="color:rgb(0, 0, 0);font-size:16px;font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;background-color:transparent;font-style:normal;">
I am trying to get some king of 'undo' feature in my interactor style, so that Ctrl-Z would undo the last transformation to the currently selected actor. I am currently looking at vtkTransform::Push()) and Pop(), but haven't been able to get something working.
<br>
</div>
<div style="color:rgb(0, 0, 0);font-size:16px;font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;background-color:transparent;font-style:normal;">
<br>
</div>
<div style="color:rgb(0, 0, 0);font-size:16px;font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;background-color:transparent;font-style:normal;">
Any suggestions?</div>
<div style="color:rgb(0, 0, 0);font-size:16px;font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;background-color:transparent;font-style:normal;">
<br>
</div>
<div style="color:rgb(0, 0, 0);font-size:16px;font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;background-color:transparent;font-style:normal;">
Another way of phrasing my question would be: How am I supposed to use the Pop() and Push() functions?<br>
</div>
<div style="color:rgb(0, 0, 0);font-size:16px;font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;background-color:transparent;font-style:normal;">
<br>
</div>
<div style="color:rgb(0, 0, 0);font-size:16px;font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;background-color:transparent;font-style:normal;">
Thanks - Maarten</div>
</div>
</div>
</div>
</span></div>
</div>
<br>
_______________________________________________<br>
Powered by www.kitware.com<br>
<br>
Visit other Kitware open-source projects at <a rel="nofollow" target="_blank" href="http://www.kitware.com/opensource/opensource.html">
http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a rel="nofollow" target="_blank" href="http://www.vtk.org/Wiki/VTK_FAQ">
http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a rel="nofollow" target="_blank" href="http://public.kitware.com/mailman/listinfo/vtkusers">http://public.kitware.com/mailman/listinfo/vtkusers</a><br>
<br>
<br>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</span></div>
</div>
</span>
</div>
</div><br>_______________________________________________<br>Powered by www.kitware.com<br><br>Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br><br>Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br><br>Follow this link to subscribe/unsubscribe:<br><a href="http://public.kitware.com/mailman/listinfo/vtkusers" target="_blank">http://public.kitware.com/mailman/listinfo/vtkusers</a><br><br><br></div> </div> </div> </div> </div></body></html>