I have the following c++ code:
vtkNew _surf;
_surf->ShallowCopy(surf);
vtkIdType cellId = Get_ClosestCellId(_surf, seedxyz);
_surf->DeleteCell(cellId);
_surf->RemoveDeletedCells();
After creating _surf, we specify it as a ShallowCopy of surf then remove the cell closest to the seedxyz by calling _surf->DeleteCell
I thought that if I ShallowCopy like this, since _surf and surf share the same pointer, the modifications made to _surf would also be reflected in surf.
However, if you output the two in vtp format, _surf is modified but surf does not show the changes. Why is this?
I've made this very simple example.
The output is:
The idea is that the shallow copy uses the the same backing data,
pos, so changes inposare reflected in both copies. Both objects have their own pointer toposso when youb->pos = otherit isn't reflected insurfSince the object
surfis a vtkPolyData we can hunt down the ShallowCopy docs vtkObject ShallowCopy.Both vtkObjects have a list of CellId's, adding or removing cell id's will not be reflected in the other class. Changing the cells themselves would be reflected.