[vtkusers] vtkStructuredGrid
Rakesh Hammond
rakesh.hammond at googlemail.com
Sun Mar 1 12:50:36 EST 2009
Dear all,
I am trying to do something very simple - I would like to display a
structured mesh on the screen.
I have used the following code
vtkPoints *points = vtkPoints::New();
points->Allocate(dims[0]*dims[1]*dims[2]);
for(i=0; i<dims[0]; i++){
for(j=0; j<dims[1]; j++){
for(k=0; k<dims[2]; k++){
test[0]=i; test[1]=j; test[2]=k;
points->InsertPoint(index,test);
index++;
}
}
}
// Create the structured grid.
vtkStructuredGrid *sgrid = vtkStructuredGrid::New();
sgrid->SetDimensions(dims);
sgrid->SetPoints(points);
sgrid->Update();
vtkStructuredGridGeometryFilter *plane =
vtkStructuredGridGeometryFilter::New();
plane->SetInput(sgrid);
vtkPolyDataMapper *sgridMapper = vtkPolyDataMapper::New();
sgridMapper->SetInputConnection(plane->GetOutputPort());
This displays the points, not the lines to display the mesh - if i use the
vtkOutLineFilter, then I can
display the outline, but not all lines inside the object. Can some one
please let me know what I need
to do display the mesh on the screen rather than just the points?
Thanks,
Rakesh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20090301/2a95022f/attachment.htm>
More information about the vtkusers
mailing list