Sketcher: Add second arc helper on diameter constraint (#22579)

* add second arc helper on diameter constraint

* fix linter warnings

---------

Co-authored-by: Matthias Danner <28687794+matthiasdanner@users.noreply.github.com>
This commit is contained in:
matthiasdanner
2025-07-20 19:46:49 +02:00
committed by GitHub
parent fd14f657e6
commit d3887d09a4
3 changed files with 35 additions and 45 deletions

View File

@@ -1457,8 +1457,10 @@ Restart:
assert(Constr->First >= -extGeoCount && Constr->First < intGeoCount);
Base::Vector3d pnt1(0., 0., 0.), pnt2(0., 0., 0.);
double helperStartAngle = 0.;
double helperRange = 0.;
double startHelperAngle = 0.;
double startHelperRange = 0.;
double endHelperAngle = 0.;
double endHelperRange = 0.;
if (Constr->First == GeoEnum::GeoUndef) {
break;
@@ -1477,12 +1479,18 @@ Restart:
angle = (startAngle + endAngle) / 2;
}
findHelperAngles(helperStartAngle,
helperRange,
findHelperAngles(startHelperAngle,
startHelperRange,
angle,
startAngle,
endAngle);
findHelperAngles(endHelperAngle,
endHelperRange,
angle + pi,
startAngle,
endAngle);
Base::Vector3d center = arc->getCenter();
pnt1 = center - radius * Base::Vector3d(cos(angle), sin(angle), 0.);
pnt2 = center + radius * Base::Vector3d(cos(angle), sin(angle), 0.);
@@ -1515,8 +1523,10 @@ Restart:
asciiText->datumtype = SoDatumLabel::DIAMETER;
asciiText->param1 = Constr->LabelDistance;
asciiText->param2 = Constr->LabelPosition;
asciiText->param3 = helperStartAngle;
asciiText->param4 = helperRange;
asciiText->param3 = static_cast<float>(startHelperAngle);
asciiText->param4 = static_cast<float>(startHelperRange);
asciiText->param5 = static_cast<float>(endHelperAngle);
asciiText->param6 = static_cast<float>(endHelperRange);
asciiText->pnts.setNum(2);
SbVec3f* verts = asciiText->pnts.startEditing();

View File

@@ -253,7 +253,7 @@ private:
/// Find helper angle for radius/diameter constraint
void findHelperAngles(double& helperStartAngle,
double& helperAngle,
double& helperRange,
double angle,
double startAngle,
double endAngle);