<div dir="ltr">Hi Chiranjib,<div><br></div><div>The actor's Rotate methods are inherited from vtkProp3D, but the code that you</div><div>show is from vtkTransform.</div><div><br></div><div>The actor's RotateWXYZ method commutes the matrices (i.e. multiplies them in</div><div>a different order) as compared to the RotateX,Y,Z methods. The original author</div><div>might have had a reason for doing this, but I doubt it was a good enough reason</div><div>to justify the confusion that this method causes...</div><div><br></div><div>You can use SetUserMatrix as follows:</div><div><br></div><div>actor->SetUserMatrix(transform->GetMatrix());</div><div><br></div><div> - David</div><div> </div><div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Sep 29, 2015 at 4:46 AM, Chiranjib Sur <span dir="ltr"><<a href="mailto:sur.chiranjib@gmail.com" target="_blank">sur.chiranjib@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi,<div>The implementation of the rotation transform are as follows (from vtkTransform.h file : URL <a href="https://github.com/Kitware/VTK/blob/master/Common/Transforms/vtkTransform.h" target="_blank">https://github.com/Kitware/VTK/blob/master/Common/Transforms/vtkTransform.h</a>)</div><div><br></div><div><table style="border-collapse:collapse;border-spacing:0px;color:rgb(51,51,51);font-family:Helvetica,arial,nimbussansl,liberationsans,freesans,clean,sans-serif,'Segoe UI Emoji','Segoe UI Symbol';font-size:13px;line-height:18.2px"><tbody><tr><td style="padding:0px 10px;vertical-align:top;overflow:visible;word-wrap:normal"> <span style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;white-space:pre-wrap;color:rgb(167,29,93)"> void</span> <span style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;white-space:pre-wrap;color:rgb(121,93,163)">RotateX</span><font face="Consolas, Liberation Mono, Menlo, Courier, monospace"><span style="font-size:12px;white-space:pre-wrap">(</span></font><span style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;white-space:pre-wrap;color:rgb(167,29,93)">double</span><font face="Consolas, Liberation Mono, Menlo, Courier, monospace"><span style="font-size:12px;white-space:pre-wrap"> angle) { </span></font><span style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;white-space:pre-wrap;color:rgb(237,106,67)">this</span><font face="Consolas, Liberation Mono, Menlo, Courier, monospace"><span style="font-size:12px;white-space:pre-wrap">-></span></font><span style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;white-space:pre-wrap;color:rgb(0,134,179)">RotateWXYZ</span><font face="Consolas, Liberation Mono, Menlo, Courier, monospace"><span style="font-size:12px;white-space:pre-wrap">(angle, </span></font><span style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;white-space:pre-wrap;color:rgb(0,134,179)">1</span><font face="Consolas, Liberation Mono, Menlo, Courier, monospace"><span style="font-size:12px;white-space:pre-wrap">, </span></font><span style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;white-space:pre-wrap;color:rgb(0,134,179)">0</span><font face="Consolas, Liberation Mono, Menlo, Courier, monospace"><span style="font-size:12px;white-space:pre-wrap">, </span></font><span style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;white-space:pre-wrap;color:rgb(0,134,179)">0</span><font face="Consolas, Liberation Mono, Menlo, Courier, monospace"><span style="font-size:12px;white-space:pre-wrap">); };
</span></font><span style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;white-space:pre-wrap;line-height:18.2px"> </span><span style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;white-space:pre-wrap;line-height:18.2px;color:rgb(167,29,93)">void</span><span style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;white-space:pre-wrap;line-height:18.2px"> </span><span style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;white-space:pre-wrap;line-height:18.2px;color:rgb(121,93,163)">RotateY</span><span style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;white-space:pre-wrap;line-height:18.2px">(</span><span style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;white-space:pre-wrap;line-height:18.2px;color:rgb(167,29,93)">double</span><span style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;white-space:pre-wrap;line-height:18.2px"> angle) { </span><span style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;white-space:pre-wrap;line-height:18.2px;color:rgb(237,106,67)">this</span><span style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;white-space:pre-wrap;line-height:18.2px">-></span><span style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;white-space:pre-wrap;line-height:18.2px;color:rgb(0,134,179)">RotateWXYZ</span><span style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;white-space:pre-wrap;line-height:18.2px">(angle, </span><span style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;white-space:pre-wrap;line-height:18.2px;color:rgb(0,134,179)">0</span><span style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;white-space:pre-wrap;line-height:18.2px">, </span><span style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;white-space:pre-wrap;line-height:18.2px;color:rgb(0,134,179)">1</span><span style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;white-space:pre-wrap;line-height:18.2px">, </span><span style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;white-space:pre-wrap;line-height:18.2px;color:rgb(0,134,179)">0</span><span style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;white-space:pre-wrap;line-height:18.2px">); };
</span><span style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;white-space:pre-wrap;line-height:18.2px"> </span><span style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;white-space:pre-wrap;line-height:18.2px;color:rgb(167,29,93)">void</span><span style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;white-space:pre-wrap;line-height:18.2px"> </span><span style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;white-space:pre-wrap;line-height:18.2px;color:rgb(121,93,163)">RotateZ</span><span style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;white-space:pre-wrap;line-height:18.2px">(</span><span style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;white-space:pre-wrap;line-height:18.2px;color:rgb(167,29,93)">double</span><span style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;white-space:pre-wrap;line-height:18.2px"> angle) { </span><span style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;white-space:pre-wrap;line-height:18.2px;color:rgb(237,106,67)">this</span><span style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;white-space:pre-wrap;line-height:18.2px">-></span><span style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;white-space:pre-wrap;line-height:18.2px;color:rgb(0,134,179)">RotateWXYZ</span><span style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;white-space:pre-wrap;line-height:18.2px">(angle, </span><span style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;white-space:pre-wrap;line-height:18.2px;color:rgb(0,134,179)">0</span><span style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;white-space:pre-wrap;line-height:18.2px">, </span><span style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;white-space:pre-wrap;line-height:18.2px;color:rgb(0,134,179)">0</span><span style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;white-space:pre-wrap;line-height:18.2px">, </span><span style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;white-space:pre-wrap;line-height:18.2px;color:rgb(0,134,179)">1</span><span style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;white-space:pre-wrap;line-height:18.2px">); };
</span>Therefore, how there going to be a difference between <br><br>actor->RotateX(45);<br>actor->RotateY(45);<br><br>and <br><span><br>actor->RotateWXYZ(45, 1, 0, 0);<br>actor->RotateWXYZ(45, 0, 1, 0);<br><br></span>Can anyone please explain this a bit? David, Is there any example of the SetUserMatrix() available to learn about it?<br><br>Thanks,<br>Chiranjib</td></tr></tbody></table></div></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div>On Mon, Aug 10, 2015 at 10:38 PM, David Gobbi <span dir="ltr"><<a href="mailto:david.gobbi@gmail.com" target="_blank">david.gobbi@gmail.com</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div><div dir="ltr">Hi Drak,<div><br></div><div>Generally it's better design to build a transform or matrix and then apply that to the actor via SetUserTransform() or SetUserMatrix(). That way, the transform or matrix is available to you if you have to move other points or actors between coordinate systems.</div><div><br></div><div>To rotate around a point in space, you have to apply a translation to put that point at the origin, then do the rotation, and then translate back again.</div><span><font color="#888888"><div><br></div></font></span><div><span><font color="#888888"> - David</font></span><span><br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Aug 10, 2015 at 10:53 AM, Drak <span dir="ltr"><<a href="mailto:draktharrblorf@gmail.com" target="_blank">draktharrblorf@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I should add that I'm using the vtkImageActor with a vtkImageData as a<br>
source. It seems that my point of rotation is the bottom left of my image</blockquote></div></div></span></div></div></div></div></blockquote></div></div></blockquote></div><br></div></div></div>