[vtkusers] CellLocator, Octrees and Segfaults...
Philipp Kemmeter
gildedfalcon at googlemail.com
Sun Oct 22 15:52:14 EDT 2006
Heya!
While trying to get my Polydata to and octree structure, I found
vtkCellLocator as a class, which should do so.
I've tried to use it and to iterate through those cubic cells which
are the nodes of an octree. But without success.
Here is the code snip of my try:
vtkSphereSource *sphere = vtkSphereSource::New();
sphere->SetThetaResolution(8); sphere->SetPhiResolution(8);
sphere->SetRadius(1.0);
sphere->Update();
vtkPolyDataMapper *sphereMapper = vtkPolyDataMapper::New();
sphereMapper->SetInput(sphere->GetOutput());
vtkActor *sphereActor = vtkActor::New();
sphereActor->SetMapper(sphereMapper);
// Build a locator
vtkCellLocator *cellLocator = vtkCellLocator::New();
cellLocator->SetDataSet(sphere->GetOutput());
cellLocator->BuildLocator();
int num = cellLocator->GetNumberOfBuckets();
for (int i = 0; i < num; i++) {
std::cout << "Bucket " << i << ": ";
std::cout << cellLocator->GetCells(i)->GetNumberOfIds();
}
The output is short: "Segmentation Error".
Why?
The expression of kill is cellLocator->GetCells(i)->GetNumberOfIds();
more precisely ->GetNumberOfIds();
It dies while accessing the cell got by GetCells(i).
So, do you have any suggestions? Or is my thinking simply wrong?
Thanks for you help,
Phil
--
www.project-virus.de - das einzigarte Browsergame
More information about the vtkusers
mailing list