[vtkusers] deepcopy and shallowcopy

alethea alethea at anatomage.com
Fri Aug 23 12:37:29 EDT 2013


First, DeepCopy will copy all layers of data, whereas ShallowCopy will copy
less data.

Here's a simple example of using DeepCopy in C++, where triangleFilter at
the end of some data pipeline.

vtkPolyData* UseDeepCopy(vtkTriangleFilter* triangleFilter)
{
  triangleFilter->Update(); // this needs to be called to actually build the
data structure returned in  GetOutput()

  vtkPolyData* polyData = vtkPolyData::New(); // You must create this
object, or it can't be used in DeepCopy

  polyData->DeepCopy(triangleFilter->GetOutput()); // Copy the triangulated
data over to polyData

  // Note, you could delete triangleFilter now, because the data's been
copied, though that should really be done outside of this function.

  return polyData;
}


david

david bahn wrote
> Hi All,
>          i have a question about the application of deepcopy and
> shallowcopy functions in polydata, how does these two functions works,
> anybody can give me an example to understand the applications of these two
> functions in an example?
> 
> 
> david





--
View this message in context: http://vtk.1045678.n5.nabble.com/deepcopy-and-shallowcopy-tp5722999p5723000.html
Sent from the VTK - Users mailing list archive at Nabble.com.



More information about the vtkusers mailing list