[vtkusers] Cutting a cube with an irregular surface.

Andrew J. P. Maclean a.maclean at acfr.usyd.edu.au
Tue Feb 5 21:49:02 EST 2002


If I have an convex regular surface, say S1, whose bounds are
(x-min,x-max,y-min,y-max,z-min,z-max). S1 is convex i.e for each point
(x,y) there exists one and only one z) and regular - it has no holes in
it. S1 is obtained from a dataset of unordered x,y,z points and the
surface is obtained by triangulating it using a Delaunay 2D
triangulation. (z - z-min) will be the "height" of the surface above the
plane defined by (x-min,x-max,y-min,y-max).

How can I create a 3-D volume defined by the plane
(x-min,x-max,y-min,y-max) and the height above the plane (z - z-min)?

 

I thought of using the surface S1 to cut a cube whose bounds are
(x-min,x-max,y-min,y-max,z-min,z-max), but I am not sure how to do this.

 

Has anyone any clues?

 

I thought of trying something like this, however the implicit dataset
can't evaluate the dataset.

 

// Generate the surface S1

      this->PointSource[0]->GetPolyDataOutput()->GetBounds(bounds[0]);

 
this->Del2D[0]->SetInput(this->PointSource[0]->GetPolyDataOutput());

      this->Deci[0]->SetInput(this->Del2D[0]->GetOutput());

      this->Smoother[0]->SetInput(this->Deci[0]->GetOutput());

      this->Elev[0]->SetInput(this->Smoother[0]->GetOutput());

      this->Elev[0]->SetLowPoint(0,0,bounds[0][4]);

      this->Elev[0]->SetHighPoint(0,0,bounds[0][5]);

      this->Elev[0]->SetScalarRange(bounds[0][4],bounds[0][5]);

      this->Lut[0]->SetHueRange(0.66667,0);

      this->Map[0]->SetInput(this->Elev[0]->GetPolyDataOutput());

      this->Map[0]->SetLookupTable(this->Lut[0]);

      this->Act[0]->SetMapper(this->Map[0]);

      this->Act[0]->GetProperty()->SetOpacity(0.7);

      this->ren->AddProp(this->Act[0]); // OK so far, we have the
surface.

 

// Try to cut the cube with the surface.

      this->cube[0]->SetBounds(bounds[0]);

      this->implicitDataset[0]->SetDataSet(this->Deci[0]->GetOutput());

      this->cut[0]->SetCutFunction(this->implicitDataset[0]);

      this->cut[0]->SetInput(this->cube[0]->GetOutput());

      this->cut[0]->Update();  // Fails here because it can't evaluate
the dataset.

 

      this->map->SetInput(this->cut[0]->GetOutput());

      this->act->SetMapper(this->map);

      this->ren->AddProp(this->act);

 

Declarations are:

      PointSource[2];

      vtkDelaunay2D *Del2D[2];

      vtkDecimatePro *Deci[2];

      vtkSmoothPolyDataFilter *Smoother[2];

      vtkElevationFilter *Elev[2];

      vtkLookupTable *Lut[2];

      vtkPolyDataMapper *Map[2];

      vtkActor *Act[2];

 

      vtkCubeSource *cube[2];

      vtkImplicitDataSet *implicitDataset[2];

      vtkCutter *cut[2];

 

      vtkDataSetMapper *map;

 

 

Thanks in advance for any help,

Andrew

 

 


___________________________________________
Andrew J. P. Maclean


Postal:

Australian Centre for Field Robotics
The Rose Street Building J04
The University of Sydney  2006  NSW
AUSTRALIA


Room:

106


Phone:

+61 2 9351 3283


Fax:

+61 2 9351 7474


 

 <http://www.acfr.usyd.edu.au/> http://www.acfr.usyd.edu.au/

___________________________________________

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20020206/a19c995f/attachment.htm>


More information about the vtkusers mailing list