[vtkusers] help !!!!! From pixel to 3D point

David Gobbi david.gobbi at gmail.com
Wed Dec 15 13:58:17 EST 2010


Hi Rachel,

If your data is a polydata, then you should use vtkCellLocator's
IntersectWithLine() method.

locator->SetDataSet(data);
locator->BuildLocator();

Then, you need to create a line segment where one end is at the center of
the pixel, and the other end is some large distance away in the direction of
the silhouette plane normal:

n = silhouette plane normal
p1 = pixel location
p2 = p1 + d*n  where d is approximately twice the distance from the
silhouette to the 3D object

locator->IntersectWithLine(p1, p2, tolerance, t, x, pcoords, subId, cellId);

The IntersectWithLine method gives you "x" which is the position you want,
and it also gives you a lot of information you don't need like parametric
coordinates, the cell ID, and the sub ID.  Look at the
vtkAbstractCellLocator documentation for more info on IntersectWithLine.

   David




On Wed, Dec 15, 2010 at 11:36 AM, Rachel <aracha2010 at gmail.com> wrote:

>
> I got the  2D silhouette of 3D object. Then given a pixel i want to find it
> corresponding 3D point.
>
> Any help please
> Thanks
> --
> View this message in context:
> http://vtk.1045678.n5.nabble.com/coordinate-transformation-between-polydata-and-image-data-tp3216899p3306759.html
> Sent from the VTK - Users mailing list archive at Nabble.com.
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20101215/5e51b280/attachment.htm>


More information about the vtkusers mailing list