Skip to content

Fix vtkDelaunay2D Best Fitting Plane Mode

When using vtkDelaunay2D with VTK_BEST_FITTING_PLANE a best-fitting plane is calculated to transform the points.

The computation of the best fitting plane normal was originally taken from vtkTextureMapToPlane according to the comments in vtkDelaunay2D::ComputeBestFittingPlane(). This method works well but fails if the points are located in a perfect XZ or YZ plane. vtkTextureMapToPlane determines this case and provides an alternative normal computation in this case; however this alternative was not copied over to vtkDelaunay2D.

This bug fix uses the missing normal computation from vtkTextureMapToPlane with small adaptation to suit the remainder of the code in vtkDelaunay2D::ComputeBestFittingPlane().

In addition the test TestDelaunay2D.cxx was used as a basis for the new test TestDelaunay2DBestFittingPlane.cxx. The code is nearly the same only the points for the test are located in the XZ plane instead of the XY plane.

Merge request reports