[vtkusers] "trade" vtkPoints between actors

Sebastien Jourdain sebastien.jourdain at kitware.com
Wed Aug 7 19:03:44 EDT 2013


Hi Renil,

you were on the right track with Jeff suggestion.

but for the cell array when you build it, try to do something like that.

vtkNew<vtkSphereSource> sphereSource;
vtkPolyData* originSphere = sphereSource->GetOutput();
vtkPoints* originPoints = originSphere->GetPoints();

vtkNew<vtkCellArray> cellsIn;
vtkNew<vtkCellArray> cellsOut;
for(vtkIdType pointId = 0; pointId < originPoints-> GetNumberOfPoints();
++ pointId)
{
vtkCellArray * cells = IsPointInside(originPoints , pointId)
? cellsIn.GetPointer() : cellsOut.GetPointer();
cells->InsertNextCell(1);
cells->InsertCellPoint( pointId );
}

vtkNew<vtkPolyData> inPoly;
inPoly->SetPoints(originSphere->GetPoints())
inPoly->SetVerts(cellsIn.GetPointer());

vtkNew<vtkPolyData> outPoly;
outPoly->SetPoints(originSphere->GetPoints())
outPoly->SetVerts(cellsOut.GetPointer());

Then from those poly how do you render them ?

Seb



On Tue, Aug 6, 2013 at 6:32 PM, Renil <renilac at gmail.com> wrote:

> OK,
>
> I tried the /Vertex/ example, which has no vtk..Source, only
> vtkPolyDataMapper.
> It draws a little square in the window, if in this case I call
> deleteCell(),
> it removes it from the screen.
> Thats why I was wondering if it had anything to do with the addition of the
> vtkSphereSource.
>
> Thanks anyway.
>
>
>
> --
> View this message in context:
> http://vtk.1045678.n5.nabble.com/trade-vtkPoints-between-actors-tp5722498p5722534.html
> Sent from the VTK - Users mailing list archive at Nabble.com.
> _______________________________________________
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20130807/632e5925/attachment.htm>


More information about the vtkusers mailing list