[Sketcher] Apply tangent autoconstraint only when Dir given

This relates to `seekAutoConstraint` and `seekAndRenderAutoConstraint`.

Fixes #16321.
This commit is contained in:
Ajinkya Dahale
2024-10-03 22:00:22 +05:30
committed by Chris Hennes
parent 142f2aff39
commit 596fa2856b

View File

@@ -511,9 +511,12 @@ int DrawSketchHandler::seekAutoConstraint(std::vector<AutoConstraint>& suggested
constr.Type = Sketcher::Tangent;
}
if (constr.Type == Sketcher::Tangent && Dir.Length() > 1e-8
&& hitShapeDir.Length()
> 1e-8) { // We are hitting a line and have hitting vector information
if (constr.Type == Sketcher::Tangent) {
if (Dir.Length() < 1e-8 || hitShapeDir.Length() < 1e-8) {
// Direction not set so return;
return suggestedConstraints.size();
}
// We are hitting a line and have hitting vector information
Base::Vector3d dir3d = Base::Vector3d(Dir.x, Dir.y, 0);
double cosangle = dir3d.Normalize() * hitShapeDir.Normalize();