The PointSet is using a std::map to save the points. But the developer can also access the number of saved points. So often something like
for (int i=0; i<pointSet->GetSize();++i)
{
// Do something with pointSet-GetPoint(i)
}
is done. This will lead to wrong results if a point has been deleted or the pointset has not initialized starting from zero. For example:
mitk::PointSet::Pointer pointSet = mitk::PointSet::New(); mitk::Point3D pointA, pointB, pointC; pointA.Fill(1); pointB.Fill(2); pointC.Fill(3); pointSet->SetPoint(1,pointA); pointSet->SetPoint(2,pointB); pointSet->SetPoint(3,pointC);