[vtkusers] Obtain Points from Polydata

Matias Montroull matimontg at gmail.com
Wed Jan 15 14:00:30 EST 2014


I was able to do it..

  polys= skinnormals.GetOutput();
              polys.Update();
              polys.BuildCells();

              for (int i = 0; i < polys.GetNumberOfPoints(); i++)
              {
                  double[] p = new double[3];
                  p=polys.GetPoint(i);
              }
              vtkCellArray Cellarray = new vtkCellArray();
              Cellarray = polys.GetPolys();

              int numcells = Cellarray.GetNumberOfCells();

              vtkIdList idlist = new vtkIdList();
              Cellarray.InitTraversal();

              for (int j = 0; j < polys.GetNumberOfPolys(); j++)
              {
                  Cellarray.GetNextCell(idlist);
                  int a = idlist.GetId(0);
                  int b = idlist.GetId(1);
                  int c = idlist.GetId(2);
                  double[] pa = new double[3];
                  pa = polys.GetPoint(a);
                  double[] pb = new double[3];
                  pb = polys.GetPoint(b);
                  double[] pc = new double[3];
                  pc = polys.GetPoint(c);
              }

I'm assuming pa, pb and pc conform a triangle..


On Wed, Jan 15, 2014 at 3:37 PM, Matias Montroull <matimontg at gmail.com>wrote:

> Ok, no success so far. So, following my code below:
>
>   vtkPolyDataNormals skinnormals = vtkPolyDataNormals.New();
>
> skinnormals.SetInputConnection(skinextractor.GetOutputPort());
>               skinnormals.SetFeatureAngle(90.0);
>               skinnormals.ComputePointNormalsOn();
>
>               vtkPolyData polys = new vtkPolyData();
>
>
>               polys= skinnormals.GetOutput();
>               polys.Update();
>               polys.BuildCells();
>
>               for (int i = 0; i < polys.GetNumberOfPoints(); i++)
>               {
>                   double[] p = new double[3];
>                   p=polys.GetPoint(i);
>               }
>               vtkCellArray Cellarray = new vtkCellArray();
>               Cellarray = polys.GetPolys();
>
>               int numcells = Cellarray.GetNumberOfCells();
>
> I see the number of cells but I'm not sure how to iterate through each
> Cell and get the triangles points..}
>
> Is there a C# example on how to use GetCellPoints??
>
>
> On Wed, Jan 15, 2014 at 2:48 PM, Matias Montroull <matimontg at gmail.com>wrote:
>
>> Yes, Cells.. I will take a look at those, thanks!
>>
>>
>> On Wed, Jan 15, 2014 at 2:37 PM, lgriffiths <lgriffiths.aero at gmail.com>wrote:
>>
>>> By triangles I assume you mean the cells? You can use GetCell
>>>
>>> Take a look at GetPointCells and GetCellPoints, these will return The
>>> cells
>>> conntect to a point, or Points connected to a cell
>>>
>>> Remember to use polydata.BuildCells() or polydata.BuildLinks()
>>>
>>> Take a look here also if you want to loop over the connectivity:
>>>
>>> http://vtk.1045678.n5.nabble.com/Neighbours-of-a-point-in-a-mesh-td1236245.html#a1236246
>>>
>>>
>>>
>>>
>>>
>>> --
>>> View this message in context:
>>> http://vtk.1045678.n5.nabble.com/Obtain-Points-from-Polydata-tp5725372p5725414.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/20140115/0f47c6ae/attachment.html>


More information about the vtkusers mailing list