Sketcher Ellipse and ArcOfEllipse: Major bug fixes
- Change mode so that focus1 is not a point, but two doubles so that visual model and solver model match in number of points. - Solver fix to deal with reduced constraint partials accuracy (threshold for matrix rank calculation tweak) - Changes suggested by logari81
This commit is contained in:
@@ -382,7 +382,6 @@ int Sketch::addArcOfEllipse(const Part::GeomArcOfEllipse &ellipseSegment, bool f
|
||||
aoe->getRange(startAngle, endAngle);
|
||||
|
||||
GCS::Point p1, p2, p3;
|
||||
GCS::Point f1;
|
||||
|
||||
params.push_back(new double(startPnt.x));
|
||||
params.push_back(new double(startPnt.y));
|
||||
@@ -401,8 +400,8 @@ int Sketch::addArcOfEllipse(const Part::GeomArcOfEllipse &ellipseSegment, bool f
|
||||
|
||||
params.push_back(new double(focus1.x));
|
||||
params.push_back(new double(focus1.y));
|
||||
f1.x = params[params.size()-2];
|
||||
f1.y = params[params.size()-1];
|
||||
double *f1X = params[params.size()-2];
|
||||
double *f1Y = params[params.size()-1];
|
||||
|
||||
def.startPointId = Points.size();
|
||||
Points.push_back(p1);
|
||||
@@ -411,7 +410,7 @@ int Sketch::addArcOfEllipse(const Part::GeomArcOfEllipse &ellipseSegment, bool f
|
||||
def.midPointId = Points.size();
|
||||
Points.push_back(p3);
|
||||
|
||||
Points.push_back(f1);
|
||||
//Points.push_back(f1);
|
||||
|
||||
|
||||
// add the radius parameters
|
||||
@@ -429,7 +428,8 @@ int Sketch::addArcOfEllipse(const Part::GeomArcOfEllipse &ellipseSegment, bool f
|
||||
a.start = p1;
|
||||
a.end = p2;
|
||||
a.center = p3;
|
||||
a.focus1 = f1;
|
||||
a.focus1X = f1X;
|
||||
a.focus1Y = f1Y;
|
||||
a.radmin = rmin;
|
||||
a.startAngle = a1;
|
||||
a.endAngle = a2;
|
||||
@@ -521,26 +521,20 @@ int Sketch::addEllipse(const Part::GeomEllipse &elip, bool fixed)
|
||||
|
||||
def.midPointId = Points.size(); // this takes midPointId+1
|
||||
Points.push_back(c);
|
||||
|
||||
GCS::Point f1;
|
||||
|
||||
params.push_back(new double(focus1.x));
|
||||
params.push_back(new double(focus1.y));
|
||||
f1.x = params[params.size()-2];
|
||||
f1.y = params[params.size()-1];
|
||||
double *f1X = params[params.size()-2];
|
||||
double *f1Y = params[params.size()-1];
|
||||
|
||||
//def.midPointId = Points.size();
|
||||
Points.push_back(f1);
|
||||
|
||||
|
||||
|
||||
// add the radius parameters
|
||||
params.push_back(new double(radmin));
|
||||
double *rmin = params[params.size()-1];
|
||||
|
||||
// set the ellipse for later constraints
|
||||
GCS::Ellipse e;
|
||||
e.focus1 = f1;
|
||||
e.focus1X = f1X;
|
||||
e.focus1Y = f1Y;
|
||||
e.center = c;
|
||||
e.radmin = rmin;
|
||||
|
||||
@@ -2068,8 +2062,8 @@ bool Sketch::updateGeometry()
|
||||
GeomArcOfEllipse *aoe = dynamic_cast<GeomArcOfEllipse*>(it->geo);
|
||||
|
||||
Base::Vector3d center = Vector3d(*Points[it->midPointId].x, *Points[it->midPointId].y, 0.0);
|
||||
Base::Vector3d f1 = Vector3d(*Points[it->midPointId+1].x, *Points[it->midPointId+1].y, 0.0);
|
||||
double radmin = *ArcsOfEllipse[it->index].radmin;
|
||||
Base::Vector3d f1 = Vector3d(*myArc.focus1X, *myArc.focus1Y, 0.0);
|
||||
double radmin = *myArc.radmin;
|
||||
|
||||
Base::Vector3d fd=f1-center;
|
||||
double radmaj = sqrt(fd*fd+radmin*radmin);
|
||||
@@ -2098,7 +2092,7 @@ bool Sketch::updateGeometry()
|
||||
GeomEllipse *ellipse = dynamic_cast<GeomEllipse*>(it->geo);
|
||||
|
||||
Base::Vector3d center = Vector3d(*Points[it->midPointId].x, *Points[it->midPointId].y, 0.0);
|
||||
Base::Vector3d f1 = Vector3d(*Points[it->midPointId+1].x, *Points[it->midPointId+1].y, 0.0);
|
||||
Base::Vector3d f1 = Vector3d(*Ellipses[it->index].focus1X, *Ellipses[it->index].focus1Y, 0.0);
|
||||
double radmin = *Ellipses[it->index].radmin;
|
||||
|
||||
Base::Vector3d fd=f1-center;
|
||||
@@ -2481,33 +2475,6 @@ int Sketch::getPointId(int geoId, PointPos pos) const
|
||||
return -1;
|
||||
}
|
||||
|
||||
int Sketch::getVisiblePointId(int geoId, PointPos pos) const
|
||||
{
|
||||
// do a range check first
|
||||
if (geoId < 0 || geoId >= (int)Geoms.size())
|
||||
return -1;
|
||||
|
||||
int invisiblepoints = 0;
|
||||
int i;
|
||||
|
||||
// calculate the number of points in the solver that are not visible in the UI
|
||||
for(i=0;i<geoId;i++)
|
||||
if(Geoms[i].type == Ellipse || Geoms[i].type == ArcOfEllipse)
|
||||
invisiblepoints++;
|
||||
|
||||
switch (pos) {
|
||||
case start:
|
||||
return Geoms[geoId].startPointId-invisiblepoints;
|
||||
case end:
|
||||
return Geoms[geoId].endPointId-invisiblepoints;
|
||||
case mid:
|
||||
return Geoms[geoId].midPointId-invisiblepoints;
|
||||
case none:
|
||||
break;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
Base::Vector3d Sketch::getPoint(int geoId, PointPos pos)
|
||||
{
|
||||
geoId = checkGeoId(geoId);
|
||||
|
||||
Reference in New Issue
Block a user