Hello,<br><br>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...<br>Here is my code:<br><br> vtkPoints *pts = vtkPoints::New();<br> pts->SetData(scatter_data); // scatter_data is an instance of vtkDoubleArray with three components<br><br> unsigned int num_ids = scatter_data->GetNumberOfTuples();<br><br> vtkPolyVertex *poly = vtkPolyVertex::New();<br> poly->GetPointIds()->SetNumberOfIds(num_ids);<br><br> for ( unsigned int i = 0; i < num_ids; i++ )<br> poly->GetPointIds()->SetId(i,i);<br><br> vtkUnstructuredGrid *ugrid = vtkUnstructuredGrid::New();<br> ugrid->Allocate(1);<br> ugrid->InsertNextCell (poly->GetCellType(), poly->GetP ointIds());<br> ugrid->SetPoints(pts);<br><br> vtkDelaunay2D *del = vtkDelaunay2D::New();<br> del->SetInput(ugrid);<br> del->SetTolerance(0.001);<br><br> vtkC
ontourFilter *cf = vtkContourFilter::New();<br> cf->SetInputConnection(del->GetOutputPort());<br> cf->GenerateValues(10, -5, 20);<br><br> vtkPolyDataMapper *map = vtkPolyDataMapper::New();<br> map->SetInputConnection( cf->GetOutputPort() );<br> map->SetScalarRange(-5, 20);<br><br> vtkActor *act = vtkActor::New();<br> act->SetMapper(map);<br><br> // pRenderer is an instance of vtkRenderer which is declared and initialized in the main function.<br> pRenderer->AddActor(act);<br> pRenderer->ResetCamera();<br><br>THere is no syntax or compile time error shown. What may be wrong here..?? in cf->GenerateValues(), function what values need to be passed..??<br><br>The data file is a file containing x, y and z data in UTM coordinates. here is the code to read the file.<br><br> std::string dataline;<br> std::fstream fs;<br> std::istringstream instream;<br><br> fs.open(fname, std::ios::in);<br><br> vtkDoubleArray *scatter_data
= vtkDoubleArray::New();<br> scatter_data->SetNumberOfComponents(3);<br><br> for( long int i = 0; !fs.eof(); i++)<br> {<br> double x, y, z;<br> getline(fs, dataline);<br> instream.clear();<br> instream.str(dataline);<br> if( !dataline.empty())<br> {<br> instream >> x >> y >> z;<br> scatter_data->InsertNextTuple3(x, y, z);<br> }<br> }<br><br> fs.close();<br><br><br>the following include files are being used:<br><br>#include <vtkCamera.h><br>#include <vtkRenderer.h><br>#include <vtkPoints.h><br>#include <vtkPolyVertex.h><br>#include <vtkUnstructuredGrid.h><br>#include <vtkActor.h><br>#include <vtkDoubleArray.h><br>#include <vtkProperty.h><br>#include <vtkRenderWindow.h><br>#include <vtkDelaunay.h><br>#include <vtkPolyDataMapper.h><br>#include <wxVTKRenderWindowInteractor.h><br><br>Even after including update(), it didnt
show any result.. what may be the problem..??<br><br>Thanks in advance.<span> </span><br><br><div style="border-top:1px dashed #ccc; border-bottom:1px dashed #ccc; padding:5px;"><a href="http://mail.in.com/mails/new_reg.php?utm_source=invite&utm_medium=outgoing" style="font:13px arial; color:#1E56A1; text-decoration:none;">Dear <b>vtkusers !</b> Get Yourself a cool, short <b>@in.com</b> Email ID now!</a></div>