Previously, when the mesh passed to PlaneSlicerRasterPlanner::planImpl is coplanar:
The third element of scales is zero.
Which means that the third column of pca_vecs is zero, and so cannot be normalised.
Which means that cut_normal is zero, rather than a unit vector.
This causes the planImpl method to return an empty ToolPaths, which promptly crashes the modifier it is passed in to.
This PR replaces pca_vecs.col(2).normalized(), i.e. (pca.getEigenVectors().col(2) * scale.z()).normalized() with mesh_normal, i.e. pca.getEigenVectors().col(2).normalized(), which should have the same value as before when scale.z() is not zero, but which should be a valid unit vector when scale.z() is zero.
Previously, when the
mesh
passed toPlaneSlicerRasterPlanner::planImpl
is coplanar:scales
is zero.pca_vecs
is zero, and so cannot be normalised.cut_normal
is zero, rather than a unit vector.This causes the
planImpl
method to return an emptyToolPaths
, which promptly crashes the modifier it is passed in to.This PR replaces
pca_vecs.col(2).normalized()
, i.e.(pca.getEigenVectors().col(2) * scale.z()).normalized()
withmesh_normal
, i.e.pca.getEigenVectors().col(2).normalized()
, which should have the same value as before whenscale.z()
is not zero, but which should be a valid unit vector whenscale.z()
is zero.