[vtkusers] 3D Visualization of Map Data
Ron Chapman
Ron.Chapman at rwdi.com
Wed Feb 15 18:38:13 EST 2006
Malcolm,
Thanks for your help, once I figured out some basic vtk'isms your
suggestion worked well, albeit roads are sometimes elevated, and/or
disappear through my surface (see the below pipeline). Now I need to
figure out how to split my road (line segments) into polylines that
intersect with my 2D mesh so that the probing produces better results.
Does anyone have some hints on how to do this? I was naively thinking
of the following:
create an empty 2d polydata set -> call this NEW
for each 2d line segment in my 2d polydata
for each line in 3d mesh
if intersection
create new line segment
add new line segment to NEW
Then use NEW with the pipeline below insead of Shape2D:
// get the evalation scalars
float bounds[6];
Mesh3D->GetBounds(bounds);
vtkElevationFilter *Elevation = vtkElevationFilter::New();
Elevation->SetInput(Mesh3D);
Elevation->SetLowPoint(0,0,bounds[4]);
Elevation->SetHighPoint(0,0,bounds[5]);
Elevation->SetScalarRange(bounds[4], bounds[5]);
Elevation->Update();
// convert our 3d mesh to 2d
vtkTransform *Transform = vtkTransform::New();
Transform->Scale(1.0,1.0,0.0);
vtkTransformPolyDataFilter *transFilter =
vtkTransformPolyDataFilter::New();
transFilter->SetInput((vtkPolyData *) Elevation->GetOutput());
transFilter->SetTransform(Transform);
transFilter->Update();
// probe 2d mesh with shape data
vtkProbeFilter *Probe = vtkProbeFilter::New();
Probe->SetInput(Shape2D);
Probe->SetSource(transFilter->GetOutput());
Probe->Update();
// apply the sampled elevation to the overlay
vtkWarpScalar *Warp = vtkWarpScalar::New();
Warp->SetInput(Probe->GetPolyDataOutput());
Warp->SetScaleFactor(1.0);
Warp->Update();
Ron
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20060215/d1cd48d0/attachment.htm>
More information about the vtkusers
mailing list