[vtkusers] VTK and OSX 10.6

greg ricker rickerg at tds.net
Thu Mar 18 23:11:00 EDT 2010


I have a VTK/QT application that runs under windows. I recently tried to 
move it to OSX. I ran into trouble and I am not sure if  my
usage of VTK is incorrect or there is an issue with OSX and VTK. One 
problem is with vtkCutter.

I have a model data from a 3ds file. It imports and displays correctly. 
The z data values start at 0 and go negative. The issue is that 
sometimes the data is
not exactly at 0. In order to find where the data really begins I use a 
cutter and plane to work from 0 to some point where the model bounds are 
no longer 0.
I adjust the plane origin along the z axis starting from 0 in -1 
increments. As soon as the cutter finds the model I have an idea of how 
far from 0 the data is offset.
The code below works fine on Windows but cutEdges->UpdateWholeExtent(); 
crashes when offset  is less then 0 (plane->SetOrigin(0, 0, -1))

I am doing something like this:
    vtkPlane   *plane=vtkPlane::New();
    plane->SetNormal(0, 0, 1);  
    vtkCutter  *cutEdges=vtkCutter::New();
    cutEdges->SetInput(modelData);
    cutEdges->SetCutFunction(plane);
    offset=1;
  do {

        plane->SetOrigin(0, 0, -offset);
        cutEdges->UpdateWholeExtent();
        modelBounds = cutEdges->GetOutput()->GetBounds();  
} while(abs((modelBounds[0]-modelBounds[1])) <= 2);   //xmin = 
modelBounds[0]   xmax = modelBounds[1]

Again this could be my poor use of VTK but I am not sure why it works on 
Windows and not OSX.

Thanks,

Greg



More information about the vtkusers mailing list