[vtkusers] Example using vtkProjectedTerrainPath and converting vtkPolyData to vtkImageData [SOLVED]
Guillaume Dumont
dumont.guillaume at gmail.com
Thu Feb 20 12:02:51 EST 2014
In case someone else is interested in this I found an example (more
precisely a test) at:
http://vtk.org/gitweb?p=VTK.git;a=blob;f=Filters/Hybrid/Testing/Python/TestProjectedTerrainPath.py
which I was able to modify to suit my needs.
In the ends it boils down to:
- Load the STL file and create a vtkImageData containing the the elevation
of the points. In my case I used an image that encompasses all the points
in the STL and a vtkCellLocator to get the elevation for each "pixel" in
the image.
- Create polylines with default elevation.
- Use vtkProjectedTerrainPath with the vtkImageData and the vtkPolyData of
the polylines
- Render as usual.
the gotchas I found is that it seems that only the Hug projection mode
worked for me. Also, I had some trouble figuring at the origin of the
vtkImageData should be: in my case the min x and min y of the STL surface
and 0 for z so that the polylines and surface line up properly.
Guillaume
On Thu, Feb 13, 2014 at 11:55 AM, Guillaume Dumont <
dumont.guillaume at gmail.com> wrote:
> Hi,
>
> I have an elevation map stored in a STL file. I can successfully load this
> as a vtkPolyData instance and display it. Now, I have several 2D polylines
> that I want to display as paths on this surface. From the documentation (
> http://www.vtk.org/doc/nightly/html/classvtkProjectedTerrainPath.html#details)
> I understand that I can use vtkProjectedTerrainPath for that. However, I
> cannot find any examples of its usage.
>
> Can anyone give me C++, Python or pseudo-code that would get me started?
>
> From what I understand I need to convert my vtkPolyData to vtkImageData.
> How can I do that?
>
> Many thanks.
>
> Guillaume
>
--
Guillaume Dumont
=========================
dumont.guillaume at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20140220/e78d4d86/attachment.html>
More information about the vtkusers
mailing list