[vtkusers] vtkPDataSetToPolyDataFilter

Robbie Banks robbie.banks at gmail.com
Fri Jan 28 13:48:39 EST 2011


Can anyone see where this is going wrong?

 

I have a scene where the even numbered actors are reflections of the data
for the odd actors.

 

I am trying to create a single vtkPolyData set with the ploydata for the
whole scene. The reflections are created with a vtkReflectionFilter, which
creates a vtkDataSet.

 

I am trying to cast this vtkDataSet down and then convert it to vtkPolyData
to be appended.

 

The compiler is throwing an error when I try and create the
vtkDataSetToPolyDataFilter saying:

 

Error: invalid conversion from 'vtkAlgorithm' to
'vtkDataSetToPolyDataFilter.

 

I guess it doesn't like being created with a vtkSmartPointer, but I don't
know how to fix it.

 

Thoughts?

 

Robbie

 

Code below:

 

vtkSmartPointer<vtkAppendPolyData> pAppendData =
vtkSmartPointer<vtkAppendPolyData>::New();

int reflectedActor = 0;

for(int i = 0; i < actors.size(); i++){

      vtkSmartPointer<vtkActor> actor = actors[i];

      if(actor->IsA("vtkActor")){

            vtkSmartPointer<vtkPolyData> pPolyData =
vtkSmartPointer<vtkPolyData>::New();

            if(i==reflectedActor){

                  vtkSmartPointer<vtkDataSet> pDataSet =
vtkDataSet::SafeDownCast(actor->GetMapper()->GetInput());

                  vtkSmartPointer<vtkDataSetToPolyDataFilter> pFilter =
vtkSmartPointer<vtkDataSetToPolyDataFilter>::New();

                  pFilter->SetInput(pDataSet2);

                  pFilter->Update();

                  pPolyData = pFilter->GetOutput();

                  reflectedActor+=2;

            }

            else

                  pPolyData =
vtkPolyData::SafeDownCast(actor->GetMapper()->GetInput());

            pAppendData->AddInput(pPolyData);

      }

}

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20110128/b5e2671a/attachment.htm>


More information about the vtkusers mailing list