<br>I tried giving one, two and three... For all it is displaying same error... Am confused.. <br>What should be the format of data that vtkGlyph3D accepts..?? <br><blockquote><br>---------- Original message ----------<br>From:da< remywendy@gmail.com ><br>Date: 12 Jan 10 21:09:00<br>Subject: Re: [vtkusers] Generating U, V vleocity vector plots.. Problem!!<br>To: Rakesh Patil <rakeshthp@in.com>, vtkusers@vtk.org<br><br>Since it says wrong number of components for vector, try setting the number of components to 3.<div><br></div><div>vecArr->SetNumberOfComponents(<span class="Apple-style-span" style="text-decoration: underline;">3</span>);</div>
<div><br></div><div>vecArr->InsertTuple3(i, vel_u(i), vel_v(i), 0);</div><div><br></div><div>Maybe that might work?</div><div><br><br><div class="gmail_quote">On Mon, Jan 11, 2010 at 10:34 PM, Rakesh Patil <span dir="ltr"><<a target=\"_blank\" target="\"_blank\"" href="mailto:rakeshthp@in.com">rakeshthp@in.com</a>></span> wrote:<br>
<font color="#000000"></font><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><font color="#000000">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></font><div style="border-top: 1px dashed rgb(204, 204, 204); border-bottom: 1px dashed rgb(204, 204, 204); padding: 5px;"><font color="#000000"><a target=\"_blank\" href="http://mail.in.com/mails/new_reg.php?utm_source=invite&utm_medium=outgoing" style="font-family: arial; font-style: normal; font-variant: normal; font-weight: normal; font-size: 13px; line-height: normal; font-size-adjust: none; font-stretch: normal; -x-system-font: none; color: rgb(30, 86, 161); text-decoration: none;" target="\"_blank\"">Dear <b>vtkusers !</b> Get Yourself a cool, short <b>@in.com</b> Email ID now!</a></font></div>
<font color="#000000"><br>_______________________________________________<br>
Powered by <a target=\"_blank\" href="http://www.kitware.com" target="\"_blank\"">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a target=\"_blank\" href="http://www.kitware.com/opensource/opensource.html" target="\"_blank\"">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a target=\"_blank\" href="http://www.vtk.org/Wiki/VTK_FAQ" target="\"_blank\"">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a target=\"_blank\" href="http://www.vtk.org/mailman/listinfo/vtkusers" target="\"_blank\"">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
<br></font></blockquote></div><br></div>
</rakeshthp@in.com></blockquote>