Sketcher.planegcs: don't check for constraint update in solve routine
This commit is contained in:
@@ -52,7 +52,6 @@ Constraint::Constraint()
|
||||
, pvec(0)
|
||||
, scale(1.)
|
||||
, tag(0)
|
||||
, pvecChangedFlag(true)
|
||||
, driving(true)
|
||||
, internalAlignment(Alignment::NoInternalAlignment)
|
||||
{}
|
||||
@@ -66,13 +65,13 @@ void Constraint::redirectParams(const MAP_pD_pD& redirectionmap)
|
||||
pvec[i] = it->second;
|
||||
}
|
||||
}
|
||||
pvecChangedFlag = true;
|
||||
reconstructGeomPointers();
|
||||
}
|
||||
|
||||
void Constraint::revertParams()
|
||||
{
|
||||
pvec = origpvec;
|
||||
pvecChangedFlag = true;
|
||||
reconstructGeomPointers();
|
||||
}
|
||||
|
||||
ConstraintType Constraint::getTypeId()
|
||||
@@ -84,7 +83,8 @@ void Constraint::rescale(double coef)
|
||||
{
|
||||
scale = coef * 1.0;
|
||||
}
|
||||
|
||||
void Constraint::reconstructGeomPointers()
|
||||
{}
|
||||
double Constraint::maxStep(MAP_pD_D& /*dir*/, double lim)
|
||||
{
|
||||
return lim;
|
||||
@@ -1732,16 +1732,15 @@ ConstraintEllipseTangentLine::ConstraintEllipseTangentLine(Line& l, Ellipse& e)
|
||||
this->e.PushOwnParams(pvec); // DeepSOIC: hopefully, this won't push arc's parameters
|
||||
|
||||
origpvec = pvec;
|
||||
pvecChangedFlag = true;
|
||||
reconstructGeomPointers();
|
||||
rescale();
|
||||
}
|
||||
|
||||
void ConstraintEllipseTangentLine::ReconstructGeomPointers()
|
||||
void ConstraintEllipseTangentLine::reconstructGeomPointers()
|
||||
{
|
||||
int i = 0;
|
||||
l.ReconstructOnNewPvec(pvec, i);
|
||||
e.ReconstructOnNewPvec(pvec, i);
|
||||
pvecChangedFlag = false;
|
||||
}
|
||||
|
||||
ConstraintType ConstraintEllipseTangentLine::getTypeId()
|
||||
@@ -1754,9 +1753,6 @@ void ConstraintEllipseTangentLine::errorgrad(double* err, double* grad, double*
|
||||
// DeepSOIC equation
|
||||
// https://forum.freecad.org/viewtopic.php?f=10&t=7520&start=140
|
||||
|
||||
if (pvecChangedFlag) {
|
||||
ReconstructGeomPointers();
|
||||
}
|
||||
DeriVector2 p1(l.p1, param);
|
||||
DeriVector2 p2(l.p2, param);
|
||||
DeriVector2 f1(e.focus1, param);
|
||||
@@ -1802,10 +1798,11 @@ ConstraintInternalAlignmentPoint2Ellipse::ConstraintInternalAlignmentPoint2Ellip
|
||||
pvec.push_back(p.y);
|
||||
this->e.PushOwnParams(pvec);
|
||||
origpvec = pvec;
|
||||
reconstructGeomPointers();
|
||||
rescale();
|
||||
}
|
||||
|
||||
void ConstraintInternalAlignmentPoint2Ellipse::ReconstructGeomPointers()
|
||||
void ConstraintInternalAlignmentPoint2Ellipse::reconstructGeomPointers()
|
||||
{
|
||||
int i = 0;
|
||||
p.x = pvec[i];
|
||||
@@ -1813,7 +1810,6 @@ void ConstraintInternalAlignmentPoint2Ellipse::ReconstructGeomPointers()
|
||||
p.y = pvec[i];
|
||||
i++;
|
||||
e.ReconstructOnNewPvec(pvec, i);
|
||||
pvecChangedFlag = false;
|
||||
}
|
||||
|
||||
ConstraintType ConstraintInternalAlignmentPoint2Ellipse::getTypeId()
|
||||
@@ -1823,10 +1819,6 @@ ConstraintType ConstraintInternalAlignmentPoint2Ellipse::getTypeId()
|
||||
|
||||
void ConstraintInternalAlignmentPoint2Ellipse::errorgrad(double* err, double* grad, double* param)
|
||||
{
|
||||
if (pvecChangedFlag) {
|
||||
ReconstructGeomPointers();
|
||||
}
|
||||
|
||||
// todo: prefill only what's needed, not everything
|
||||
|
||||
DeriVector2 c(e.center, param);
|
||||
@@ -1900,10 +1892,11 @@ ConstraintInternalAlignmentPoint2Hyperbola::ConstraintInternalAlignmentPoint2Hyp
|
||||
pvec.push_back(p.y);
|
||||
this->e.PushOwnParams(pvec);
|
||||
origpvec = pvec;
|
||||
reconstructGeomPointers();
|
||||
rescale();
|
||||
}
|
||||
|
||||
void ConstraintInternalAlignmentPoint2Hyperbola::ReconstructGeomPointers()
|
||||
void ConstraintInternalAlignmentPoint2Hyperbola::reconstructGeomPointers()
|
||||
{
|
||||
int i = 0;
|
||||
p.x = pvec[i];
|
||||
@@ -1911,7 +1904,6 @@ void ConstraintInternalAlignmentPoint2Hyperbola::ReconstructGeomPointers()
|
||||
p.y = pvec[i];
|
||||
i++;
|
||||
e.ReconstructOnNewPvec(pvec, i);
|
||||
pvecChangedFlag = false;
|
||||
}
|
||||
|
||||
ConstraintType ConstraintInternalAlignmentPoint2Hyperbola::getTypeId()
|
||||
@@ -1921,10 +1913,6 @@ ConstraintType ConstraintInternalAlignmentPoint2Hyperbola::getTypeId()
|
||||
|
||||
void ConstraintInternalAlignmentPoint2Hyperbola::errorgrad(double* err, double* grad, double* param)
|
||||
{
|
||||
if (pvecChangedFlag) {
|
||||
ReconstructGeomPointers();
|
||||
}
|
||||
|
||||
// todo: prefill only what's needed, not everything
|
||||
|
||||
DeriVector2 c(e.center, param);
|
||||
@@ -1997,16 +1985,15 @@ ConstraintEqualMajorAxesConic::ConstraintEqualMajorAxesConic(MajorRadiusConic* a
|
||||
this->e1->PushOwnParams(pvec);
|
||||
this->e2->PushOwnParams(pvec);
|
||||
origpvec = pvec;
|
||||
pvecChangedFlag = true;
|
||||
reconstructGeomPointers();
|
||||
rescale();
|
||||
}
|
||||
|
||||
void ConstraintEqualMajorAxesConic::ReconstructGeomPointers()
|
||||
void ConstraintEqualMajorAxesConic::reconstructGeomPointers()
|
||||
{
|
||||
int i = 0;
|
||||
e1->ReconstructOnNewPvec(pvec, i);
|
||||
e2->ReconstructOnNewPvec(pvec, i);
|
||||
pvecChangedFlag = false;
|
||||
}
|
||||
|
||||
ConstraintType ConstraintEqualMajorAxesConic::getTypeId()
|
||||
@@ -2016,9 +2003,6 @@ ConstraintType ConstraintEqualMajorAxesConic::getTypeId()
|
||||
|
||||
void ConstraintEqualMajorAxesConic::errorgrad(double* err, double* grad, double* param)
|
||||
{
|
||||
if (pvecChangedFlag) {
|
||||
ReconstructGeomPointers();
|
||||
}
|
||||
double a1, da1;
|
||||
a1 = e1->getRadMaj(param, da1);
|
||||
double a2, da2;
|
||||
@@ -2039,16 +2023,15 @@ ConstraintEqualFocalDistance::ConstraintEqualFocalDistance(ArcOfParabola* a1, Ar
|
||||
this->e2 = a2;
|
||||
this->e2->PushOwnParams(pvec);
|
||||
origpvec = pvec;
|
||||
pvecChangedFlag = true;
|
||||
reconstructGeomPointers();
|
||||
rescale();
|
||||
}
|
||||
|
||||
void ConstraintEqualFocalDistance::ReconstructGeomPointers()
|
||||
void ConstraintEqualFocalDistance::reconstructGeomPointers()
|
||||
{
|
||||
int i = 0;
|
||||
e1->ReconstructOnNewPvec(pvec, i);
|
||||
e2->ReconstructOnNewPvec(pvec, i);
|
||||
pvecChangedFlag = false;
|
||||
}
|
||||
|
||||
ConstraintType ConstraintEqualFocalDistance::getTypeId()
|
||||
@@ -2058,10 +2041,6 @@ ConstraintType ConstraintEqualFocalDistance::getTypeId()
|
||||
|
||||
void ConstraintEqualFocalDistance::errorgrad(double* err, double* grad, double* param)
|
||||
{
|
||||
if (pvecChangedFlag) {
|
||||
ReconstructGeomPointers();
|
||||
}
|
||||
|
||||
DeriVector2 focus1(this->e1->focus1, param);
|
||||
DeriVector2 vertex1(this->e1->vertex, param);
|
||||
|
||||
@@ -2099,7 +2078,7 @@ ConstraintCurveValue::ConstraintCurveValue(Point& p, double* pcoord, Curve& c, d
|
||||
pvec.push_back(pcoord);
|
||||
pvec.push_back(u);
|
||||
crv->PushOwnParams(pvec);
|
||||
pvecChangedFlag = true;
|
||||
reconstructGeomPointers();
|
||||
origpvec = pvec;
|
||||
rescale();
|
||||
}
|
||||
@@ -2110,7 +2089,7 @@ ConstraintCurveValue::~ConstraintCurveValue()
|
||||
this->crv = nullptr;
|
||||
}
|
||||
|
||||
void ConstraintCurveValue::ReconstructGeomPointers()
|
||||
void ConstraintCurveValue::reconstructGeomPointers()
|
||||
{
|
||||
int i = 0;
|
||||
p.x = pvec[i];
|
||||
@@ -2120,7 +2099,6 @@ void ConstraintCurveValue::ReconstructGeomPointers()
|
||||
i++; // we have an inline function for point coordinate
|
||||
i++; // we have an inline function for the parameterU
|
||||
this->crv->ReconstructOnNewPvec(pvec, i);
|
||||
pvecChangedFlag = false;
|
||||
}
|
||||
|
||||
ConstraintType ConstraintCurveValue::getTypeId()
|
||||
@@ -2130,10 +2108,6 @@ ConstraintType ConstraintCurveValue::getTypeId()
|
||||
|
||||
void ConstraintCurveValue::errorgrad(double* err, double* grad, double* param)
|
||||
{
|
||||
if (pvecChangedFlag) {
|
||||
ReconstructGeomPointers();
|
||||
}
|
||||
|
||||
double u, du;
|
||||
u = *(this->u());
|
||||
du = (param == this->u()) ? 1.0 : 0.0;
|
||||
@@ -2296,7 +2270,7 @@ ConstraintPointOnParabola::ConstraintPointOnParabola(Point& p, Parabola& e)
|
||||
pvec.push_back(p.x);
|
||||
pvec.push_back(p.y);
|
||||
parab->PushOwnParams(pvec);
|
||||
pvecChangedFlag = true;
|
||||
reconstructGeomPointers();
|
||||
origpvec = pvec;
|
||||
rescale();
|
||||
}
|
||||
@@ -2307,8 +2281,8 @@ ConstraintPointOnParabola::ConstraintPointOnParabola(Point& p, ArcOfParabola& e)
|
||||
pvec.push_back(p.x);
|
||||
pvec.push_back(p.y);
|
||||
parab->PushOwnParams(pvec);
|
||||
pvecChangedFlag = true;
|
||||
origpvec = pvec;
|
||||
reconstructGeomPointers();
|
||||
rescale();
|
||||
}
|
||||
|
||||
@@ -2318,7 +2292,7 @@ ConstraintPointOnParabola::~ConstraintPointOnParabola()
|
||||
this->parab = nullptr;
|
||||
}
|
||||
|
||||
void ConstraintPointOnParabola::ReconstructGeomPointers()
|
||||
void ConstraintPointOnParabola::reconstructGeomPointers()
|
||||
{
|
||||
int i = 0;
|
||||
p.x = pvec[i];
|
||||
@@ -2326,7 +2300,6 @@ void ConstraintPointOnParabola::ReconstructGeomPointers()
|
||||
p.y = pvec[i];
|
||||
i++;
|
||||
this->parab->ReconstructOnNewPvec(pvec, i);
|
||||
pvecChangedFlag = false;
|
||||
}
|
||||
|
||||
ConstraintType ConstraintPointOnParabola::getTypeId()
|
||||
@@ -2336,10 +2309,6 @@ ConstraintType ConstraintPointOnParabola::getTypeId()
|
||||
|
||||
void ConstraintPointOnParabola::errorgrad(double* err, double* grad, double* param)
|
||||
{
|
||||
if (pvecChangedFlag) {
|
||||
ReconstructGeomPointers();
|
||||
}
|
||||
|
||||
DeriVector2 focus(this->parab->focus1, param);
|
||||
DeriVector2 vertex(this->parab->vertex, param);
|
||||
|
||||
@@ -2384,7 +2353,7 @@ ConstraintAngleViaPoint::ConstraintAngleViaPoint(Curve& acrv1, Curve& acrv2, Poi
|
||||
crv1->PushOwnParams(pvec);
|
||||
crv2->PushOwnParams(pvec);
|
||||
origpvec = pvec;
|
||||
pvecChangedFlag = true;
|
||||
reconstructGeomPointers();
|
||||
rescale();
|
||||
}
|
||||
|
||||
@@ -2396,7 +2365,7 @@ ConstraintAngleViaPoint::~ConstraintAngleViaPoint()
|
||||
crv2 = nullptr;
|
||||
}
|
||||
|
||||
void ConstraintAngleViaPoint::ReconstructGeomPointers()
|
||||
void ConstraintAngleViaPoint::reconstructGeomPointers()
|
||||
{
|
||||
int cnt = 0;
|
||||
cnt++; // skip angle - we have an inline function for that
|
||||
@@ -2406,7 +2375,6 @@ void ConstraintAngleViaPoint::ReconstructGeomPointers()
|
||||
cnt++;
|
||||
crv1->ReconstructOnNewPvec(pvec, cnt);
|
||||
crv2->ReconstructOnNewPvec(pvec, cnt);
|
||||
pvecChangedFlag = false;
|
||||
}
|
||||
|
||||
ConstraintType ConstraintAngleViaPoint::getTypeId()
|
||||
@@ -2416,9 +2384,6 @@ ConstraintType ConstraintAngleViaPoint::getTypeId()
|
||||
|
||||
double ConstraintAngleViaPoint::error()
|
||||
{
|
||||
if (pvecChangedFlag) {
|
||||
ReconstructGeomPointers();
|
||||
}
|
||||
double ang = *angle();
|
||||
DeriVector2 n1 = crv1->CalculateNormal(poa);
|
||||
DeriVector2 n2 = crv2->CalculateNormal(poa);
|
||||
@@ -2444,10 +2409,6 @@ double ConstraintAngleViaPoint::grad(double* param)
|
||||
|
||||
double deriv = 0.;
|
||||
|
||||
if (pvecChangedFlag) {
|
||||
ReconstructGeomPointers();
|
||||
}
|
||||
|
||||
if (param == angle()) {
|
||||
deriv += -1.0;
|
||||
}
|
||||
@@ -2479,7 +2440,7 @@ ConstraintAngleViaTwoPoints::ConstraintAngleViaTwoPoints(
|
||||
crv1->PushOwnParams(pvec);
|
||||
crv2->PushOwnParams(pvec);
|
||||
origpvec = pvec;
|
||||
pvecChangedFlag = true;
|
||||
reconstructGeomPointers();
|
||||
rescale();
|
||||
}
|
||||
|
||||
@@ -2491,7 +2452,7 @@ ConstraintAngleViaTwoPoints::~ConstraintAngleViaTwoPoints()
|
||||
crv2 = nullptr;
|
||||
}
|
||||
|
||||
void ConstraintAngleViaTwoPoints::ReconstructGeomPointers()
|
||||
void ConstraintAngleViaTwoPoints::reconstructGeomPointers()
|
||||
{
|
||||
int cnt = 0;
|
||||
cnt++; // skip angle - we have an inline function for that
|
||||
@@ -2505,7 +2466,6 @@ void ConstraintAngleViaTwoPoints::ReconstructGeomPointers()
|
||||
cnt++;
|
||||
crv1->ReconstructOnNewPvec(pvec, cnt);
|
||||
crv2->ReconstructOnNewPvec(pvec, cnt);
|
||||
pvecChangedFlag = false;
|
||||
}
|
||||
|
||||
ConstraintType ConstraintAngleViaTwoPoints::getTypeId()
|
||||
@@ -2515,9 +2475,6 @@ ConstraintType ConstraintAngleViaTwoPoints::getTypeId()
|
||||
|
||||
double ConstraintAngleViaTwoPoints::error()
|
||||
{
|
||||
if (pvecChangedFlag) {
|
||||
ReconstructGeomPointers();
|
||||
}
|
||||
double ang = *angle();
|
||||
DeriVector2 n1 = crv1->CalculateNormal(poa1);
|
||||
DeriVector2 n2 = crv2->CalculateNormal(poa2);
|
||||
@@ -2543,10 +2500,6 @@ double ConstraintAngleViaTwoPoints::grad(double* param)
|
||||
|
||||
double deriv = 0.;
|
||||
|
||||
if (pvecChangedFlag) {
|
||||
ReconstructGeomPointers();
|
||||
}
|
||||
|
||||
if (param == angle()) {
|
||||
deriv += -1.0;
|
||||
}
|
||||
@@ -2584,7 +2537,7 @@ ConstraintAngleViaPointAndParam::ConstraintAngleViaPointAndParam(
|
||||
crv1->PushOwnParams(pvec);
|
||||
crv2->PushOwnParams(pvec);
|
||||
origpvec = pvec;
|
||||
pvecChangedFlag = true;
|
||||
reconstructGeomPointers();
|
||||
rescale();
|
||||
}
|
||||
|
||||
@@ -2596,7 +2549,7 @@ ConstraintAngleViaPointAndParam::~ConstraintAngleViaPointAndParam()
|
||||
crv2 = nullptr;
|
||||
}
|
||||
|
||||
void ConstraintAngleViaPointAndParam::ReconstructGeomPointers()
|
||||
void ConstraintAngleViaPointAndParam::reconstructGeomPointers()
|
||||
{
|
||||
int cnt = 0;
|
||||
cnt++; // skip angle - we have an inline function for that
|
||||
@@ -2607,7 +2560,6 @@ void ConstraintAngleViaPointAndParam::ReconstructGeomPointers()
|
||||
cnt++; // skip cparam
|
||||
crv1->ReconstructOnNewPvec(pvec, cnt);
|
||||
crv2->ReconstructOnNewPvec(pvec, cnt);
|
||||
pvecChangedFlag = false;
|
||||
}
|
||||
|
||||
ConstraintType ConstraintAngleViaPointAndParam::getTypeId()
|
||||
@@ -2617,9 +2569,6 @@ ConstraintType ConstraintAngleViaPointAndParam::getTypeId()
|
||||
|
||||
double ConstraintAngleViaPointAndParam::error()
|
||||
{
|
||||
if (pvecChangedFlag) {
|
||||
ReconstructGeomPointers();
|
||||
}
|
||||
double ang = *angle();
|
||||
DeriVector2 n1 = crv1->CalculateNormal(cparam());
|
||||
DeriVector2 n2 = crv2->CalculateNormal(poa);
|
||||
@@ -2645,10 +2594,6 @@ double ConstraintAngleViaPointAndParam::grad(double* param)
|
||||
|
||||
double deriv = 0.;
|
||||
|
||||
if (pvecChangedFlag) {
|
||||
ReconstructGeomPointers();
|
||||
}
|
||||
|
||||
if (param == angle()) {
|
||||
deriv += -1.0;
|
||||
}
|
||||
@@ -2689,7 +2634,7 @@ ConstraintAngleViaPointAndTwoParams::ConstraintAngleViaPointAndTwoParams(
|
||||
crv1->PushOwnParams(pvec);
|
||||
crv2->PushOwnParams(pvec);
|
||||
origpvec = pvec;
|
||||
pvecChangedFlag = true;
|
||||
reconstructGeomPointers();
|
||||
rescale();
|
||||
}
|
||||
|
||||
@@ -2701,7 +2646,7 @@ ConstraintAngleViaPointAndTwoParams::~ConstraintAngleViaPointAndTwoParams()
|
||||
crv2 = nullptr;
|
||||
}
|
||||
|
||||
void ConstraintAngleViaPointAndTwoParams::ReconstructGeomPointers()
|
||||
void ConstraintAngleViaPointAndTwoParams::reconstructGeomPointers()
|
||||
{
|
||||
int cnt = 0;
|
||||
cnt++; // skip angle - we have an inline function for that
|
||||
@@ -2713,7 +2658,6 @@ void ConstraintAngleViaPointAndTwoParams::ReconstructGeomPointers()
|
||||
cnt++; // skip cparam2 - we have an inline function for that
|
||||
crv1->ReconstructOnNewPvec(pvec, cnt);
|
||||
crv2->ReconstructOnNewPvec(pvec, cnt);
|
||||
pvecChangedFlag = false;
|
||||
}
|
||||
|
||||
ConstraintType ConstraintAngleViaPointAndTwoParams::getTypeId()
|
||||
@@ -2723,9 +2667,6 @@ ConstraintType ConstraintAngleViaPointAndTwoParams::getTypeId()
|
||||
|
||||
double ConstraintAngleViaPointAndTwoParams::error()
|
||||
{
|
||||
if (pvecChangedFlag) {
|
||||
ReconstructGeomPointers();
|
||||
}
|
||||
double ang = *angle();
|
||||
DeriVector2 n1 = crv1->CalculateNormal(cparam1());
|
||||
DeriVector2 n2 = crv2->CalculateNormal(cparam2());
|
||||
@@ -2751,10 +2692,6 @@ double ConstraintAngleViaPointAndTwoParams::grad(double* param)
|
||||
|
||||
double deriv = 0.;
|
||||
|
||||
if (pvecChangedFlag) {
|
||||
ReconstructGeomPointers();
|
||||
}
|
||||
|
||||
if (param == angle()) {
|
||||
deriv += -1.0;
|
||||
}
|
||||
@@ -2800,8 +2737,7 @@ ConstraintSnell::ConstraintSnell(
|
||||
ray2->PushOwnParams(pvec);
|
||||
boundary->PushOwnParams(pvec);
|
||||
origpvec = pvec;
|
||||
pvecChangedFlag = true;
|
||||
|
||||
reconstructGeomPointers();
|
||||
rescale();
|
||||
}
|
||||
|
||||
@@ -2815,7 +2751,7 @@ ConstraintSnell::~ConstraintSnell()
|
||||
boundary = nullptr;
|
||||
}
|
||||
|
||||
void ConstraintSnell::ReconstructGeomPointers()
|
||||
void ConstraintSnell::reconstructGeomPointers()
|
||||
{
|
||||
int cnt = 0;
|
||||
cnt++;
|
||||
@@ -2827,7 +2763,6 @@ void ConstraintSnell::ReconstructGeomPointers()
|
||||
ray1->ReconstructOnNewPvec(pvec, cnt);
|
||||
ray2->ReconstructOnNewPvec(pvec, cnt);
|
||||
boundary->ReconstructOnNewPvec(pvec, cnt);
|
||||
pvecChangedFlag = false;
|
||||
}
|
||||
|
||||
ConstraintType ConstraintSnell::getTypeId()
|
||||
@@ -2838,9 +2773,6 @@ ConstraintType ConstraintSnell::getTypeId()
|
||||
// error and gradient combined. Values are returned through pointers.
|
||||
void ConstraintSnell::errorgrad(double* err, double* grad, double* param)
|
||||
{
|
||||
if (pvecChangedFlag) {
|
||||
ReconstructGeomPointers();
|
||||
}
|
||||
DeriVector2 tang1 = ray1->CalculateNormal(poa, param).rotate90cw().getNormalized();
|
||||
DeriVector2 tang2 = ray2->CalculateNormal(poa, param).rotate90cw().getNormalized();
|
||||
DeriVector2 tangB = boundary->CalculateNormal(poa, param).rotate90cw().getNormalized();
|
||||
@@ -2876,16 +2808,15 @@ ConstraintEqualLineLength::ConstraintEqualLineLength(Line& l1, Line& l2)
|
||||
this->l1.PushOwnParams(pvec);
|
||||
this->l2.PushOwnParams(pvec);
|
||||
origpvec = pvec;
|
||||
pvecChangedFlag = true;
|
||||
reconstructGeomPointers();
|
||||
rescale();
|
||||
}
|
||||
|
||||
void ConstraintEqualLineLength::ReconstructGeomPointers()
|
||||
void ConstraintEqualLineLength::reconstructGeomPointers()
|
||||
{
|
||||
int i = 0;
|
||||
l1.ReconstructOnNewPvec(pvec, i);
|
||||
l2.ReconstructOnNewPvec(pvec, i);
|
||||
pvecChangedFlag = false;
|
||||
}
|
||||
|
||||
ConstraintType ConstraintEqualLineLength::getTypeId()
|
||||
@@ -2895,10 +2826,6 @@ ConstraintType ConstraintEqualLineLength::getTypeId()
|
||||
|
||||
void ConstraintEqualLineLength::errorgrad(double* err, double* grad, double* param)
|
||||
{
|
||||
if (pvecChangedFlag) {
|
||||
ReconstructGeomPointers();
|
||||
}
|
||||
|
||||
DeriVector2 p1(l1.p1, param);
|
||||
DeriVector2 p2(l1.p2, param);
|
||||
DeriVector2 p3(l2.p1, param);
|
||||
@@ -2967,17 +2894,16 @@ ConstraintC2CDistance::ConstraintC2CDistance(Circle& c1, Circle& c2, double* d)
|
||||
this->c2.PushOwnParams(pvec);
|
||||
|
||||
origpvec = pvec;
|
||||
pvecChangedFlag = true;
|
||||
reconstructGeomPointers();
|
||||
rescale();
|
||||
}
|
||||
|
||||
void ConstraintC2CDistance::ReconstructGeomPointers()
|
||||
void ConstraintC2CDistance::reconstructGeomPointers()
|
||||
{
|
||||
int i = 0;
|
||||
i++; // skip the first parameter as there is the inline function distance for it
|
||||
c1.ReconstructOnNewPvec(pvec, i);
|
||||
c2.ReconstructOnNewPvec(pvec, i);
|
||||
pvecChangedFlag = false;
|
||||
}
|
||||
|
||||
ConstraintType ConstraintC2CDistance::getTypeId()
|
||||
@@ -2987,10 +2913,6 @@ ConstraintType ConstraintC2CDistance::getTypeId()
|
||||
|
||||
void ConstraintC2CDistance::errorgrad(double* err, double* grad, double* param)
|
||||
{
|
||||
if (pvecChangedFlag) {
|
||||
ReconstructGeomPointers();
|
||||
}
|
||||
|
||||
DeriVector2 ct1(c1.center, param);
|
||||
DeriVector2 ct2(c2.center, param);
|
||||
|
||||
@@ -3067,7 +2989,7 @@ ConstraintC2LDistance::ConstraintC2LDistance(Circle& c, Line& l, double* d)
|
||||
this->line.PushOwnParams(pvec);
|
||||
|
||||
origpvec = pvec;
|
||||
pvecChangedFlag = true;
|
||||
reconstructGeomPointers();
|
||||
rescale();
|
||||
}
|
||||
|
||||
@@ -3076,13 +2998,12 @@ ConstraintType ConstraintC2LDistance::getTypeId()
|
||||
return C2LDistance;
|
||||
}
|
||||
|
||||
void ConstraintC2LDistance::ReconstructGeomPointers()
|
||||
void ConstraintC2LDistance::reconstructGeomPointers()
|
||||
{
|
||||
int i = 0;
|
||||
i++; // skip the first parameter as there is the inline function distance for it
|
||||
circle.ReconstructOnNewPvec(pvec, i);
|
||||
line.ReconstructOnNewPvec(pvec, i);
|
||||
pvecChangedFlag = false;
|
||||
}
|
||||
|
||||
double ConstraintC2LDistance::value(double& deriValue, double* param)
|
||||
@@ -3120,10 +3041,6 @@ double ConstraintC2LDistance::value(double& deriValue, double* param)
|
||||
}
|
||||
void ConstraintC2LDistance::errorgrad(double* err, double* grad, double* param)
|
||||
{
|
||||
if (pvecChangedFlag) {
|
||||
ReconstructGeomPointers();
|
||||
}
|
||||
|
||||
double h, dh;
|
||||
h = value(dh, param);
|
||||
|
||||
@@ -3173,7 +3090,7 @@ ConstraintP2CDistance::ConstraintP2CDistance(Point& p, Circle& c, double* d)
|
||||
this->pt.PushOwnParams(pvec);
|
||||
|
||||
origpvec = pvec;
|
||||
pvecChangedFlag = true;
|
||||
reconstructGeomPointers();
|
||||
rescale();
|
||||
}
|
||||
|
||||
@@ -3182,13 +3099,12 @@ ConstraintType ConstraintP2CDistance::getTypeId()
|
||||
return P2CDistance;
|
||||
}
|
||||
|
||||
void ConstraintP2CDistance::ReconstructGeomPointers()
|
||||
void ConstraintP2CDistance::reconstructGeomPointers()
|
||||
{
|
||||
int i = 0;
|
||||
i++; // skip the first parameter as there is the inline function distance for it
|
||||
circle.ReconstructOnNewPvec(pvec, i);
|
||||
pt.ReconstructOnNewPvec(pvec, i);
|
||||
pvecChangedFlag = false;
|
||||
}
|
||||
|
||||
double ConstraintP2CDistance::value(double& deriValue, double* param)
|
||||
@@ -3201,10 +3117,6 @@ double ConstraintP2CDistance::value(double& deriValue, double* param)
|
||||
}
|
||||
void ConstraintP2CDistance::errorgrad(double* err, double* grad, double* param)
|
||||
{
|
||||
if (pvecChangedFlag) {
|
||||
ReconstructGeomPointers();
|
||||
}
|
||||
|
||||
double length, dlength;
|
||||
length = value(dlength, param);
|
||||
|
||||
@@ -3246,16 +3158,15 @@ ConstraintArcLength::ConstraintArcLength(Arc& a, double* d)
|
||||
this->arc.PushOwnParams(pvec);
|
||||
|
||||
origpvec = pvec;
|
||||
pvecChangedFlag = true;
|
||||
reconstructGeomPointers();
|
||||
rescale();
|
||||
}
|
||||
|
||||
void ConstraintArcLength::ReconstructGeomPointers()
|
||||
void ConstraintArcLength::reconstructGeomPointers()
|
||||
{
|
||||
int i = 0;
|
||||
i++; // skip the first parameter as there is the inline function distance for it
|
||||
arc.ReconstructOnNewPvec(pvec, i);
|
||||
pvecChangedFlag = false;
|
||||
}
|
||||
|
||||
ConstraintType ConstraintArcLength::getTypeId()
|
||||
@@ -3278,10 +3189,6 @@ void ConstraintArcLength::normalizedAngles(double& start, double& end) const
|
||||
}
|
||||
void ConstraintArcLength::errorgrad(double* err, double* grad, double* param)
|
||||
{
|
||||
if (pvecChangedFlag) {
|
||||
ReconstructGeomPointers();
|
||||
}
|
||||
|
||||
double rad = *arc.rad;
|
||||
double startA, endA;
|
||||
normalizedAngles(startA, endA);
|
||||
|
||||
@@ -125,7 +125,6 @@ public:
|
||||
int tag;
|
||||
// indicates that pvec has changed and saved pointers must be reconstructed (currently used only
|
||||
// in AngleViaPoint)
|
||||
bool pvecChangedFlag;
|
||||
bool driving;
|
||||
Alignment internalAlignment;
|
||||
|
||||
@@ -171,6 +170,7 @@ public:
|
||||
|
||||
virtual ConstraintType getTypeId();
|
||||
virtual void rescale(double coef = 1.);
|
||||
virtual void reconstructGeomPointers();
|
||||
|
||||
// error and gradient combined. Values are returned through pointers.
|
||||
virtual void errorgrad(double* err, double* grad, double* param)
|
||||
@@ -928,7 +928,7 @@ private:
|
||||
Line l;
|
||||
Ellipse e;
|
||||
// writes pointers in pvec to the parameters of crv1, crv2 and poa
|
||||
void ReconstructGeomPointers();
|
||||
void reconstructGeomPointers() override;
|
||||
void errorgrad(double* err, double* grad, double* param) override;
|
||||
|
||||
public:
|
||||
@@ -945,7 +945,7 @@ public:
|
||||
private:
|
||||
void errorgrad(double* err, double* grad, double* param) override;
|
||||
// writes pointers in pvec to the parameters of crv1, crv2 and poa
|
||||
void ReconstructGeomPointers();
|
||||
void reconstructGeomPointers() override;
|
||||
Ellipse e;
|
||||
Point p;
|
||||
InternalAlignmentType AlignmentType;
|
||||
@@ -964,7 +964,7 @@ public:
|
||||
private:
|
||||
void errorgrad(double* err, double* grad, double* param) override;
|
||||
// writes pointers in pvec to the parameters of crv1, crv2 and poa
|
||||
void ReconstructGeomPointers();
|
||||
void reconstructGeomPointers() override;
|
||||
Hyperbola e;
|
||||
Point p;
|
||||
InternalAlignmentType AlignmentType;
|
||||
@@ -976,7 +976,7 @@ private:
|
||||
MajorRadiusConic* e1;
|
||||
MajorRadiusConic* e2;
|
||||
// writes pointers in pvec to the parameters of crv1, crv2 and poa
|
||||
void ReconstructGeomPointers();
|
||||
void reconstructGeomPointers() override;
|
||||
void errorgrad(double* err, double* grad, double* param) override;
|
||||
|
||||
public:
|
||||
@@ -990,7 +990,7 @@ private:
|
||||
ArcOfParabola* e1;
|
||||
ArcOfParabola* e2;
|
||||
// writes pointers in pvec to the parameters of crv1, crv2 and poa
|
||||
void ReconstructGeomPointers();
|
||||
void reconstructGeomPointers() override;
|
||||
void errorgrad(double* err, double* grad, double* param) override;
|
||||
|
||||
public:
|
||||
@@ -1012,7 +1012,7 @@ private:
|
||||
}
|
||||
void errorgrad(double* err, double* grad, double* param) override;
|
||||
// writes pointers in pvec to the parameters of crv1, crv2 and poa
|
||||
void ReconstructGeomPointers();
|
||||
void reconstructGeomPointers() override;
|
||||
Curve* crv;
|
||||
Point p;
|
||||
|
||||
@@ -1082,7 +1082,7 @@ class ConstraintPointOnParabola: public Constraint
|
||||
private:
|
||||
void errorgrad(double* err, double* grad, double* param) override;
|
||||
// writes pointers in pvec to the parameters of crv1, crv2 and poa
|
||||
void ReconstructGeomPointers();
|
||||
void reconstructGeomPointers() override;
|
||||
Parabola* parab;
|
||||
Point p;
|
||||
|
||||
@@ -1118,7 +1118,7 @@ private:
|
||||
// easily shallow-copied by C++, so no pointer type here and no delete is necessary.
|
||||
Point poa;
|
||||
// writes pointers in pvec to the parameters of crv1, crv2 and poa
|
||||
void ReconstructGeomPointers();
|
||||
void reconstructGeomPointers() override;
|
||||
|
||||
public:
|
||||
ConstraintAngleViaPoint(Curve& acrv1, Curve& acrv2, Point p, double* angle);
|
||||
@@ -1152,7 +1152,7 @@ private:
|
||||
Point poa1;
|
||||
Point poa2;
|
||||
// writes pointers in pvec to the parameters of crv1, crv2 and poa
|
||||
void ReconstructGeomPointers();
|
||||
void reconstructGeomPointers() override;
|
||||
|
||||
public:
|
||||
ConstraintAngleViaTwoPoints(Curve& acrv1, Curve& acrv2, Point p1, Point p2, double* angle);
|
||||
@@ -1191,7 +1191,7 @@ private:
|
||||
Point poa;
|
||||
bool flipn1, flipn2;
|
||||
// writes pointers in pvec to the parameters of crv1, crv2 and poa
|
||||
void ReconstructGeomPointers();
|
||||
void reconstructGeomPointers() override;
|
||||
void errorgrad(double* err, double* grad, double* param) override;
|
||||
|
||||
public:
|
||||
@@ -1234,7 +1234,8 @@ private:
|
||||
Point poa; // poa=point of angle //needs to be reconstructed if pvec was redirected/reverted.
|
||||
// The point is easily shallow-copied by C++, so no pointer type here and no delete
|
||||
// is necessary.
|
||||
void ReconstructGeomPointers(); // writes pointers in pvec to the parameters of crv1, crv2 and poa
|
||||
void reconstructGeomPointers() override; // writes pointers in pvec to the parameters of crv1,
|
||||
// crv2 and poa
|
||||
public:
|
||||
// We assume first curve needs param1
|
||||
ConstraintAngleViaPointAndParam(Curve& acrv1, Curve& acrv2, Point p, double* param1, double* angle);
|
||||
@@ -1274,7 +1275,8 @@ private:
|
||||
Point poa; // poa=point of angle //needs to be reconstructed if pvec was redirected/reverted.
|
||||
// The point is easily shallow-copied by C++, so no pointer type here and no delete
|
||||
// is necessary.
|
||||
void ReconstructGeomPointers(); // writes pointers in pvec to the parameters of crv1, crv2 and poa
|
||||
void reconstructGeomPointers() override; // writes pointers in pvec to the parameters of crv1,
|
||||
// crv2 and poa
|
||||
public:
|
||||
ConstraintAngleViaPointAndTwoParams(
|
||||
Curve& acrv1,
|
||||
@@ -1297,7 +1299,7 @@ private:
|
||||
Line l1;
|
||||
Line l2;
|
||||
// writes pointers in pvec to the parameters of line1, line2
|
||||
void ReconstructGeomPointers();
|
||||
void reconstructGeomPointers() override;
|
||||
void errorgrad(double* err, double* grad, double* param) override;
|
||||
|
||||
public:
|
||||
@@ -1315,7 +1317,7 @@ private:
|
||||
return pvec[0];
|
||||
}
|
||||
// writes pointers in pvec to the parameters of c1, c2
|
||||
void ReconstructGeomPointers();
|
||||
void reconstructGeomPointers() override;
|
||||
void errorgrad(double* err, double* grad, double* param) override;
|
||||
void evaluate() override;
|
||||
|
||||
@@ -1335,7 +1337,7 @@ private:
|
||||
return pvec[0];
|
||||
}
|
||||
// writes pointers in pvec to the parameters of c, l
|
||||
void ReconstructGeomPointers();
|
||||
void reconstructGeomPointers() override;
|
||||
|
||||
double value(double& deriValue, double* param);
|
||||
void errorgrad(double* err, double* grad, double* param) override;
|
||||
@@ -1356,7 +1358,7 @@ private:
|
||||
{
|
||||
return pvec[0];
|
||||
}
|
||||
void ReconstructGeomPointers(); // writes pointers in pvec to the parameters of c
|
||||
void reconstructGeomPointers() override; // writes pointers in pvec to the parameters of c
|
||||
double value(double& deriValue, double* param);
|
||||
void errorgrad(double* err, double* grad, double* param) override;
|
||||
void evaluate() override;
|
||||
@@ -1375,7 +1377,7 @@ private:
|
||||
{
|
||||
return pvec[0];
|
||||
}
|
||||
void ReconstructGeomPointers(); // writes pointers in pvec to the parameters of a
|
||||
void reconstructGeomPointers() override; // writes pointers in pvec to the parameters of a
|
||||
void normalizedAngles(double& start, double& end) const;
|
||||
void errorgrad(double* err, double* grad, double* param) override;
|
||||
void evaluate() override;
|
||||
|
||||
Reference in New Issue
Block a user