[Sketcher] Expose general tangency with B-splines to Sketcher

The following commits were squashed into this

[Sketcher] Handle some corner cases in AngleViaPoint

[Sketcher] Avoid redundant constraints with B-splines...

When involving tangent, perpendicular and angle constraints.

[Sketcher] Add pre-commit changes

[Sketcher] Do not allow 2-selection tangent with B-spline

Also...

[Sketcher] Report error when using direct tangency with B-splines

[Sketcher] Fix malformed constraint when B-spline is selected second

To clarify, this means the second curve selected. The position of the point in
selection order does not matter in angle-via-point.

[Sketcher] Fix wrong number for B-Spline tangent on redundancy

[Sketcher] Remove existing point-on-object in some redundant cases

Particularly when point constrained on a B-spline is being used for
tangent, perpendicular or angle via point with the same B-spline.

[Sketcher] Fix direction issue with B-spline tangents.

Without these changes the solver might try to "twist" the B-spline to make the
angle between curves be 0 instead of PI (which may be closer to the initial shape).
This commit is contained in:
Ajinkya Dahale
2023-04-05 23:11:28 +05:30
parent 82f03593fd
commit 65b4dd10ae
7 changed files with 611 additions and 304 deletions

View File

@@ -774,6 +774,36 @@ int System::addConstraintAngleViaPoint(Curve& crv1,
return addConstraint(constr);
}
int System::addConstraintAngleViaPointAndParam(Curve& crv1,
Curve& crv2,
Point& p,
double* cparam,
double* angle,
int tagId,
bool driving)
{
Constraint* constr = new ConstraintAngleViaPointAndParam(crv1, crv2, p, cparam, angle);
constr->setTag(tagId);
constr->setDriving(driving);
return addConstraint(constr);
}
int System::addConstraintAngleViaPointAndTwoParams(Curve& crv1,
Curve& crv2,
Point& p,
double* cparam1,
double* cparam2,
double* angle,
int tagId,
bool driving)
{
Constraint* constr =
new ConstraintAngleViaPointAndTwoParams(crv1, crv2, p, cparam1, cparam2, angle);
constr->setTag(tagId);
constr->setDriving(driving);
return addConstraint(constr);
}
int System::addConstraintMidpointOnLine(Line& l1, Line& l2, int tagId, bool driving)
{
Constraint* constr = new ConstraintMidpointOnLine(l1, l2);