[vtkusers] 2D contour of x,y, scalar

Christopher M. Navarro cnavarro at ncsa.uiuc.edu
Tue Feb 18 13:10:37 EST 2003


I have a set of data in the form x, y, scalar that I read in and put the 
x,y values into vtkPoints and the scalar into a vtkDataArray (the scalars 
are doubles).  I can't seem to get vtkContourFilter to produce a 2d 
contour map.  What I do is basically:

vtkPoints mypoints = new vtkPoints();
/* insert the points */
vtkDataArray scalars = new vtkDataArray();
/* insert the scalars */
vtkPolyData polydata = new vtkPolyData();
    polydata.SetPoints(mypoints);
    polydata.GetPointData().SetScalars(scalars);
vtkContourFilter filter = new vtkContourFilter();
    filter.SetInput(polydata);
    filter.GenerateValues(12, range);
/* create LUT */
vtkPolyDataMapper mapper = new vtkPolyDataMapper();
    mapper.SetInput(filter.GetOutput());
    mapper.SetScalarRange(range);
    mapper.SetLookupTable(lut);
vtkActor actor = new vtkActor();
    actor.SetMapper(mapper);

Is there something obvious I'm missing?

-chris





More information about the vtkusers mailing list