Hello,<div><br></div><div>Here is a small piece of code. This is a very simple code to display a triangular grid:</div><div><br></div><div>unsigned int numPts = x.size();</div><div><br></div><div>vtkSmarPointer<vtkPoints> pnts = vtkSmartPointer<vtkPoints>::New();</div>
<div>pnts->SetNumberOfPoints(numPts);</div><div><br></div><div>vtkSmartPointer<vtkFloatArray> scalar = vtkSmartPointer<vtkFloatArray>::New();</div><div>scalar->SetNumberOfTuples(numPts);</div><div><br></div>
<div>for ( unsigned int i = 0; i < numPts; i++ )</div><div>{</div><div><b><i> pnts->InertPoint(i, x(i), y(i), z(i));</i></b></div><div> scalar->InsertTuple1(i, z(i));</div><div>}</div><div><br></div><div>unsigned int numCells = elems.rows();</div>
<div>vtkSmartPointer<vtkCellArray> cellArray = vtkSmartPointer<vtkCellArray>::New();</div><div>for( unsigned int i = 0; i < numCells; i++ )</div><div>{</div><div> cellArray->InsertNextCell(3);</div><div>
cellArray->InsertCellPoint( elem(i,0) );</div><div> cellArray->InsertCellPoint( elem(i,1) );</div><div> cellArray->InsertCellPoint( elem(i,2) );</div><div>} </div><div><br></div><div>unGrid = vtkUnstructuredGrid::New();</div>
<div>unGrid->Allocate(numCells, numCells);</div><div>unGrid->SetCells(cellArray);</div><div>unGrid->SetPoints(pnts);</div><div><br></div><div>vtkSmartPointer<vtkDataSetMapper> dsmapper = vtkSmartPointer<vtkDataSetMapper>::New();</div>
<div>dsmapper->SetInput(unGrid);</div><div><br></div><div>gridActor = vtkActor::New();</div><div>gridActor->SetMapper(dsmapper);</div><div>gridActor->GetProperty()->SetColor(0, 0, 0);</div><div>gridActor->GetProperty()->SetRepresentationToWireframe();</div>
<div><br></div><div>pRenderer->AddActor(gridActor);</div><div>pRenderer->ResetCamera();</div><div><br></div><div>This code works very well. But with a small variation. The statement marked on bold letters is the one causing this behavior.</div>
<div><br></div><div>If I replace the last argument z(i), by 0, then the grid fits directly into the frame(window), but with the same code as it is above, it is displayed very small. And i need to zoom it to bring it to the bigger form.</div>
<div><br></div><div>What should i do to resolve this? When i load a dataset, it should automatically, fit to the window size.</div><div><br></div><div>Thanks</div><div><br></div><div>Regards</div><div>Rakesh Patil</div>