[vtkusers] Problem getting correct results with vtkProjectedTerrainPath

Elvis Dowson elvis.dowson at mac.com
Sun Nov 9 15:59:46 EST 2008

         I'm having a problem trying to get correct results with  
vtkProjectedTerrainPath. I have specified 4 initial points along the  
terrain, but as you can see from the image below, the generated  
projected terrain path does not closely follow the 3D terrain surface.

Is the problem due to the fact that I have reconstructed the 3D  
surface using vtkWarpScalars with a scale factor of 0.1?

How can I troubleshoot this? Please help!

vtkDataSetReader reader
     reader SetFileName "SampleDEM.vtk"

I recreate the surface first by thresholding all invalid data (-9999)  
using vtkThreshold, and then
pass it to vtkGeometryFilter and then vtkWarpScalar with a scale  
factor of 0.1.

# Create actor for projected path

# Create some paths
vtkPoints pts
   pts InsertNextPoint 961 964 1
   pts InsertNextPoint 701 605 1
   pts InsertNextPoint 461 667 1
   pts InsertNextPoint 397 602 1
vtkCellArray lines
   lines InsertNextCell 4
   lines InsertCellPoint 0
   lines InsertCellPoint 1
   lines InsertCellPoint 2
   lines InsertCellPoint 3

vtkPolyData terrainPaths
   terrainPaths SetPoints pts
   terrainPaths SetLines lines

vtkProjectedTerrainPath projectedPaths
   projectedPaths SetInput terrainPaths
   projectedPaths SetSource [reader GetOutput]
   projectedPaths SetHeightOffset 1
   projectedPaths SetHeightTolerance 1
   projectedPaths SetProjectionModeToNonOccluded
   projectedPaths SetProjectionModeToHug

vtkPolyDataMapper pathMapper
   pathMapper SetInputConnection [projectedPaths GetOutputPort]

vtkActor paths
   paths SetMapper pathMapper
   [paths GetProperty] SetColor 1 0 0

Best regards,

Elvis Dowson

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20081110/243aa76f/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Problem with vtkProjectedTerrainPath.jpg
Type: image/jpeg
Size: 33117 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20081110/243aa76f/attachment.jpg>

More information about the vtkusers mailing list