FEM: Handle unknown exception when applying a constraint to a B-Spline surface

Fixes #13213

An OCC exception is raised when trying to normalize a null vector. The solution is to check the square length before normalizing it
This commit is contained in:
wmayer
2024-04-01 19:35:16 +02:00
committed by wwmayer
parent 6ca35709dd
commit 4b18a1018b

View File

@@ -430,7 +430,9 @@ bool Constraint::getPoints(std::vector<Base::Vector3d>& points,
if (classifier.State() != TopAbs_OUT) {
points.emplace_back(p.X(), p.Y(), p.Z());
props.Normal(u, v, center, normal);
normal.Normalize();
if (normal.SquareMagnitude() > 0.0) {
normal.Normalize();
}
normals.emplace_back(normal.X(), normal.Y(), normal.Z());
}
};