[vtkusers] vtkPolyData to be used with vtkImageStencil.

Dean Inglis dean.inglis at camris.ca
Wed Oct 25 10:44:11 EDT 2006


Anja,

I would also advise adding a vtkOrientationMarkerWidget
+ vtkAxesActor to show exactly what the orientation
in 3 space your image, polydata, and points are in.

Dean



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