[vtkusers] Display Coordinates Error
Wenlong Wang
scc.wwl at gmail.com
Tue Nov 8 13:59:46 EST 2011
Dear all,
Here is a function I write, it calculates the display coordinates of a
point set. This function is called after I transform a point set and I pass
the pointer of the point set to this function.
*void Dist_2DLandmarks(vtkPoints* transformed_points)
{
double p_trans[3];
vtkPolyData* polydata = vtkPolyData::New();
vtkPolyDataMapper* mapper = vtkPolyDataMapper::New();
vtkActor* actor = vtkActor::New();
polydata->SetPoints(transformed_points);
polydata->SetPolys(poly);
polydata->GetPointData()->SetScalars(scalars);
mapper->SetInput(polydata);
actor->SetMapper(mapper);
ren->AddActor(actor);
for (int index = 0; index<sizeof(landmarks)/sizeof(int); index++)
{
transformed_points->GetPoint(landmarks[index], p_trans);
ren->SetWorldPoint(p_trans);
ren->WorldToDisplay();
ren->GetDisplayPoint(p_trans);
}
return;
}*
What I do before call this function is Scale (0.72, 0.72, 0.72) and Rotate
(2.5). The result shows the display coordinates has changed a lot, from
(170, 254, 0.4) to (2362, 64, 1.7).
I don't know what is wrong with it. Can anyone give me some advice? Or
write me a demo code would carry out the work?
Thank you very much.
Best wishes
Long
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20111108/752ec452/attachment.htm>
More information about the vtkusers
mailing list