[vtkusers] Vector arrows form a solid patch. How to rectify??

Rakesh Patil rakeshthp at in.com
Wed Jan 27 08:56:03 EST 2010


 Hello,I dont know mush about wrapping the code. It would be nice if anyone helps me out. Here is my code to display vectorsunsignedint numpts = x.size();vtkPoints *pts = vtkPoints::New();pts>SetNumberOfPoints(numpts);vtkDoubleArray*vecArr = vtkDoubleArray::New();vecArr>SetNumberOfComponents(3);vecArr>SetNumberOfTuples(numpts); for( unsigned int i=0; i < numpts; i++){pts>InsertPoint(i, x(i), y(i), 0); vecArr>InsertTuple2(i,velu(i), velv(i));}unsigned int numcells = elem.rows();// elem is a matrix that contains the index of nodes of elements in themesh vtkCellArray *cellA = vtlCellArray::New();cellA>SetNumberOfCells(numcells);for(unsigned int i=0; i < numcells; i++){cellA>InsertNextCell(3); cellA>InsertCellPoint( elem(i, 0));cellA>InsertCellPoint( elem(i, 1) );cellA>InsertCellPoint( elem(i, 2) );}vtkUnstructuredGrid*uGrid = vtkUnstructuredGrid::New();uGrid>Allocate(numcells,numcells);uGrid>SetCells( VTKTRIANGLE, cellA);uGrid>SetPoints(pts);uGrid>GetPointData()>SetVector(vecArr
 );vtkGlyph2D*glyph = vtkGlyph2D::New();glyph>SetInput(uGrid);glyph>SetColorModeToColorByVector();glyph>OrientOn();glyph>SetScaleFactor(1);vtkGlyphSource2D *glyphSource = vtkGlyphSource2D::New();glyphSource>FilledOff();glyphSource>SetGlyphTypeToArrow();glyph>SetInputConnection(1, glyphSource>GetOutputPort());vtkPolyDataMapper*gMapper = vtkPolyDataMapper::New(); gMapper>SetInput( glyph>GetOutput());gMapper>ScalarVisibilityOn();gMapper>SetScalarRange(uGrid>GetScalarRange());vtkActor*gactor = vtkActor::New();gactor>SetMapper(gMapper); pRenderer>AddActor(gactor);pRenderer>ResetCamera();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.ThanksRegards Original message From:Karthik Krishnan< karthik.krishnan at kitware.com >Date: 25 Jan 10 17:08:12Subject:Re: [vtkusers] Vector arrows form a solid patch
 . How to rectify??To: Rakesh Patil You'll have to write your own actor wrapping around your existing codeand overriding RenderOpaqueGeometry. Its not hard. See several actorsin VTK/Rendering that scale their font size based on the size of theviewport etc. You may have to do something similar scaling your glyphsbased on the parallel scale / view angle.On Sat, Jan 23, 2010 at 12:49 PM, Rakesh Patilwrote:> hello,>> When i display a vector plot using vtk, it is shown very small like a dot.> And when i zoom into it, it gets more visible and big. But, i want it in> such a way, that when i display it, at the initial stage itself, the vectors> must be big enough that can be seen. And when we zoom into it, then the> arrow size must proportionately become small. I Used setscalefactor for> glyph object and got the arrow size increased.>> But where the data is very dense, there a solid patch is formed due to which> i cannot make out whats the length of the arrow. So as we zoom in, the a
 rrow> size must be reduced so that at the denser location, i can differentiate> among two vectors. How can i do this..??>> Thanks in advance>> Regards> Rakesh>> Get Yourself a cool, short @in.com Email ID now!> > Powered by www.kitware.com>> Visit other Kitware opensource projects at> http://www.kitware.com/opensource/opensource.html>> Please keep messages ontopic and check the VTK FAQ at:> http://www.vtk.org/Wiki/VTKFAQ>> Follow this link to subscribe/unsubscribe:> http://www.vtk.org/mailman/listinfo/vtkusersKarthik KrishnanPh: +1 5188814919, +91 9538477060 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100127/bee18b0b/attachment.htm>


More information about the vtkusers mailing list