Sketcher: Parabola Arc rules solver constraint

This commit is contained in:
Abdullah Tahiri 2016-12-21 16:25:19 +01:00
parent b2bca80796
commit 61fe4bcaee
4 changed files with 12 additions and 5 deletions

View File

@ -639,8 +639,8 @@ int Sketch::addArcOfParabola(const Part::GeomArcOfParabola &parabolaSegment, boo
Geoms.push_back(def);
// arcs require an ArcRules constraint for the end points
//if (!fixed)
// GCSsys.addConstraintArcOfParabolaRules(a);
if (!fixed)
GCSsys.addConstraintArcOfParabolaRules(a);
// return the position of the newly added geometry
return Geoms.size()-1;

View File

@ -604,6 +604,12 @@ int System::addConstraintArcOfHyperbolaRules(ArcOfHyperbola &a, int tagId)
return addConstraintCurveValue(a.end,a,a.endAngle, tagId);
}
int System::addConstraintArcOfParabolaRules(ArcOfParabola &a, int tagId)
{
addConstraintCurveValue(a.start,a,a.startAngle, tagId);
return addConstraintCurveValue(a.end,a,a.endAngle, tagId);
}
int System::addConstraintPointOnArc(Point &p, Arc &a, int tagId)
{
return addConstraintP2PDistance(p, a.center, a.rad, tagId);

View File

@ -184,7 +184,8 @@ namespace GCS
int addConstraintPointOnHyperbolicArc(Point &p, ArcOfHyperbola &e, int tagId=0);
int addConstraintArcOfEllipseRules(ArcOfEllipse &a, int tagId=0);
int addConstraintCurveValue(Point &p, Curve &a, double *u, int tagId=0);
int addConstraintArcOfHyperbolaRules(ArcOfHyperbola &a, int tagId=0);
int addConstraintArcOfHyperbolaRules(ArcOfHyperbola &a, int tagId=0);
int addConstraintArcOfParabolaRules(ArcOfParabola &a, int tagId=0);
int addConstraintPointOnArc(Point &p, Arc &a, int tagId=0);
int addConstraintPerpendicularLine2Arc(Point &p1, Point &p2, Arc &a,
int tagId=0);

View File

@ -539,9 +539,9 @@ DeriVector2 Parabola::Value(double u, double du, double* derivparam)
f = fv.length(df);
DeriVector2 xdir = fv.getNormalized();
DeriVector2 ydir = xdir.rotate90ccw();
DeriVector2 ydir = xdir.rotate90cw();
DeriVector2 dirx = xdir.multD(u,du).multD(u,du).multD(0.25*f,0.5*df);
DeriVector2 dirx = xdir.multD(u,du).multD(u,du).divD(4*f,4*df);
DeriVector2 diry = ydir.multD(u,du);
DeriVector2 dir = dirx.sum(diry);