Misc. typo and whitespace fixes
ref: https://forum.freecadweb.org/viewtopic.php?f=3&t=30988#p256964 along with other misc. fixes
This commit is contained in:
@@ -220,7 +220,7 @@ double Ellipse::getRadMaj(const DeriVector2 ¢er, const DeriVector2 &f1, doub
|
||||
double cf, dcf;
|
||||
cf = f1.subtr(center).length(dcf);
|
||||
DeriVector2 hack (b, cf,
|
||||
db, dcf);//hack = a nonsense vector to calculate major radius with derivatives, useful just because the calculation formula is the same as vector length formula
|
||||
db, dcf);//hack = a nonsense vector to calculate major radius with derivatives, useful just because the calculation formula is the same as vector length formula
|
||||
return hack.length(ret_dRadMaj);
|
||||
}
|
||||
|
||||
@@ -403,17 +403,17 @@ DeriVector2 Hyperbola::CalculateNormal(Point &p, double* derivparam)
|
||||
DeriVector2 cv (center, derivparam);
|
||||
DeriVector2 f1v (focus1, derivparam);
|
||||
DeriVector2 pv (p, derivparam);
|
||||
|
||||
|
||||
//calculation.
|
||||
//focus2:
|
||||
DeriVector2 f2v = cv.linCombi(2.0, f1v, -1.0); // 2*cv - f1v
|
||||
|
||||
|
||||
//pf1, pf2 = vectors from p to focus1,focus2
|
||||
DeriVector2 pf1 = f1v.subtr(pv).mult(-1.0); // <--- differs from ellipse normal calculation code by inverting this vector
|
||||
DeriVector2 pf2 = f2v.subtr(pv);
|
||||
//return sum of normalized pf2, pf2
|
||||
DeriVector2 ret = pf1.getNormalized().sum(pf2.getNormalized());
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -486,7 +486,7 @@ int ArcOfHyperbola::PushOwnParams(VEC_pD &pvec)
|
||||
pvec.push_back(startAngle); cnt++;
|
||||
pvec.push_back(endAngle); cnt++;
|
||||
return cnt;
|
||||
|
||||
|
||||
}
|
||||
void ArcOfHyperbola::ReconstructOnNewPvec(VEC_pD &pvec, int &cnt)
|
||||
{
|
||||
@@ -512,14 +512,14 @@ DeriVector2 Parabola::CalculateNormal(Point &p, double* derivparam)
|
||||
DeriVector2 cv (vertex, derivparam);
|
||||
DeriVector2 f1v (focus1, derivparam);
|
||||
DeriVector2 pv (p, derivparam);
|
||||
|
||||
|
||||
// the normal is the vector from the focus to the intersection of ano thru the point p and direction
|
||||
// of the symmetry axis of the parabola with the directrix.
|
||||
// As both point to directrix and point to focus are of equal magnitude, we can work with unitary vectors
|
||||
// to calculate the normal, substraction of those vectors.
|
||||
|
||||
|
||||
DeriVector2 ret = cv.subtr(f1v).getNormalized().subtr(f1v.subtr(pv).getNormalized());
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -527,27 +527,27 @@ DeriVector2 Parabola::Value(double u, double du, double* derivparam)
|
||||
{
|
||||
|
||||
//In local coordinate system, value() of parabola is:
|
||||
//P(U) = O + U*U/(4.*F)*XDir + U*YDir
|
||||
//P(U) = O + U*U/(4.*F)*XDir + U*YDir
|
||||
|
||||
DeriVector2 c(this->vertex, derivparam);
|
||||
DeriVector2 f1(this->focus1, derivparam);
|
||||
|
||||
|
||||
DeriVector2 fv = f1.subtr(c);
|
||||
|
||||
|
||||
double f,df;
|
||||
|
||||
|
||||
f = fv.length(df);
|
||||
|
||||
|
||||
DeriVector2 xdir = fv.getNormalized();
|
||||
DeriVector2 ydir = xdir.rotate90ccw();
|
||||
|
||||
|
||||
DeriVector2 dirx = xdir.multD(u,du).multD(u,du).divD(4*f,4*df);
|
||||
DeriVector2 diry = ydir.multD(u,du);
|
||||
|
||||
DeriVector2 diry = ydir.multD(u,du);
|
||||
|
||||
DeriVector2 dir = dirx.sum(diry);
|
||||
|
||||
|
||||
DeriVector2 ret; //point of parabola at parameter value of u, in global coordinates
|
||||
|
||||
|
||||
ret = c.sum( dir );
|
||||
|
||||
return ret;
|
||||
@@ -589,7 +589,7 @@ int ArcOfParabola::PushOwnParams(VEC_pD &pvec)
|
||||
pvec.push_back(startAngle); cnt++;
|
||||
pvec.push_back(endAngle); cnt++;
|
||||
return cnt;
|
||||
|
||||
|
||||
}
|
||||
void ArcOfParabola::ReconstructOnNewPvec(VEC_pD &pvec, int &cnt)
|
||||
{
|
||||
@@ -612,21 +612,21 @@ DeriVector2 BSpline::CalculateNormal(Point& p, double* derivparam)
|
||||
{
|
||||
// place holder
|
||||
DeriVector2 ret;
|
||||
|
||||
|
||||
// even if this method is call CalculateNormal, the returned vector is not the normal strictu sensus
|
||||
// but a normal vector, where the vector should point to the left when one walks along the curve from
|
||||
// but a normal vector, where the vector should point to the left when one walks along the curve from
|
||||
// start to end.
|
||||
//
|
||||
// https://forum.freecadweb.org/viewtopic.php?f=10&t=26312#p209486
|
||||
|
||||
|
||||
if (mult[0] > degree && mult[mult.size()-1] > degree) {
|
||||
// if endpoints through end poles
|
||||
// if endpoints through end poles
|
||||
if(*p.x == *start.x && *p.y == *start.y) {
|
||||
// and you are asking about the normal at start point
|
||||
// then tangency is defined by first to second poles
|
||||
DeriVector2 endpt(this->poles[1], derivparam);
|
||||
DeriVector2 spt(this->poles[0], derivparam);
|
||||
|
||||
|
||||
DeriVector2 tg = endpt.subtr(spt);
|
||||
ret = tg.rotate90ccw();
|
||||
}
|
||||
@@ -635,7 +635,7 @@ DeriVector2 BSpline::CalculateNormal(Point& p, double* derivparam)
|
||||
// then tangency is defined by last to last but one poles
|
||||
DeriVector2 endpt(this->poles[poles.size()-1], derivparam);
|
||||
DeriVector2 spt(this->poles[poles.size()-2], derivparam);
|
||||
|
||||
|
||||
DeriVector2 tg = endpt.subtr(spt);
|
||||
ret = tg.rotate90ccw();
|
||||
} else {
|
||||
@@ -676,7 +676,7 @@ int BSpline::PushOwnParams(VEC_pD &pvec)
|
||||
|
||||
pvec.insert(pvec.end(), knots.begin(), knots.end());
|
||||
cnt = cnt + knots.size();
|
||||
|
||||
|
||||
pvec.push_back(start.x); cnt++;
|
||||
pvec.push_back(start.y); cnt++;
|
||||
pvec.push_back(end.x); cnt++;
|
||||
@@ -699,7 +699,7 @@ void BSpline::ReconstructOnNewPvec(VEC_pD &pvec, int &cnt)
|
||||
for(VEC_pD::iterator it = knots.begin(); it != knots.end(); ++it) {
|
||||
(*it) = pvec[cnt]; cnt++;
|
||||
}
|
||||
|
||||
|
||||
start.x=pvec[cnt]; cnt++;
|
||||
start.y=pvec[cnt]; cnt++;
|
||||
end.x=pvec[cnt]; cnt++;
|
||||
|
||||
@@ -3231,7 +3231,7 @@ public:
|
||||
enum SelectMode {
|
||||
STATUS_SEEK_First, /**< enum value ----. */
|
||||
STATUS_SEEK_Second, /**< enum value ----. */
|
||||
STATUS_SEEK_Third, /**< enum value ----. */
|
||||
STATUS_SEEK_Third, /**< enum value ----. */
|
||||
STATUS_SEEK_Fourth, /**< enum value ----. */
|
||||
STATUS_Close
|
||||
};
|
||||
@@ -7034,24 +7034,24 @@ public:
|
||||
"conList.append(Sketcher.Constraint('%s',%i))\n"
|
||||
"conList.append(Sketcher.Constraint('Equal',%i,%i))\n"
|
||||
"App.ActiveDocument.%s.addConstraint(conList)\n",
|
||||
StartPos.x,StartPos.y, // center of the arc1
|
||||
StartPos.x,StartPos.y, // center of the arc1
|
||||
fabs(r), // radius arc1
|
||||
start,end, // start and end angle of arc1
|
||||
StartPos.x+lx,StartPos.y+ly, // center of the arc2
|
||||
StartPos.x+lx,StartPos.y+ly, // center of the arc2
|
||||
fabs(r), // radius arc2
|
||||
end,start, // start and end angle of arc2
|
||||
EditCurve[16].x,EditCurve[16].y,EditCurve[17].x,EditCurve[17].y, // line1
|
||||
EditCurve[0].x,EditCurve[0].y,EditCurve[34].x,EditCurve[34].y, // line2
|
||||
sketchgui->getObject()->getNameInDocument(), // the sketch
|
||||
geometryCreationMode==Construction?"True":"False", // geometry as construction or not
|
||||
geometryCreationMode==Construction?"True":"False", // geometry as construction or not
|
||||
firstCurve,firstCurve+3, // tangent1
|
||||
firstCurve,firstCurve+2, // tangent2
|
||||
firstCurve+2,firstCurve+1, // tangent3
|
||||
firstCurve+3,firstCurve+1, // tangent4
|
||||
(fabs(lx)>fabs(ly))?"Horizontal":"Vertical", firstCurve+2, // vertical or horizontal constraint
|
||||
firstCurve,firstCurve+1, // equal constraint
|
||||
sketchgui->getObject()->getNameInDocument()); // the sketch
|
||||
|
||||
sketchgui->getObject()->getNameInDocument()); // the sketch
|
||||
|
||||
Gui::Command::commitCommand();
|
||||
|
||||
// add auto constraints at the start of the first side
|
||||
|
||||
Reference in New Issue
Block a user