<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&lt; remywendy@gmail.com &gt;<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-&gt;SetNumberOfComponents(<span class="Apple-style-span" style="text-decoration: underline;">3</span>);</div>
<div><br></div><div>vecArr-&gt;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">&lt;<a target=\"_blank\" target="\&quot;_blank\&quot;" href="mailto:rakeshthp@in.com">rakeshthp@in.com</a>&gt;</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-&gt;SetNumberOfPoints(num_pts);<br><br>vtkDoubleArray *vecArr = vtkDoubleArray::New();<br>vecArr-&gt;SetNumberOfComponents(2);<br>vecArr-&gt;SetNumberOfTuples(num_pts);<br>
<br>for( unsigned int i=0; i &lt; num_pts; i++)<br>{<br>   pts-&gt;InsertPoint(i, x(i), y(i), 0);<br>   vecArr-&gt;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-&gt;SetNumberOfCells(num_cells);<br><br>for (unsigned int i=0; i &lt; num_cells; i++)<br>{<br>   cellA-&gt;InsertNextCell(3);<br>   cellA-&gt;InsertCellPoint( elem(i, 0) );<br>
   cellA-&gt;InsertCellPoint( elem(i, 1) );<br>   cellA-&gt;InsertCellPoint( elem(i, 2) );<br>}<br><br>vtkUnstructuredGrid *uGrid = vtkUnstructuredGrid::New();<br>uGrid-&gt;Allocate(num_cells, num_cells);<br>uGrid-&gt;SetCells( 
 VTK_TRIANGLE, cellA);<br>uGrid-&gt;SetPoints(pts);<br>uGrid-&gt;GetPointData()-&gt;SetVector(vecArr);<br><br>vtkArrowSource *arrow = vtkArrowSource::New();<br>arrow-&gt;SetTipResolution(1);<br>arrow-&gt;SetTipRadius(0.1);<br>
arrow-&gt;SetTipLength(0.35);<br>arrow-&gt;SetShaftResolution(0.1);<br>arrow-&gt;SetShaftRadius(0.03);<br><br>vtkGlyph3D *glyph = vtkGlyph3D::New();<br>glyph-&gt;SetInput(uGrid);<br>glyph-&gt;SetSource(arrow-&gt;GetOutput());<br>
glyph-&gt;SetVectorModeToUseVector();<br>glyph-&gt;SetColorModeToColorByVector();<br>glyph-&gt;SetScaleModeToDataScalingOff();<br>glyph-&gt;OrientOn();<br>glyph-&gt;SetScaleFactor(0.01);<br><br>vtkPolyDataMapper *gMapper = vtkPolyDataMapper::New();<br>
gMapper-&gt;SetInput( glyph-&gt;GetOutput());<br>gMapper-&gt;ScalarVisibilityOn();<br>gMapper-&gt;SetScalarRange(uGrid-&gt;GetScalarRange());<br><br>vtkActor *gactor = vtkActor::New();<br>gactor-&gt;SetMapper(gMapper);<br>
<br>pRenderer-&gt;AddActor(gactor);<br><br>pRenderer-&gt;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&amp;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="\&quot;_blank\&quot;">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="\&quot;_blank\&quot;">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="\&quot;_blank\&quot;">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="\&quot;_blank\&quot;">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="\&quot;_blank\&quot;">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
<br></font></blockquote></div><br></div>
</rakeshthp@in.com></blockquote>