[vtkusers] Urgent help and suggestions required.

Rakesh Patil rakeshthp at in.com
Mon Jan 4 01:37:29 EST 2010


Hello,I want to display contours and vectors for a given data file.. I have the following code, but i'm unable to get the desired output of conours.. Please anyone help me...Here is my code: vtkPoints *pts = vtkPoints::New(); pts>SetData(scatterdata); // scatterdata is an instance of vtkDoubleArray with three components unsigned 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>GetP ointIds()); ugrid>SetPoints(pts); vtkDelaunay2D *del = vtkDelaunay2D::New(); del>SetInput(ugrid); del>SetTolerance(0.001); vtkContourFilter *cf = vtkContourFilter::New(); cf>SetInputConnection(del>GetOutputPort()); cf>GenerateValues(10, 5, 20); vtkPolyDataMapper *map = vtkPolyDataMapper::New(); map>SetInputConnection( cf>G
 etOutputPort() ); 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..??The data file is a file containing x, y and z data in UTM coordinates. here is the code to read the file. std::string dataline; std::fstream fs; std::istringstream instream; fs.open(fname, std::ios::in); vtkDoubleArray *scatterdata = vtkDoubleArray::New(); scatterdata>SetNumberOfComponents(3); for( long int i = 0; !fs.eof(); i++) {double x, y, z;getline(fs, dataline);instream.clear();instream.str(dataline);if( !dataline.empty()){instream >> x >> y >> z;scatterdata>InsertNextTuple3(x, y, z);} } fs.close();the following include files are being used:#include #include #include #include #include #inc
 lude #include #include #include #include #include #include Even after including update(), it didnt show any result.. what may be the problem..??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/20100104/ac75388e/attachment.htm>


More information about the vtkusers mailing list