Would it make sense to add to transforms to the filter to allow dynamic updates?
I did it this way
vtkMTimeType spsDistancePolyDataFilter::GetMTime()
{
vtkMTimeType mTime = this->Superclass::GetMTime();
vtkMTimeType time;
// Would only make sense if it had inputs
vtkLinearTransform* transform = this->Transform0;
if (transform)
{
time = transform->GetMTime();
mTime = (time > mTime) ? time : mTime;
}
transform = this->Transform1;
if (transform)
{
time = transform->GetMTime();
mTime = (time > mTime) ? time : mTime;
}
// If any of the input transforms are updated, we update the internal transform
if (mTime > this->Superclass::GetMTime())
{
this->Transform->Update();
}
return mTime;
}
//------------------------------------------------------------------------------
spsDistancePolyDataFilter::spsDistancePolyDataFilter()
{
this->SignedDistance = 1;
this->NegateDistance = 0;
this->ComputeSecondDistance = 1;
this->ComputeCellCenterDistance = 1;
this->ComputeDirection = 0;
this->SetNumberOfInputPorts(2);
this->SetNumberOfOutputPorts(2);
this->Transform = vtkSmartPointer<vtkTransform>::New();
this->Transform0 = vtkSmartPointer<vtkTransform>::New();
this->Transform1 = vtkSmartPointer<vtkTransform>::New();
vtkSmartPointer<vtkTransform> temp = vtkTransform::SafeDownCast(this->Transform0->GetInverse());
this->Transform1->SetInput(temp);
this->Transform->SetInput(this->Transform1);
}
It works nicely. Working on some nasty template specialization of the `vtkImplicitPolyDataDistance` to speed things up in case we have normals and specialize on float or double precision. I'm not so found of how I got things to update correctly when either of the transforms were updated.
What are your thoughts?