Dear all,<br><br>I'm trying to compute the display coordinates of my polydata object. I have an original object and use a vtkTransformPolyDataFilter to generate another polydata object from it. Then I start to compute the display coordinates of corresponding points on the original and generated object. I also pass the generated point set to another function to do the same computation. However, I find the results are not the same.<br>
<br>Here is the code. For example, I compute once in function A and the pass the object to function B to compute again,<br><br><b>void functionA()<br>{<br> for (int index = 0; index < 14; index++)<br> {<br> original_points->GetPoint(landmarks[index], p1);<br>
renderer->SetWorldPoint(p1);<br> renderer->WorldToDisplay();<br> renderer->GetDisplayPoint(r1); // r1 = (171, 398, 0)<br><br> transformed_points->GetPoint(landmarks[index], p2);<br>
renderer->SetWorldPoint(p2);<br> renderer->WorldToDisplay();<br> renderer->GetDisplayPoint(r2); // r2 = (173, 398, 0)<br> }<br><br> functionB(transformed_points);<br>}</b><br><br>
And in function B,<br><br><b>void functionB(transformed_points)<br>{<br> for (int index = 0; index < 14; index++)<br> {<br> points->GetPoint(landmarks[index], p1);<br> ren->SetWorldPoint(p1);<br>
ren->WorldToDisplay();<br> ren->GetDisplayPoint(r1); // r1 = (171, 398, 0) it is the same in function A<br><br> tpoints->GetPoint(landmarks[index], p2);<br> ren->SetWorldPoint(p2);<br>
ren->WorldToDisplay();<br> ren->GetDisplayPoint(r2); // r2 = (-22, 715, 15) which is significantly different from A<br> }<br>}</b><br><br>In A and B the pipeline of combining the points and actors are the same, and the camera was kept the same. But why the results just not right?<br>
<br>Thank you very much if anyone can help me solve this annoying problem. I extremely appreciate your help.<br><br>Best wishes<br>Long<br>