<div><br>Hi, sorry for&nbsp;my&nbsp;uncompleted explanation. Now let&#39;s study the underlying&nbsp;mechanism of &quot;SetOrigin etc.&quot; together.</div>
<div>here is the source code of vtkProp3D::ComputeMatrix (vtk 5.4)</div>
<div>&nbsp;</div>
<div>void vtkProp3D::ComputeMatrix()<br>{<br>&nbsp; if (this-&gt;IsIdentity)<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; return;<br>&nbsp;&nbsp;&nbsp; }</div>
<div>&nbsp; // check whether or not need to rebuild the matrix<br>&nbsp; if ( this-&gt;GetMTime() &gt; this-&gt;MatrixMTime )<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; this-&gt;GetOrientation();<br>&nbsp;&nbsp;&nbsp; this-&gt;Transform-&gt;Push();<br>&nbsp;&nbsp;&nbsp; this-&gt;Transform-&gt;Identity();<br>
&nbsp;&nbsp;&nbsp; this-&gt;Transform-&gt;PostMultiply();</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp; //<strong><em><u><font color="#ff0000" size="6"> <font size="4">Notice This Code segment</font></font></u></em></strong></div>
<div><font color="#ff0000" size="4">&nbsp;&nbsp;&nbsp; // begin {</font></div>
<div>&nbsp;&nbsp;&nbsp; // shift back to actor&#39;s origin<br>&nbsp;&nbsp;&nbsp; this-&gt;Transform-&gt;Translate(-this-&gt;Origin[0],<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -this-&gt;Origin[1],<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -this-&gt;Origin[2]);</div>

<div>&nbsp;&nbsp;&nbsp; // scale<br>&nbsp;&nbsp;&nbsp; this-&gt;Transform-&gt;Scale(this-&gt;Scale[0],<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; this-&gt;Scale[1],<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; this-&gt;Scale[2]);</div>
<div>&nbsp;&nbsp;&nbsp; // rotate<br>&nbsp;&nbsp;&nbsp; this-&gt;Transform-&gt;RotateY(this-&gt;Orientation[1]);<br>&nbsp;&nbsp;&nbsp; this-&gt;Transform-&gt;RotateX(this-&gt;Orientation[0]);<br>&nbsp;&nbsp;&nbsp; this-&gt;Transform-&gt;RotateZ(this-&gt;Orientation[2]);</div>
<div>&nbsp;&nbsp;&nbsp; // move back from origin and translate<br>&nbsp;&nbsp;&nbsp; this-&gt;Transform-&gt;Translate(this-&gt;Origin[0] + this-&gt;Position[0],<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; this-&gt;Origin[1] + this-&gt;Position[1],<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; this-&gt;Origin[2] + this-&gt;Position[2]);</div>

<div>&nbsp;&nbsp;&nbsp; //<font color="#ff0000" size="4">}end ==&gt; it means: at first, the actor frame is an<font color="#66ff99"> </font><font color="#3333ff">identity (<font color="#ff0000">same with the world frame</font>)</font>, then you have a chance to rotate or/and scale the identity frame with respect to a&nbsp;point&nbsp;(specified by setorigin) in the world frame. after that,</font><font color="#ff0000" size="4"> the usermatrix takes efforts.</font></div>

<div>&nbsp;&nbsp;&nbsp; // apply user defined transform last if there is one<br>&nbsp;&nbsp;&nbsp; if (this-&gt;UserTransform)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; this-&gt;Transform-&gt;Concatenate(this-&gt;UserTransform-&gt;GetMatrix());<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</div>
<div>&nbsp;&nbsp;&nbsp; this-&gt;Transform-&gt;PreMultiply();<br>&nbsp;&nbsp;&nbsp; this-&gt;Transform-&gt;GetMatrix(this-&gt;Matrix);<br>&nbsp;&nbsp;&nbsp; this-&gt;MatrixMTime.Modified();<br>&nbsp;&nbsp;&nbsp; this-&gt;Transform-&gt;Pop();<br>&nbsp;&nbsp;&nbsp; }<br>}<br></div>
<div class="gmail_quote">2010/5/26 Anant Vemuri <span dir="ltr">&lt;<a href="mailto:ajar108@gmail.com">ajar108@gmail.com</a>&gt;</span><br>
<blockquote style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" class="gmail_quote">Hi,<br><br>I had posted a problem a few days back that I am still having with using vtkActor-&gt;SetOrigin(). The documentation of vtkProp3D says that SetOrigin(pos) function sets the point of rotation to the point specified by pos. However, when I apply SetOrigin(pos), my actor moves in the scene such that his point is at the world origin. For example, if I do SetOrigin(100, 100, 100), the actor moves such that the previous (100,100,100) is now at (0,0,0) initially before I apply any other transform to it. The effect is similar to when I do<br>
<br>m_transform-&gt;Translate( -100,-100,-100 );<br>m_actor-&gt;SetUserTransform( m_transform );<br><br><br>Is this what is expected? Becase from the documentation, I understood that it should do translate(-newOrigin) [rotations, scaling etc] translate(newOrigin). Should I expect that when I do vtkActor-&gt;SetOrigin(newOrigin), the newOrigin moves to the world (0,0,0). Can someone explain this to me?<br>
<br>Thank you.<br>Anant.<br><br><br>
<div class="gmail_quote">On Mon, May 24, 2010 at 11:27 PM, Anant Vemuri <span dir="ltr">&lt;<a href="mailto:ajar108@gmail.com" target="_blank">ajar108@gmail.com</a>&gt;</span> wrote:<br>
<blockquote style="BORDER-LEFT: rgb(204,204,204) 1px solid; MARGIN: 0pt 0pt 0pt 0.8ex; PADDING-LEFT: 1ex" class="gmail_quote">Thanks... But doesn&#39;t SetUserTransform() do that already... the vtk<br>documentation says as below...<br>
<br>I think I understand the problem, but not sure how to correct it... I<br>am attaching a transform as the base transform which means that all<br>the other operations such as SetOrigin(), SetScale() get overridden.<br>
<div>
<div></div>
<div><br><br>On 5/24/10, 王瘢雹君臣 &lt;<a href="mailto:wangjunchen@gmail.com" target="_blank">wangjunchen@gmail.com</a>&gt; wrote:<br>&gt; what you need is a multiplication (PostMultiply) of m_defaultTrf to the<br>&gt; current actor transform not a replacement.<br>
&gt;<br>&gt;<br>&gt; 2010/5/24 Anant Vemuri &lt;<a href="mailto:ajar108@gmail.com" target="_blank">ajar108@gmail.com</a>&gt;<br>&gt;<br>&gt;&gt; Hi,<br>&gt;&gt;<br>&gt;&gt; I am trying to use myVtkActor-&gt;SetOrigin(origin) to set the origin so that<br>
&gt;&gt; any rotations I apply is done about this point. This is what I do to build<br>&gt;&gt; the pipeline<br>&gt;&gt;<br>&gt;&gt;<br>&gt;&gt; void buildPipeline( )<br>&gt;&gt; {<br>&gt;&gt; &nbsp; &nbsp; m_actor-&gt;SetMapper( m_mapper );<br>
&gt;&gt; &nbsp; &nbsp; m_actor-&gt;SetOrigin( 100, 100, 100 );<br>&gt;&gt; &nbsp; &nbsp; m_defaultTrf-&gt;Scale(m_scale, m_scale, m_scale);<br>&gt;&gt; &nbsp; &nbsp; m_defaultTrf-&gt;PostMultiply();<br>&gt;&gt; &nbsp; &nbsp; m_defaultTrf-&gt;Concatenate( this-&gt;getTransform() );<br>
&gt;&gt; &nbsp; &nbsp; /// I add some more things to the m_defaultTrf<br>&gt;&gt; &nbsp; &nbsp; .<br>&gt;&gt; &nbsp; &nbsp; .<br>&gt;&gt; &nbsp; &nbsp; .<br>&gt;&gt; &nbsp; &nbsp; m_actor-&gt;SetUserTransform( m_defaultTrf );<br>&gt;&gt; &nbsp; &nbsp; }<br>&gt;&gt; &nbsp; &nbsp; std::cout &lt;&lt; &quot;\n\n\nOrigin = [&quot; &lt;&lt; m_actor-&gt;GetOrigin()[0] &lt;&lt; &quot;, &quot; &lt;&lt;<br>
&gt;&gt; m_actor-&gt;GetOrigin()[1] &lt;&lt; &quot;, &quot; &lt;&lt; m_actor-&gt;GetOrigin()[2] &lt;&lt; &quot;]\n\n\n&quot;;<br>&gt;&gt; }<br>&gt;&gt;<br>&gt;&gt; But when I apply the transform in the scene, it is not being about some<br>
&gt;&gt; other point entirely. I noticed that this is the same point when I remove<br>&gt;&gt; the SetOrigin() line. But in the last line it gives me the origin as the<br>&gt;&gt; one<br>&gt;&gt; that I set a few line earlier. I am not able to figure out what is the<br>
&gt;&gt; mistake. Can anyone help me?<br>&gt;&gt;<br>&gt;&gt; Thank you.<br>&gt;&gt; Anant.<br>&gt;&gt;<br>&gt;&gt; _______________________________________________<br>&gt;&gt; Powered by <a href="http://www.kitware.com/" target="_blank">www.kitware.com</a><br>
&gt;&gt;<br>&gt;&gt; Visit other Kitware open-source projects at<br>&gt;&gt; <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>&gt;&gt;<br>
&gt;&gt; Please keep messages on-topic and check the VTK FAQ at:<br>&gt;&gt; <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>&gt;&gt;<br>&gt;&gt; Follow this link to subscribe/unsubscribe:<br>
&gt;&gt; <a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>&gt;&gt;<br>&gt;&gt;<br>&gt;<br>&gt;<br>&gt; --<br>&gt;<br><br><br></div></div><font color="#888888">--<br>
-----------<br>Anant S. Vemuri<br>email: <a href="mailto:ajar108@gmail.com" target="_blank">ajar108@gmail.com</a><br></font></blockquote></div><br><br>_______________________________________________<br>Powered by <a href="http://www.kitware.com/" target="_blank">www.kitware.com</a><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://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br><br></blockquote></div><br><br clear="all"><br>-- <br>
<br>