Sketcher: Focus solver internal geometry

This commit is contained in:
Abdullah Tahiri
2016-12-21 17:09:12 +01:00
parent bb068fa7a4
commit 3932a2f37d
5 changed files with 39 additions and 1 deletions

View File

@@ -1092,6 +1092,9 @@ int Sketch::addConstraint(const Constraint *constraint)
case HyperbolaFocus:
rtn = addInternalAlignmentHyperbolaFocus(constraint->First,constraint->Second);
break;
case ParabolaFocus:
rtn = addInternalAlignmentParabolaFocus(constraint->First,constraint->Second);
break;
default:
break;
}
@@ -2249,6 +2252,32 @@ int Sketch::addInternalAlignmentHyperbolaFocus(int geoId1, int geoId2)
return -1;
}
int Sketch::addInternalAlignmentParabolaFocus(int geoId1, int geoId2)
{
std::swap(geoId1, geoId2);
geoId1 = checkGeoId(geoId1);
geoId2 = checkGeoId(geoId2);
if (Geoms[geoId1].type != ArcOfParabola)
return -1;
if (Geoms[geoId2].type != Point)
return -1;
int pointId1 = getPointId(geoId2, start);
if (pointId1 >= 0 && pointId1 < int(Points.size())) {
GCS::Point &p1 = Points[pointId1];
GCS::ArcOfParabola &a1 = ArcsOfParabola[Geoms[geoId1].index];
int tag = ++ConstraintsCounter;
GCSsys.addConstraintInternalAlignmentParabolaFocus(a1, p1, tag);
return ConstraintsCounter;
}
return -1;
}
double Sketch::calculateAngleViaPoint(int geoId1, int geoId2, double px, double py)
{
geoId1 = checkGeoId(geoId1);