HI there..<br><br>I got the following data in hand.. Mesh data is in one file and corresponding velocity vectors data in another file.. Mesh file format is as follows:<br><br>NP NE // First line contains total number of points(NP) and total number of elements(NE)<br>Lon, Lat, depth // From next line onwards NP number of point coordinate values are listed<br>...<br>...<br>...<br>ele_no, nd1, nd2, nd3 // Index of node 1, 2 and 3 of triangles elements, for NE number of elements;<br>...<br>...<br>...<br><br>Velocity vectors file contains data in the following format:<br><br>time_in_seconds<br>point_no, u, v<br>...<br>...<br>...<br>next_time_in_seconds<br>point_no, u, v<br>...<br>...<br>...<br><br>One timestep contains NP number of UV dataset. Now actually, i want to plot vector plot for this data ..<br>I have used vtkGlyph3D class to do so,.. But all the arrows are being shown in the same direction.. Here goes the code:<br><br>unsigned
int num_pts = x.size();<br><br>vtkPoints *pts = vtkPoints::New();<br>pts->SetNumberOfPoints(num_pts);<br><br>vtkDoubleArray *vecArr = vtkDoubleArray::New();<br>vecArr->SetNumberOfComponents(2);<br>vecArr->SetNumberOfTuples(num_pts);<br><br>for( unsigned int i=0; i < num_pts; i++)<br>{<br> pts->InsertPoint(i, x(i), y(i), 0);<br> vecArr->InsertTuple2(i, vel_u(i), vel_v(i));<br>}<br><br>unsigned int num_cells = elem.rows(); // elem is a matrix that contains the index of nodes of elements in the mesh<br><br>vtkCellArray *cellA = vtlCellArray::New();<br>cellA->SetNumberOfCells(num_cells);<br><br>for (unsigned int i=0; i < num_cells; i++)<br>{<br> cellA->InsertNextCell(3);<br> cellA->InsertCellPoint( elem(i, 0) );<br> cellA->InsertCellPoint( elem(i, 1) );<br> cellA->InsertCellPoint( elem(i, 2) );<br>}<br><br>vtkUnstructuredGrid *uGrid = vtkUnstructuredGrid::New();<br>uGrid->Allocate(num_cells, num_cells);<br>uGrid->SetCells(
VTK_TRIANGLE, cellA);<br>uGrid->SetPoints(pts);<br>uGrid->GetPointData()->SetVector(vecArr);<br><br>vtkArrowSource *arrow = vtkArrowSource::New();<br>arrow->SetTipResolution(1);<br>arrow->SetTipRadius(0.1);<br>arrow->SetTipLength(0.35);<br>arrow->SetShaftResolution(0.1);<br>arrow->SetShaftRadius(0.03);<br><br>vtkGlyph3D *glyph = vtkGlyph3D::New();<br>glyph->SetInput(uGrid);<br>glyph->SetSource(arrow->GetOutput());<br>glyph->SetVectorModeToUseVector();<br>glyph->SetColorModeToColorByVector();<br>glyph->SetScaleModeToDataScalingOff();<br>glyph->OrientOn();<br>glyph->SetScaleFactor(0.01);<br><br>vtkPolyDataMapper *gMapper = vtkPolyDataMapper::New();<br>gMapper->SetInput( glyph->GetOutput());<br>gMapper->ScalarVisibilityOn();<br>gMapper->SetScalarRange(uGrid->GetScalarRange());<br><br>vtkActor *gactor = vtkActor::New();<br>gactor->SetMapper(gMapper);<br><br>pRenderer->AddActor(gactor);<br><br>pRenderer->Rese
tCamera();<br><br>When I run this code, it shows error saying that wrong number of components for setVetor(). What is the data it takes.??<br>How do i achieve my goal..??<br><br>Thanks in advance<br><br>Regards<br>Rakesh Patil<br><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>