<div>Hi Michael</div>
<div>&nbsp;</div>
<div>Thanks for you kind help! Your solution is so cool!</div>
<div>Before I get your solution, I have tried another way to retrieve the world coordinate of the points and it seems that it can also work well.</div>
<div>The example code:</div>
<div>&nbsp;</div>
<div>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align="left"><span lang="EN-US" style="FONT-SIZE: 9pt; COLOR: green; FONT-FAMILY: Courier; mso-font-kerning: 0pt; mso-no-proof: yes">
&nbsp;vtkDataSet dataSetCone1 = coneActor1.GetMapper().GetInputAsDataSet();</span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align="left"><span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: Courier; mso-font-kerning: 0pt; mso-no-proof: yes"><span style="mso-spacerun: yes">
&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: green">vtkTransform transform = new vtkTransform();</span></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align="left"><span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: Courier; mso-font-kerning: 0pt; mso-no-proof: yes"><span style="mso-spacerun: yes">
&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: green">transform.SetMatrix(coneActor1.GetMatrix());</span></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align="left"><span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: Courier; mso-font-kerning: 0pt; mso-no-proof: yes"><span style="mso-spacerun: yes">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="COLOR: green"></span></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align="left"><span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: Courier; mso-font-kerning: 0pt; mso-no-proof: yes"><span style="mso-spacerun: yes">
&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="COLOR: green">double[] localcoor = new double[3];</span></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align="left"><span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: Courier; mso-font-kerning: 0pt; mso-no-proof: yes"><span style="mso-spacerun: yes">
&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="COLOR: green">localcoor = dataSetCone1.GetPoint(id);</span></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 13.5pt; mso-char-indent-count: 1.5"><span lang="EN-US" style="FONT-SIZE: 9pt; COLOR: green; FONT-FAMILY: Courier; mso-font-kerning: 0pt; mso-no-proof: yes"><span style="mso-spacerun: yes">
&nbsp; </span>double[] worldPos = transform.TransformDoublePoint(localcoor);</span></p></div>
<div>&nbsp;</div>
<div>Then the worldPos is the world coordinate of the point.</div>
<div>&nbsp;</div>
<div>Thanks a lot,</div>
<div>Best Regards,</div>
<div>Lin Zhang</div>
<div>&nbsp;</div>
<div>&nbsp;</div>
<div>&nbsp;</div>
<div>Message: 8<br>Date: Tue, 10 Jul 2007 09:57:23 +0200<br>From: &quot;Michael Knopke&quot; &lt;<a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:Michael.Knopke@gmx.de">Michael.Knopke@gmx.de</a>&gt;
<br>Subject: [vtkusers] how to get the world coordinates of a point?<br>To: &lt;<a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:vtkusers@vtk.org">vtkusers@vtk.org</a>&gt;<br>Message-ID: &lt;<a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:000001c7c2c7$f35edf70$4378a8c0@imagesystems.local">
000001c7c2c7$f35edf70$4378a8c0@imagesystems.local</a>&gt;<br>Content-Type: text/plain; charset=&quot;us-ascii&quot;<br><br>Hi Lin Zhang,<br><br><br><br>I had the same &quot;problem&quot; as you before. The reason is, that when applying
<br>any transformation/rotation matrix to a dataset (e.g. with vtkTransform) it<br>will not change the position of the original points. (It changes only the<br>position of actors but you can&#39;t querry their WorldCoordinates)
<br><br>You will have to use vtkTransformPolyDataFilter on the dataset to really<br>transform it.<br><br><br><br>Here is an example (translating one point only):<br><br><br><br>&nbsp; &nbsp;vtkPoints *inputPoints2 = vtkPoints::New();
<br><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;inputPoints2-&gt;SetDataTypeToDouble();<br><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;inputPoints2-&gt;SetNumberOfPoints(1);<br><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;inputPoints2-&gt;SetPoint(0,corPos);<br><br><br><br><br><br>&nbsp; vtkPolyData *poly2 = vtkPolyData::New();
<br><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;poly2-&gt;SetPoints(inputPoints1);<br><br><br><br>&nbsp; vtkTransformPolyDataFilter *transPolyData2 =<br>vtkTransformPolyDataFilter::New();<br><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;transPolyData2-&gt;SetInput(poly2);
<br><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;transPolyData2-&gt;SetTransform(sag_mprTransform);<br><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;transPolyData2-&gt;Update();<br><br><br><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;vtkPoints *outputPoints2<br>=transPolyData2-&gt;GetOutput()-&gt;GetPoints();
<br><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;double TranslatedPoint2[3];<br><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;TranslatedPoint2 = outputPoints2-&gt;GetPoint(0);<br><br><br><br>&nbsp; transPolyData-&gt;Delete();<br><br>&nbsp; poly2-&gt;Delete();<br><br>&nbsp; inputPoints2-&gt;Delete();
<br><br>&nbsp; outputPoints2-&gt;Delete();<br><br><br><br>Better to look for vtkTransformPolyDataFilter to get better examples.<br><br><br><br>Regards<br><br><br><br>Michael</div>