Dear vtk users:
As we know, after add actor to render, we can change the properties of the actor.
Now I tried to change the data of the actor,but it does not work.
My code is as below:
//////////////////////////////////////////////
vtkActor* temp_actor = render->GetActors()->GetLastActor();
vtkMapper* temp_mapper = temp_actor->GetMapper();
vtkPolyData* temp_poly_data = vtkPolyData::SafeDownCast(temp_mapper->GetInput());
vtkPoints* temp_points = temp_poly_data->GetPoints();
int points_num = temp_points->GetNumberOfPoints();
// change z value of 100 points
for (int i = 0; i < 100; i++)
{
//get a random idx
int idx = rand() % (points_num - 0 + 1);
//get point by idx
double* p_data = temp_points->GetPoint(idx);
//change z value of the point
p_data[2] *= 2;
}
renWindow->Render();
///////////////////////////////////////////////////