<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2900.2802" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY style="MARGIN: 4px 4px 1px; FONT: 10pt Tahoma" bgColor=#ffffff>
<DIV><FONT face=Arial>Hi Ron</FONT></DIV>
<DIV><FONT face=Arial></FONT> </DIV>
<DIV><FONT face=Arial>You want to sample values from your terrain to points
in your Shapefile data - this can't be done directly as they don't coincide in
3D. My approach is to store the terrain elevation data as scalars (via
vtkElevationFilter) before flattening the terrain to coincide with the
Shapefile data. At that stage you can probe one with the other. Then
you map the probed scalar values back to the z component (via
vtkWarpScalars).</FONT></DIV>
<DIV><FONT face=Arial></FONT> </DIV>
<DIV><FONT face=Arial>The input to
your vtkTransformPolyDataFilter should be the output from the
elevation filter i.e. ...</FONT></DIV>
<DIV><FONT face=Arial></FONT> </DIV>
<DIV><FONT
face=Arial>transFilter->SetInput(Elevation->GetOutput());</FONT></DIV>
<DIV><FONT face=Arial></FONT><FONT face=Arial></FONT> </DIV>
<DIV><FONT face=Arial>... this is to get your mesh into the same plane (z = 0.0)
as your shapefile output. If they don't coincide then the probing will produce
no data.</FONT></DIV>
<DIV><FONT face=Arial></FONT><FONT face=Arial></FONT> </DIV>
<DIV><FONT face=Arial>I'd take this in stages - much easier to do with
Python or TCL scripting. First visualize the output of the transform
filter and check that it is flat and that the elevation data is showing as
scalars. Then add the shapefile to the visualization and check that they
coincide (I just assumed that it was at z = 0.0, maybe not). Then add the
probe filter and check that the probing works (i.e the output has
interpolated scalar values). Finally add the warpscalars to get your
elevation back. </FONT></DIV>
<DIV><FONT face=Arial></FONT> </DIV>
<DIV><FONT face=Arial>HTH</FONT></DIV>
<DIV>Malcolm Drummond<BR></DIV>
<BLOCKQUOTE
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
<DIV
style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B>
<A title=Ron.Chapman@rwdi.com href="mailto:Ron.Chapman@rwdi.com">Ron
Chapman</A> </DIV>
<DIV style="FONT: 10pt arial"><B>To:</B> <A title=vtkusers@vtk.org
href="mailto:vtkusers@vtk.org">vtkusers@vtk.org</A> </DIV>
<DIV style="FONT: 10pt arial"><B>Sent:</B> Wednesday, February 15, 2006 6:28
AM</DIV>
<DIV style="FONT: 10pt arial"><B>Subject:</B> [vtkusers] 3D Visualization of
Map Data</DIV>
<DIV><BR></DIV>
<DIV>Malcolm,</DIV>
<DIV> </DIV>
<DIV>I'm having problems trying to implement your suggestion. </DIV>
<DIV> </DIV>>>One approach would be to run an elevation filter on
your 3D map (to create scalar values) and then a >>transform with scale
set to 1.0,1.0,0.0 which will set all your z values to 0.0. Then probe this
dataset >>with your overlay features (which are at elevation 0.0) and
run the output through vtkWarpScalars (to >>apply the sampled elevations
to your overlay). The only problem is that sampling will only take place at
>>points defined in your overlay dataset and the result may not look
good due to non-sampled >>intersections with your 3D map. Adding some
extra elevation to your overlay may fix this.<BR>
<DIV> </DIV>
<DIV>I do understand that reconfiguring my 2D shape file to have points
located on the edges of my 3d mesh is the best approach, and will attempt this
once I get the above working first.</DIV>
<DIV> </DIV>
<DIV>Here is my pipeline</DIV>
<DIV> </DIV>
<DIV>....</DIV>
<DIV> </DIV>
<DIV>// run the elevation filter to get the elevation scalars</DIV>
<DIV> </DIV>
<DIV> vtkElevationFilter *Elevation =
vtkElevationFilter::New();<BR> Elevation->SetInput(Mesh3D);<BR> <BR> // convert
our 3d mesh to 2d</DIV>
<DIV> </DIV>
<DIV> vtkTransform *Transform =
vtkTransform::New();<BR> Transform->Scale(1.0,1.0,0.0);</DIV>
<DIV> </DIV>
<DIV> vtkTransformPolyDataFilter *transFilter =
vtkTransformPolyDataFilter::New();<BR> transFilter->SetInput(Mesh);<BR> transFilter->SetTransform(Transform);</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> // probe 2d mesh with shape data</DIV>
<DIV> </DIV>
<DIV> vtkProbeFilter *Probe =
vtkProbeFilter::New();<BR>
Probe->SetInput(Shape2D);<BR>
Probe->SetSource(trasnFilter->GetOutput());<BR> </DIV>
<DIV> // apply the sampled elevation to the overlay</DIV>
<DIV> </DIV>
<DIV> vtkWarpScalar *Warp =
vtkWarpScalar::New();<BR> Warp->SetInput(Probe->GetPolyDataOutput());<BR> Warp->XYPlaneOn();</DIV>
<DIV> </DIV>
<DIV>....</DIV>
<DIV> </DIV>
<DIV>I'm confused as to how the elevation filter and warpscalars are
working together to get my 2D shape file into 3D? The above pipeline is
giving me garbage.</DIV>
<DIV> </DIV>
<DIV>Ron</DIV>
<DIV> </DIV>
<P>
<HR>
<P></P>_______________________________________________<BR>This is the private
VTK discussion list. <BR>Please keep messages on-topic. Check the FAQ at:
http://www.vtk.org/Wiki/VTK_FAQ<BR>Follow this link to
subscribe/unsubscribe:<BR>http://www.vtk.org/mailman/listinfo/vtkusers<BR></BLOCKQUOTE></BODY></HTML>