[vtkusers] Contours are not displayed..!! Why..??

Rakesh Patil rakeshthp at in.com
Thu Dec 31 04:48:37 EST 2009


 Hello, I'm very new to VTK. I went through few materials and I have successfully displayed a mesh (triangular grid), and scattered points using vtkUnstructuredGrid. Now I want to display line contours. I came to know that it can be done using vtkContourFilter class. I have written a small code. I guess it is correct. but Am not able to get the contours on the render window. Here is my code:vtkPoints *pts = vtkPoints::New();pts>SetData(scatterdata);// scatterdata is an instance of vtkDoubleArray with three componentsunsigned int numids = scatterdata>GetNumberOfTuples();vtkPolyVertex *poly = vtkPolyVertex::New();poly>GetPointIds()>SetNumberOfIds(numids);for ( unsigned int i = 0; i < numids; i++ )poly>GetPointIds()>SetId(i,i);vtkUnstructuredGrid *ugrid = vtkUnstructuredGrid::New();ugrid>Allocate(1);ugrid>InsertNextCell (poly>GetCellType(), poly>GetPointIds());ugrid>SetPoints(pts);vtkDelaunay2D *del = vtkDelaunay2D::New();del>SetInput(ugrid);del>SetTolerance(0.001);vtkContourFil
 ter *cf = vtkContourFilter::New();cf>SetInputConnection(del>GetOutputPort());cf>GenerateValues(10, 5, 20);vtkPolyDataMapper *map = vtkPolyDataMapper::New();map>SetInputConnection( cf>GetOutputPort() );map>SetScalarRange(5, 20);vtkActor *act = vtkActor::New();act>SetMapper(map);// pRenderer is an instance of vtkRenderer which is declared and initialized in the main function.pRenderer>AddActor(act);pRenderer>ResetCamera();THere is no syntax or compile time error shown. What may be wrong here..?? in cf>GenerateValues(), function what values need to be passed..?? Thanks in advance.Dear vtkusers! Get Yourself a cool, short @in.com Email ID now!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20091231/4411c93e/attachment.htm>


More information about the vtkusers mailing list