<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Hi,<br>
<br>
I'm wondering what the best way to do this is?<br>
<br>
Currently the cubes are defined in a dynamic array of
vtkCubeSources, see code below. This results in very slow
interaction.<br>
<br>
Is there a more lightweight approach to this problem? There is a
typical image below.<br>
<br>
// Create a cube array.<br>
int numCubes = 44582; // in practice this value could be
anything<br>
vtkCubeSource **cubeSource = new vtkCubeSource* [numCubes]; <br>
vtkPolyDataMapper **mapper = new vtkPolyDataMapper* [numCubes];<br>
vtkActor **actor = new vtkActor* [numCubes];<br>
<br>
for (int i = 0; i < ca.numCubes; i++)<br>
{<br>
cubeSource[i] = vtkCubeSource::New(); <br>
mapper[i] = vtkPolyDataMapper::New(); <br>
actor[i] = vtkActor::New();<br>
<br>
cubeSource[i]->SetCenter(ca.cubeCentre[i].x ,
ca.cubeCentre[i].y, ca.cubeCentre[i].z);<br>
cubeSource[i]->SetXLength(ca.cubeLength[i] );<br>
cubeSource[i]->SetYLength(ca.cubeLength[i] );<br>
cubeSource[i]->SetZLength(ca.cubeLength[i] );<br>
<br>
mapper[i]->SetInputConnection(cubeSource[i]->GetOutputPort());<br>
actor[i]->SetMapper(mapper[i]);<br>
actor[i]->GetProperty()->SetColor(255,0,0);<br>
actor[i]->GetProperty()->SetRepresentationToWireframe();<br>
<br>
renderer->AddActor(actor[i]);<br>
<br>
}<br>
<br>
<img src="cid:part1.09080609.05040903@gmail.com" alt="" height="769"
width="974"><br>
</body>
</html>