[vtkusers] display tens of thousands of cubes
Alex Southern
mrapsouthern at gmail.com
Tue Feb 7 11:12:21 EST 2012
Hi,
I'm wondering what the best way to do this is?
Currently the cubes are defined in a dynamic array of vtkCubeSources,
see code below. This results in very slow interaction.
Is there a more lightweight approach to this problem? There is a typical
image below.
// Create a cube array.
int numCubes = 44582; // in practice this value could be anything
vtkCubeSource **cubeSource = new vtkCubeSource* [numCubes];
vtkPolyDataMapper **mapper = new vtkPolyDataMapper* [numCubes];
vtkActor **actor = new vtkActor* [numCubes];
for (int i = 0; i < ca.numCubes; i++)
{
cubeSource[i] = vtkCubeSource::New();
mapper[i] = vtkPolyDataMapper::New();
actor[i] = vtkActor::New();
cubeSource[i]->SetCenter(ca.cubeCentre[i].x ,
ca.cubeCentre[i].y, ca.cubeCentre[i].z);
cubeSource[i]->SetXLength(ca.cubeLength[i] );
cubeSource[i]->SetYLength(ca.cubeLength[i] );
cubeSource[i]->SetZLength(ca.cubeLength[i] );
mapper[i]->SetInputConnection(cubeSource[i]->GetOutputPort());
actor[i]->SetMapper(mapper[i]);
actor[i]->GetProperty()->SetColor(255,0,0);
actor[i]->GetProperty()->SetRepresentationToWireframe();
renderer->AddActor(actor[i]);
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20120207/983e3eb0/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ehiiiabc.png
Type: image/png
Size: 148968 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20120207/983e3eb0/attachment.png>
More information about the vtkusers
mailing list