[vtkusers] Help with ContourFilter and isolines from PolyData

M. infinity.probability at gmail.com
Mon Jun 15 16:52:28 EDT 2009


Hello all,

I'm trying to plot 2D isolines from a PolyDataSet. It works, but now I'm
trying to plot the isolines projected on a plane, and not draw on the space.
Here's what I'm doing:

I set the PolyData with a group of points and scalars:

    PolyData = vtkPolyData::New();
    PolyData->SetPoints(points);
    PolyData->GetPointData()->SetScalars(scalares);

Then, create a mesh with Delaunay2D:

    delaunay2D = vtkDelaunay2D::New();
    delaunay2D->SetInput(PolyData);
    delaunay2D->Update();

Everything fine here. So, I try to create the isolines using

   vtkContourFilter * contour = vtkContourFilter::New();
   contour->SetInputConnection(delaunay2D->GetOutputPort());

    double range[2];
    range[0] = min_scalar;
    range[1] = max_scalar;
    contour->GenerateValues(200, range);


    mapper = vtkPolyDataMapper::New();
    mapper->SetInputConnection(contour->GetOutputPort());
    mapper->SetScalarRange(min_scalar, max_scalar);

It works, but the lines are draw in 3D space, not projected on a plane. I
would like to project then on a plane.
Also, if there is a jump on the values, say, a big difference of values in
one area, several isolines are draw on the slope, creating an artificial
hole.

Thanks in advance
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20090615/d0a6cf51/attachment.htm>


More information about the vtkusers mailing list