[vtkusers] Re: Drawing Grid Lines

Nigel Nunn nNunn at ausport.gov.au
Sun Oct 27 01:25:25 EDT 2002


Hi Poonam, 
 
> I want to draw grid lines on the vtk rendering window. 
 
vtkRectilinearGrid and vtkRectilinearGridGeometryFilter work 
together to allow high-powered grid construction.  In an old 
C++ project, I used something like this to get an XY grid: 
(also needed YZ and ZX grids) 
----------------------------------------------  
  int m = 30, n = 30, p = 15; 
 
  rgrid = vtkRectilinearGrid::New(); 
    rgrid->SetDimensions(m,n,p); 
    rgrid->SetXCoordinates(xCoords); 
    rgrid->SetYCoordinates(yCoords); 
    rgrid->SetZCoordinates(zCoords); 
 
  planeXY = vtkRectilinearGridGeometryFilter::New(); 
    planeXY->SetInput(rgrid); 

    planeXY->SetExtent( 0,   (m-1),  0,   (n-1),  0, 0   ); 
  //planeXZ->SetExtent( 0,   (m-2), (n-1),(n-1),  1,(p-1)); 
  //planeYZ->SetExtent((m-1),(m-1),  0,   (n-2),  1, p   ); 
  
  mapXY = vtkPolyDataMapper::New(); 
    mapXY->SetInput(planeXY->GetOutput()); 

  actorXY = vtkActor::New(); 
    actorXY->SetMapper(mapXY); 
 
  // Lock each grid Actor 
  actorXY->PickableOff(); 
 
---------------------------------------------- 
See the Vtk documentation for more help. 
Nigel 
 
 

**********************************************************************
This message is intended for the addressee named and may contain 
confidential and privileged information. If you are not the intended 
recipient please note that any form of distribution, copying or use of 
this communication or the information in it is strictly prohibited and 
may be unlawful. If you receive this message in error, please delete it 
and notify the sender.

Keep up to date with what's happening in Australian sport.
Visit http://www.ausport.gov.au
**********************************************************************



More information about the vtkusers mailing list