[vtkusers] Display Coordinates Inconsistent Problem

Wenlong Wang scc.wwl at gmail.com
Fri Nov 11 07:17:25 EST 2011


Dear all,

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.

Here is the code. For example, I compute once in function A and the pass
the object to function B to compute again,

*void functionA()
{
  for (int index = 0; index < 14; index++)
    {
        original_points->GetPoint(landmarks[index], p1);
        renderer->SetWorldPoint(p1);
        renderer->WorldToDisplay();
        renderer->GetDisplayPoint(r1);         // r1 = (171, 398, 0)

        transformed_points->GetPoint(landmarks[index], p2);
        renderer->SetWorldPoint(p2);
        renderer->WorldToDisplay();
        renderer->GetDisplayPoint(r2);        // r2 = (173, 398, 0)
    }

    functionB(transformed_points);
}*

And in function B,

*void functionB(transformed_points)
{
  for (int index = 0; index < 14; index++)
    {
        points->GetPoint(landmarks[index], p1);
        ren->SetWorldPoint(p1);
        ren->WorldToDisplay();
        ren->GetDisplayPoint(r1);              // r1 = (171, 398, 0) it is
the same in function A

        tpoints->GetPoint(landmarks[index], p2);
        ren->SetWorldPoint(p2);
        ren->WorldToDisplay();
        ren->GetDisplayPoint(r2);              // r2 = (-22, 715, 15) which
is significantly different from A
    }
}*

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?

Thank you very much if anyone can help me solve this annoying problem. I
extremely appreciate your help.

Best wishes
Long
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20111111/417be3ec/attachment.htm>


More information about the vtkusers mailing list