<br>i guess, the way i explained the problem was not correct.. here it goes,<br><br>for a large area, if i draw vecot of actual size, it will be visible as a small dot. So i need to scale and make it <br>large enough that it is visible properly.. And as i zoom in, and go closer to them, they must slowly,<br>shrink to their actual size... <br><br>As kaarthik said, i think i need to write my own actor . But how to do it, am not able to understand..<br>can anyone guide me..??<br><br>Thanks<br>Regards<br><blockquote><br>---------- Original message ----------<br>From:David Doria&lt; daviddoria+vtk@gmail.com &gt;<br>Date: 27 Jan 10 19:54:04<br>Subject:  Re: [vtkusers] Vector arrows form a solid patch. How to rectify??<br>To: rakeshthp@in.com<br><br>On Wed, Jan 27, 2010 at 8:56 AM, Rakesh Patil <rakeshthp@in.com> wrote:<br>&gt; Hello,<br>&gt;<br>&gt; I dont know mush about wrapping the code. It would be nice if anyone helps<br>&gt; me out. Here is my code to display vectors<br>&gt;
 <br>&gt; unsigned int num_pts = x.size();<br>&gt;<br>&gt; vtkPoints *pts = vtkPoints::New();<br>&gt; pts-&gt;SetNumberOfPoints(num_pts);<br>&gt;<br>&gt; vtkDoubleArray *vecArr = vtkDoubleArray::New();<br>&gt; vecArr-&gt;SetNumberOfComponents(3);<br>&gt; vecArr-&gt;SetNumberOfTuples(num_pts);<br>&gt;<br>&gt; for( unsigned int i=0; i &lt; num_pts; i++)<br>&gt; {<br>&gt; pts-&gt;InsertPoint(i, x(i), y(i), 0);<br>&gt; vecArr-&gt;InsertTuple2(i, vel_u(i), vel_v(i));<br>&gt; }<br>&gt;<br>&gt; unsigned int num_cells = elem.rows(); // elem is a matrix that contains the<br>&gt; index of nodes of elements in the mesh<br>&gt;<br>&gt; vtkCellArray *cellA = vtlCellArray::New();<br>&gt; cellA-&gt;SetNumberOfCells(num_cells);<br>&gt;<br>&gt; for (unsigned int i=0; i &lt; num_cells; i++)<br>&gt; {<br>&gt; cellA-&gt;InsertNextCell(3);<br>&gt; cellA-&gt;InsertCellPoint( elem(i, 0) );<br>&gt; cellA-&gt;InsertCellPoint( elem(i, 1) );<br>&gt; cellA-&gt;InsertCellPoint( elem(i, 2) );<br>&gt; }<br
 >&gt;<br>&gt; vtkUnstructuredGrid *uGrid = vtkUnstructuredGrid::New();<br>&gt; uGrid-&gt;Allocate(num_cells, num_cells);<br>&gt; uGrid-&gt;SetCells( VTK_TRIANGLE, cellA);<br>&gt; uGrid-&gt;SetPoints(pts);<br>&gt; uGrid-&gt;GetPointData()-&gt;SetVector(vecArr);<br>&gt;<br>&gt; vtkGlyph2D *glyph = vtkGlyph2D::New();<br>&gt; glyph-&gt;SetInput(uGrid);<br>&gt; glyph-&gt;SetColorModeToColorByVector();<br>&gt; glyph-&gt;OrientOn();<br>&gt; glyph-&gt;SetScaleFactor(1);<br>&gt;<br>&gt; vtkGlyphSource2D *glyphSource = vtkGlyphSource2D::New();<br>&gt; glyphSource-&gt;FilledOff();<br>&gt; glyphSource-&gt;SetGlyphTypeToArrow();<br>&gt;<br>&gt; glyph-&gt;SetInputConnection(1, glyphSource-&gt;GetOutputPort());<br>&gt;<br>&gt; vtkPolyDataMapper *gMapper = vtkPolyDataMapper::New();<br>&gt; gMapper-&gt;SetInput( glyph-&gt;GetOutput());<br>&gt; gMapper-&gt;ScalarVisibilityOn();<br>&gt; gMapper-&gt;SetScalarRange(uGrid-&gt;GetScalarRange());<br>&gt;<br>&gt; vtkActor *gactor = vtkActor::New();<
 br>&gt; gactor-&gt;SetMapper(gMapper);<br>&gt;<br>&gt; pRenderer-&gt;AddActor(gactor);<br>&gt;<br>&gt; pRenderer-&gt;Rese tCamera();<br>&gt;<br>&gt; Do i need to derive a class from vtkActor and override RenderOpaqueGeometry<br>&gt; code..?? If so, then how do i scale the glyphs..?? and which part will this<br>&gt; code come into picture. Am not that much expert in C++ but can manage with a<br>&gt; guidance.<br>&gt;<br>&gt; Thanks<br>&gt;<br>&gt; Regards<br>&gt;<br>&gt; ---------- Original message ----------<br>&gt; From:Karthik Krishnan&lt; karthik.krishnan@kitware.com &gt;<br>&gt; Date: 25 Jan 10 17:08:12<br>&gt; Subject: Re: [vtkusers] Vector arrows form a solid patch. How to rectify??<br>&gt; To: Rakesh Patil<br>&gt;<br>&gt; You'll have to write your own actor wrapping around your existing code<br>&gt; and overriding RenderOpaqueGeometry. Its not hard. See several actors<br>&gt; in VTK/Rendering that scale their font size based on the size of the<br>&gt; viewport etc. Yo
 u may have to do something similar scaling your glyphs<br>&gt; based on the parallel scale / view angle.<br>&gt;<br>&gt; On Sat, Jan 23, 2010 at 12:49 PM, Rakesh Patil wrote:<br>&gt;&gt; hello,<br>&gt;&gt;<br>&gt;&gt; When i display a vector plot using vtk, it is shown very small like a dot.<br>&gt;&gt; And when i zoom into it, it gets more visible and big. But, i want it in<br>&gt;&gt; such a way, that when i display it, at the initial stage itself, the<br>&gt;&gt; vectors<br>&gt;&gt; must be big enough that can be seen. And when we zoom into it, then the<br>&gt;&gt; arrow size must proportionately become small. I Used setscalefactor for<br>&gt;&gt; glyph object and got the arrow size increased.<br>&gt;&gt;<br>&gt;&gt; But where the data is very dense, there a solid patch is formed due to<br>&gt;&gt; which<br>&gt;&gt; i cannot make out whats the length of the arrow. So as we zoom in, the<br>&gt;&gt; arrow<br>&gt;&gt; size must be reduced so that at the denser location, i ca
 n differentiate<br>&gt;&gt; among two vectors. How can i do this..??<br>&gt;&gt;<br>&gt;&gt; Thanks in advance<br>&gt;&gt;<br>&gt;&gt; Regards<br>&gt;&gt; Rakesh<br>&gt;&gt;<br>&gt;&gt; Get Yourself a cool, short @in.com Email ID now!<br>&gt;&gt; _______________________________________ ________<br>&gt;&gt; Powered by <a target=\"_blank\" href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>&gt;&gt;<br>&gt;&gt; Visit other Kitware open-source projects at<br>&gt;&gt; <a target=\"_blank\" href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>&gt;&gt;<br>&gt;&gt; Please keep messages on-topic and check the VTK FAQ at:<br>&gt;&gt; <a target=\"_blank\" href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>&gt;&gt;<br>&gt;&gt; Follow this link to subscribe/unsubscribe:<br>&gt;&gt; <a target=\"_blank\" href="http://www.vtk.org/mailman/listinfo/vtkusers"
  target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>&gt;<br>&gt; _________________________________<br>&gt; Karthik Krishnan<br><br>This is only a very partial answer, but you can scale an arrow using<br>the vtkTransformFilter like this:<br><br>http://www.vtk.org/Wiki/VTK/Examples/TransformFilter<br><br>Thanks,<br><br>David<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>http://www.vtk.org/mailman/listinfo/vtkusers<br></rakeshthp@in.com><
 /blockquote> <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;">Get Yourself a cool, short <b>@in.com</b> Email ID now!</a></div>