'`VTKSurfaceMeshRenderDelegate` doesn't deal with data size changes
Any call that reallocates the underlying datastructure of points
or tris
will cause problems, any call to resize()
or clear()
to imstkDataArray
and imstkVecDataArray
will cause the internal storage reallocated. But in updateGeometry
line 225 the delegate only checks for equality of the wrapping shared pointer, to update its internals. In contrast the vtk data is bound to the internal pointer of the imstkData/VecDataArray
(see GeometryUtils::coupleVtkDataArray) so if the user _doesn't_ set new data in the mesh via
mesh.initializeor
mesh.setVertexPositions` this check will fall through.
The check in line 225 could be made against the underlying structure that might fix some of the problems but i am not sure all cases are covered then. This is probably an issue with other delegates as well
If a structure takes a shared pointer and gives access to that shared pointer (i.e. the mesh taking the point data as a shared_ptr) then the assumption is that modifying this structure will result in the correct behavior of the rest of the system, otherwise the data should be taken by copy or other ways indicating to the user that this data cannot just be modified.