In the Visualization Toolkit, what types of objects should be called by Update () and Modified (), and when?

I am looking at some VTK code that may not work correctly. Here is a snippet:

vtkSmartPointer<vtkCamera> cam = vtkSmartPointer<vtkCamera>::New();
cam->SetFocalPoint(0, 0, 0);
cam->SetViewUp(perp[0], perp[1], perp[2]);

cam->SetPosition(first_cam_pos);
cam->SetViewAngle(20);
cam->Modified();

It seems to me that the call is Modified()not needed, so that the call to the four Set functions should automatically signal that the camera has been changed.

In fact, KitKKKK does not use the camera exampleModified() for the camera.

vtkSmartPointer<vtkCamera> camera = vtkSmartPointer<vtkCamera>::New();
camera->SetPosition(0, 0, 20);
camera->SetFocalPoint(0, 0, 0);

// Create a renderer, render window, and interactor
vtkSmartPointer<vtkRenderer> renderer = vtkSmartPointer<vtkRenderer>::New();

renderer->SetActiveCamera(camera);

In other cases, the potentially inoperative VTK code I'm looking for uses Update()for manual updating - not for the camera object, but in another place. Again, I think this is probably not necessary; but clearly Update()and for Modified()some reason .

- , Modified() Update(), ? , , , ? ?

VTK 6.1, , - .

+4
1

() , , . :

vtkSmartPointer<vtkXMLPolyDataReader> reader = \
        vtkSmartPointer<vtkPolyDataReader>::New();

reader->SetFileName("myfile.vtp");

// At this point, the reader hasn't yet read the file, so the
// following line with result in polydata being null (or 
// something like that)

vtkPolyData* badPolydata = reader->GetOutput();

// However, once you tell the reader "update right now, don't wait
// for the pipeline to update you" with:

reader->Update();

// you can now get access to the data it has read:

vtkPolyData* goodPolydata = reader->GetOutput();

, , , , , , ", , ", Update() . / .


() , " , ". Set *, , , , , Modified() , , .

+5
source

Source: https://habr.com/ru/post/1543451/


All Articles