[vtkusers] vtkPolyData to be used with vtkImageStencil.

Dean Inglis dean.inglis at camris.ca
Wed Oct 25 10:37:05 EDT 2006


Yes, you have 3 tuples but you set pcoords to have
4, so vtkPoints might think you have an extra point
(undefined or 0,0,0).  A useful filter to use is
vtkIdFilter and vtkLabeledDataFilter to visualize
exactly what point id's make up your polydata.

Dean

-----Original Message-----
From: Anja Ende [mailto:anja.ende at googlemail.com]
Sent: Wednesday, October 25, 2006 10:12 AM
To: Dean Inglis
Cc: vtkusers at vtk.org
Subject: Re: [vtkusers] vtkPolyData to be used with vtkImageStencil.


Ok, another step closer.

First off, something very bizarre happens when I close the loop in the input
points.

So, the first time off, I tried without closing the loop as follows:

float pts[3][3] = {{-49.2188 , -19.6875, zOffset},
                {42.6542, 58.125, zOffset},
                {57.6562, -0.9375, zOffset},

vtkFloatArray* pcoords = vtkFloatArray::New();
pcoords->SetNumberOfComponents(3);
pcoords->SetNumberOfTuples(4);
for (int i=0; i<3; i++)
{
      pcoords->SetTuple(i, pts[i]);
}
// Create vtkPoints and assign pcoords as the internal data array.
  vtkPoints* points = vtkPoints::New();
  points->SetData(pcoords);
  vtkPolyData* polydata = vtkPolyData::New();
  polydata->SetPoints(points);


 vtkCellArray* strips = vtkCellArray::New();
 strips->InsertNextCell(3);
 strips->InsertCellPoint(0);
 strips->InsertCellPoint(1);
 strips->InsertCellPoint(2);

polydata->SetStrips(strips);

I am attaching a screenshot here that displays what happens. At least the
triangle part looks ok!

Now, when I close the loop, the output goes completely bonkers!

Here is a screenshot of the output with the same points when the loop is
closed.

As you can see from the points, it is a simple triable with no cross overs
or anything but it seems to mess up the shape completely...

Any idea what is happening here?

Cheers,
Anja



More information about the vtkusers mailing list