<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< daviddoria+vtk@gmail.com ><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>> Hello,<br>><br>> I dont know mush about wrapping the code. It would be nice if anyone helps<br>> me out. Here is my code to display vectors<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(3);<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<br>> 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>> vtkGlyph2D *glyph = vtkGlyph2D::New();<br>> glyph->SetInput(uGrid);<br>> glyph->SetColorModeToColorByVector();<br>> glyph->OrientOn();<br>> glyph->SetScaleFactor(1);<br>><br>> vtkGlyphSource2D *glyphSource = vtkGlyphSource2D::New();<br>> glyphSource->FilledOff();<br>> glyphSource->SetGlyphTypeToArrow();<br>><br>> glyph->SetInputConnection(1, glyphSource->GetOutputPort());<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>> Do i need to derive a class from vtkActor and override RenderOpaqueGeometry<br>> code..?? If so, then how do i scale the glyphs..?? and which part will this<br>> code come into picture. Am not that much expert in C++ but can manage with a<br>> guidance.<br>><br>> Thanks<br>><br>> Regards<br>><br>> ---------- Original message ----------<br>> From:Karthik Krishnan< karthik.krishnan@kitware.com ><br>> Date: 25 Jan 10 17:08:12<br>> Subject: Re: [vtkusers] Vector arrows form a solid patch. How to rectify??<br>> To: Rakesh Patil<br>><br>> You'll have to write your own actor wrapping around your existing code<br>> and overriding RenderOpaqueGeometry. Its not hard. See several actors<br>> in VTK/Rendering that scale their font size based on the size of the<br>> viewport etc. Yo
u may have to do something similar scaling your glyphs<br>> based on the parallel scale / view angle.<br>><br>> On Sat, Jan 23, 2010 at 12:49 PM, Rakesh Patil wrote:<br>>> hello,<br>>><br>>> When i display a vector plot using vtk, it is shown very small like a dot.<br>>> And when i zoom into it, it gets more visible and big. But, i want it in<br>>> such a way, that when i display it, at the initial stage itself, the<br>>> vectors<br>>> must be big enough that can be seen. And when we zoom into it, then the<br>>> arrow size must proportionately become small. I Used setscalefactor for<br>>> glyph object and got the arrow size increased.<br>>><br>>> But where the data is very dense, there a solid patch is formed due to<br>>> which<br>>> i cannot make out whats the length of the arrow. So as we zoom in, the<br>>> arrow<br>>> size must be reduced so that at the denser location, i ca
n differentiate<br>>> among two vectors. How can i do this..??<br>>><br>>> Thanks in advance<br>>><br>>> Regards<br>>> Rakesh<br>>><br>>> Get Yourself a cool, short @in.com Email ID now!<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<br>>> <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:<br>>> <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>> _________________________________<br>> 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>