Hello,<br><br>I dont know mush about wrapping the code. It would be nice if anyone helps me out. Here is my code to display vectors<br><br><font color="#000000"><font color="#000000"><font color="#000000">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 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();</font></font></font><br><br>Do i need to derive a class from vtkActor and override RenderOpaqueGeometry code..?? If so, then how do i scale the glyphs..?? and which part will this code come into picture. Am not that much expert in C++ but can manage with a guidance. <br><br>Thanks<br><br>Regards<br><blockquote><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 <rakeshthp@in.com><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. You 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 <rakeshthp@in.com
> 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 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 which<br>> i cannot make out whats the length of the arrow. So as we zoom in, the arrow<br>> size must be reduced so that at the denser location, i can 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>Ph: +1 5188814919, +91 9538477060<br></rakeshthp@in.com></rakeshthp@in.com></blockquote>