[vtkusers] Clipping objects
Yunier López Martinez
ylopez at estudiantes.uci.cu
Thu Sep 20 11:19:02 EDT 2012
Hello , I'm trying to make a clipping to all objects that are in the scene with the same clip function ...
This is the code I have so far :
vtkPointSource *points = vtkPointSource::New();
points->SetNumberOfPoints(500);
vtkPolyDataMapper *pmapper = vtkPolyDataMapper::New();
pmapper->SetInputConnection(points->GetOutputPort());
//vtkActor *pactor = vtkActor::New();
//pactor->SetMapper(pmapper);
//pactor->GetProperty()->SetColor(1,0,0);
vtkCubeSource *cube = vtkCubeSource::New();
vtkPolyDataMapper *cmapper = vtkPolyDataMapper::New();
cmapper->SetInputConnection(cube->GetOutputPort());
//vtkActor *cactor = vtkActor::New();
//cactor->SetMapper(cmapper);
//cactor->GetProperty()->SetColor(1,1,0);
vtkPolyDataAlgorithm *all = vtkPolyDataAlgorithm::New();
all->AddInputConnection(points->GetOutputPort());
all->AddInputConnection(points1->GetOutputPort());
vtkPlane* plane = vtkPlane::New();
vtkClipPolyData *clip = vtkClipPolyData::New();
clip->SetClipFunction(plane);
clip->InsideOutOn();
clip->SetInputConnection(all->GetOutputPort());
vtkPolyDataMapper *mapper = vtkPolyDataMapper::New();
mapper->SetInputConnection(clip->GetOutputPort());
vtkActor *actor = vtkActor::New();
actor->SetMapper(mapper);
//renderer->AddActor(pactor); This does work , but it shows the object without clipping ( logically )
//renderer->AddActor(cactor); ||
renderer->AddActor(actor); ----- nothing happens with this
I want to clarify that I can do the clipping to a single object successfully , even I can do multiple clipping to the same object
10mo. ANIVERSARIO DE LA CREACION DE LA UNIVERSIDAD DE LAS CIENCIAS INFORMATICAS...
CONECTADOS AL FUTURO, CONECTADOS A LA REVOLUCION
http://www.uci.cu
http://www.facebook.com/universidad.uci
http://www.flickr.com/photos/universidad_uci
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20120920/68227051/attachment.htm>
More information about the vtkusers
mailing list