[vtkusers] Clipping objects
Bill Lorensen
bill.lorensen at gmail.com
Thu Sep 20 14:02:23 EDT 2012
Where is your plane located WRT your polydata?
On Wed, Sep 19, 2012 at 4:53 PM, Yunier López Martinez <
ylopez at estudiantes.uci.cu> wrote:
> 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
>
> <http://www.uci.cu/>
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
>
--
Unpaid intern in BillsBasement at noware dot com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20120920/8a698cf0/attachment.htm>
More information about the vtkusers
mailing list