diff --git a/src/Mod/Sketcher/App/Sketch.cpp b/src/Mod/Sketcher/App/Sketch.cpp index cda00f64d2..23752b56d5 100644 --- a/src/Mod/Sketcher/App/Sketch.cpp +++ b/src/Mod/Sketcher/App/Sketch.cpp @@ -441,7 +441,7 @@ int Sketch::addArcOfEllipse(const Part::GeomArcOfEllipse &ellipseSegment, bool f // arcs require an ArcRules constraint for the end points if (!fixed) - GCSsys.addConstraintArcOfEllipseRules(a); // TODO: ArcOfEllipse implementation. + GCSsys.addConstraintArcOfEllipseRules(a); // return the position of the newly added geometry return Geoms.size()-1; @@ -492,7 +492,7 @@ int Sketch::addCircle(const Part::GeomCircle &cir, bool fixed) int Sketch::addEllipse(const Part::GeomEllipse &elip, bool fixed) { - // TODO: Ellipse + std::vector ¶ms = fixed ? FixParameters : Parameters; // create our own copy @@ -1040,7 +1040,7 @@ int Sketch::addPerpendicularConstraint(int geoId1, PointPos pos1, int geoId2) return ConstraintsCounter; } else if (Geoms[geoId2].type == Ellipse) { - // TODO: Ellipse + GCS::Ellipse &c2 = Ellipses[Geoms[geoId2].index]; GCS::Point &p2 = Points[Geoms[geoId2].midPointId]; int tag = ++ConstraintsCounter; @@ -1059,7 +1059,6 @@ int Sketch::addPerpendicularConstraint(int geoId1, PointPos pos1, int geoId2) return ConstraintsCounter; } else if (Geoms[geoId2].type == Arc || Geoms[geoId2].type == Circle || Geoms[geoId2].type == Ellipse) { - // TODO: ellipse real implementation int tag = ++ConstraintsCounter; GCS::Point ¢er = Points[Geoms[geoId2].midPointId]; double *radius; @@ -1072,7 +1071,7 @@ int Sketch::addPerpendicularConstraint(int geoId1, PointPos pos1, int geoId2) radius = c2.rad; } else { - // TODO: Ellipse + GCS::Ellipse &c2 = Ellipses[Geoms[geoId2].index]; radius = c2.radmin; } @@ -1254,7 +1253,7 @@ int Sketch::addTangentConstraint(int geoId1, int geoId2) } } else if (Geoms[geoId1].type == Ellipse) { GCS::Ellipse &e = Ellipses[Geoms[geoId1].index]; - // TODO: Ellipse + if (Geoms[geoId2].type == Circle) { GCS::Circle &c = Circles[Geoms[geoId2].index]; int tag = ++ConstraintsCounter; @@ -1274,7 +1273,7 @@ int Sketch::addTangentConstraint(int geoId1, int geoId2) GCSsys.addConstraintTangent(c, a, tag); return ConstraintsCounter; } else if (Geoms[geoId2].type == Ellipse) { - // TODO: Ellipse + GCS::Ellipse &e = Ellipses[Geoms[geoId2].index]; int tag = ++ConstraintsCounter; GCSsys.addConstraintTangent(e, a, tag); @@ -1329,7 +1328,7 @@ int Sketch::addTangentConstraint(int geoId1, PointPos pos1, int geoId2) return ConstraintsCounter; } else if (Geoms[geoId2].type == Ellipse) { - // TODO: Ellipse + GCS::Ellipse &e = Ellipses[Geoms[geoId2].index]; int tag = ++ConstraintsCounter; GCSsys.addConstraintPointOnEllipse(p1, e, tag); @@ -1366,7 +1365,7 @@ int Sketch::addTangentConstraint(int geoId1, PointPos pos1, int geoId2) return ConstraintsCounter; } } else if (Geoms[geoId2].type == Ellipse) { - // TODO: Ellipse + GCS::Ellipse &e = Ellipses[Geoms[geoId2].index]; if (pos1 == start) { int tag = ++ConstraintsCounter; @@ -1591,7 +1590,7 @@ int Sketch::addDistanceConstraint(int geoId1, PointPos pos1, int geoId2, PointPo return -1; } -int Sketch::addRadiusConstraint(int geoId, double value, int radiusnumber) +int Sketch::addRadiusConstraint(int geoId, double value) { geoId = checkGeoId(geoId); @@ -1730,7 +1729,7 @@ int Sketch::addEqualConstraint(int geoId1, int geoId2) else std::swap(geoId1, geoId2); } - // TODO: Ellipse + if (Geoms[geoId2].type == Ellipse) { if (Geoms[geoId1].type == Ellipse) { GCS::Ellipse &e1 = Ellipses[Geoms[geoId1].index]; @@ -2108,7 +2107,7 @@ bool Sketch::updateGeometry() ); circ->setRadius(*Circles[it->index].rad); } else if (it->type == Ellipse) { - // TODO: Ellipse + GeomEllipse *ellipse = dynamic_cast(it->geo); Base::Vector3d center = Vector3d(*Points[it->midPointId].x, *Points[it->midPointId].y, 0.0); @@ -2305,7 +2304,7 @@ int Sketch::initMove(int geoId, PointPos pos, bool fine) GCSsys.rescaleConstraint(i, 0.01); } } else if (Geoms[geoId].type == Ellipse) { - // TODO: Ellipse + GCS::Point ¢er = Points[Geoms[geoId].midPointId]; GCS::Point p0,p1; if (pos == mid | pos == none) { @@ -2317,7 +2316,7 @@ int Sketch::initMove(int geoId, PointPos pos, bool fine) GCSsys.addConstraintP2PCoincident(p0,center,-1); } } else if (Geoms[geoId].type == ArcOfEllipse) { - // TODO: ArcOfEllipse + GCS::Point ¢er = Points[Geoms[geoId].midPointId]; GCS::Point p0,p1; if (pos == mid || pos == none) { @@ -2328,7 +2327,7 @@ int Sketch::initMove(int geoId, PointPos pos, bool fine) *p0.y = *center.y; GCSsys.addConstraintP2PCoincident(p0,center,-1); } else if (pos == start || pos == end) { - // TODO: Ellipse + MoveParameters.resize(4); // x,y,cx,cy if (pos == start || pos == end) { GCS::Point &p = (pos == start) ? Points[Geoms[geoId].startPointId] diff --git a/src/Mod/Sketcher/App/Sketch.h b/src/Mod/Sketcher/App/Sketch.h index ded3ccbf31..de54b8cfa0 100644 --- a/src/Mod/Sketcher/App/Sketch.h +++ b/src/Mod/Sketcher/App/Sketch.h @@ -165,7 +165,7 @@ public: int addTangentConstraint(int geoId1, PointPos pos1, int geoId2); int addTangentConstraint(int geoId1, PointPos pos1, int geoId2, PointPos pos2); /// add a radius constraint on a circle or an arc - int addRadiusConstraint(int geoId, double value, int radiusnumber=0); + int addRadiusConstraint(int geoId, double value); /// add an angle constraint on a line or between two lines int addAngleConstraint(int geoId, double value); int addAngleConstraint(int geoId1, int geoId2, double value); @@ -198,7 +198,7 @@ public: Line = 2, // 2 Points(start,end), 4 Parameters(x1,y1,x2,y2) Arc = 3, // 3 Points(start,end,mid), (4)+5 Parameters((x1,y1,x2,y2),x,y,r,a1,a2) Circle = 4, // 1 Point(mid), 3 Parameters(x,y,r) - Ellipse = 5, // 1 Point(mid), 5 Parameters(x,y,r1,r2,phi) phi=angle xaxis of elipse with respect of sketch xaxis// TODO: Ellipse + Ellipse = 5, // 1 Point(mid), 5 Parameters(x,y,r1,r2,phi) phi=angle xaxis of elipse with respect of sketch xaxis ArcOfEllipse = 6 }; diff --git a/src/Mod/Sketcher/App/SketchObject.cpp b/src/Mod/Sketcher/App/SketchObject.cpp index 605166c53a..f992bb598e 100644 --- a/src/Mod/Sketcher/App/SketchObject.cpp +++ b/src/Mod/Sketcher/App/SketchObject.cpp @@ -1311,8 +1311,7 @@ int SketchObject::trim(int GeoId, const Base::Vector3d& point) std::swap(GeoId1,GeoId2); std::swap(point1,point2); } else if (theta2 > 0.999*arcLength) { - } - else + } else return -1; } diff --git a/src/Mod/Sketcher/App/freegcs/GCS.cpp b/src/Mod/Sketcher/App/freegcs/GCS.cpp index 3d6ceea0e5..83290ae8a0 100644 --- a/src/Mod/Sketcher/App/freegcs/GCS.cpp +++ b/src/Mod/Sketcher/App/freegcs/GCS.cpp @@ -27,10 +27,10 @@ #include "qp_eq.h" #include -#define _GCS_DEBUG 1 +#undef _GCS_DEBUG #undef _GCS_DEBUG_SOLVER_JACOBIAN_QR_DECOMPOSITION_TRIANGULAR_MATRIX -#ifdef _GCS_DEBUG +#if defined(_GCS_DEBUG) || defined(_GCS_DEBUG_SOLVER_JACOBIAN_QR_DECOMPOSITION_TRIANGULAR_MATRIX) #include #include #include @@ -716,7 +716,7 @@ int System::addConstraintTangentCircle2Arc(Circle &c, Arc &a, int tagId) int System::addConstraintTangentEllipse2Arc(Ellipse &e, Arc &a, int tagId) { - // TODO: Ellipse + /*addConstraintPointOnEllipse(a.start, e, tagId); double dx = *(a.start.x) - *(e.center.x); double dy = *(a.start.y) - *(e.center.y); @@ -740,7 +740,7 @@ int System::addConstraintTangentArc2Circle(Arc &a, Circle &c, int tagId) int System::addConstraintTangentArc2Ellipse(Arc &a, Ellipse &e, int tagId) { - // TODO: Ellipse + /*addConstraintPointOnEllipse(a.end, e, tagId); double dx = *(a.end.x) - *(e.center.x); double dy = *(a.end.y) - *(e.center.y); @@ -789,7 +789,7 @@ int System::addConstraintEqualRadius(Circle &c1, Circle &c2, int tagId) int System::addConstraintEqualRadii(Ellipse &e1, Ellipse &e2, int tagId) { - // TODO: Ellipse + //addConstraintEqual(e1.radmaj, e2.radmaj, tagId); addConstraintEqual(e1.radmin, e2.radmin, tagId); diff --git a/src/Mod/Sketcher/Gui/CommandConstraints.cpp b/src/Mod/Sketcher/Gui/CommandConstraints.cpp index 05f2324c00..86e33c741b 100644 --- a/src/Mod/Sketcher/Gui/CommandConstraints.cpp +++ b/src/Mod/Sketcher/Gui/CommandConstraints.cpp @@ -147,7 +147,7 @@ bool isSimpleVertex(const Sketcher::SketchObject* Obj, int GeoId, PointPos PosId if (geo->getTypeId() == Part::GeomPoint::getClassTypeId()) return true; else if (PosId == Sketcher::mid && - (geo->getTypeId() == Part::GeomCircle::getClassTypeId() || // TODO: ellipse + (geo->getTypeId() == Part::GeomCircle::getClassTypeId() || geo->getTypeId() == Part::GeomArcOfCircle::getClassTypeId())) return true; else @@ -802,7 +802,7 @@ void CmdSketcherConstrainPointOnObject::activated(int iMsg) // Currently only accepts line segments and circles if (geom->getTypeId() == Part::GeomLineSegment::getClassTypeId() || - geom->getTypeId() == Part::GeomCircle::getClassTypeId() || // TODO: ellipse + geom->getTypeId() == Part::GeomCircle::getClassTypeId() || geom->getTypeId() == Part::GeomArcOfCircle::getClassTypeId() || geom->getTypeId() == Part::GeomEllipse::getClassTypeId() || geom->getTypeId() == Part::GeomArcOfEllipse::getClassTypeId() ) { @@ -1289,7 +1289,7 @@ void CmdSketcherConstrainPerpendicular::activated(int iMsg) } else if (geo2->getTypeId() != Part::GeomLineSegment::getClassTypeId() && geo2->getTypeId() != Part::GeomArcOfCircle::getClassTypeId() && - geo2->getTypeId() != Part::GeomCircle::getClassTypeId()) { // TODO: ellipse + geo2->getTypeId() != Part::GeomCircle::getClassTypeId()) { QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Wrong selection"), QObject::tr("The selected edge should be an arc, line or circle.")); return; @@ -1765,7 +1765,7 @@ void CmdSketcherConstrainRadius::activated(int iMsg) double radius = arc->getRadius(); geoIdRadiusMap.push_back(std::make_pair(GeoId, radius)); } - else if (geom && geom->getTypeId() == Part::GeomCircle::getClassTypeId()) { // TODO: ellipse + else if (geom && geom->getTypeId() == Part::GeomCircle::getClassTypeId()) { const Part::GeomCircle *circle = dynamic_cast(geom); double radius = circle->getRadius(); geoIdRadiusMap.push_back(std::make_pair(GeoId, radius)); @@ -2113,9 +2113,9 @@ void CmdSketcherConstrainEqual::activated(int iMsg) arcSel = true; else if (geo->getTypeId() != Part::GeomCircle::getClassTypeId()) circSel = true; - else if (geo->getTypeId() != Part::GeomEllipse::getClassTypeId()) // TODO: ellipse + else if (geo->getTypeId() != Part::GeomEllipse::getClassTypeId()) ellipsSel = true; - else if (geo->getTypeId() != Part::GeomArcOfEllipse::getClassTypeId()) // TODO: ellipse + else if (geo->getTypeId() != Part::GeomArcOfEllipse::getClassTypeId()) arcEllipsSel = true; else { QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Wrong selection"), diff --git a/src/Mod/Sketcher/Gui/CommandCreateGeo.cpp b/src/Mod/Sketcher/Gui/CommandCreateGeo.cpp index 404b9af2d2..937fffdffe 100644 --- a/src/Mod/Sketcher/Gui/CommandCreateGeo.cpp +++ b/src/Mod/Sketcher/Gui/CommandCreateGeo.cpp @@ -1976,6 +1976,20 @@ public: minAxisPoint = EditCurve[0]+minAxisDir; } + Base::Vector3d center = Base::Vector3d(EditCurve[0].fX,EditCurve[0].fY,0); + + Base::Vector3d majorpositiveend = center + a * Base::Vector3d(cos(phi),sin(phi),0); + Base::Vector3d majornegativeend = center - a * Base::Vector3d(cos(phi),sin(phi),0); + Base::Vector3d minorpositiveend = center + b * Base::Vector3d(-sin(phi),cos(phi),0); + Base::Vector3d minornegativeend = center - b * Base::Vector3d(-sin(phi),cos(phi),0); + + double cf = sqrt( abs(a*a - b*b) );//using abs, avoided using different formula for a>b/agetObject()->getNameInDocument(), + majorpositiveend.x,majorpositiveend.y,majornegativeend.x,majornegativeend.y); // create line for major axis + + Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.toggleConstruction(%d) ", + sketchgui->getObject()->getNameInDocument(),currentgeoid+1); + + Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.addConstraint(Sketcher.Constraint('InternalAlignment:EllipseMajorDiameter',%d,%d)) ", + sketchgui->getObject()->getNameInDocument(),currentgeoid+1,currentgeoid); // constrain major axis + + Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.addGeometry(Part.Line(App.Vector(%f,%f,0),App.Vector(%f,%f,0)))", + sketchgui->getObject()->getNameInDocument(), + minorpositiveend.x,minorpositiveend.y,minornegativeend.x,minornegativeend.y); // create line for minor axis + + Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.toggleConstruction(%d) ", + sketchgui->getObject()->getNameInDocument(),currentgeoid+2); + + Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.addConstraint(Sketcher.Constraint('InternalAlignment:EllipseMinorDiameter',%d,%d)) ", + sketchgui->getObject()->getNameInDocument(),currentgeoid+2,currentgeoid); // constrain minor axis + + Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.addGeometry(Part.Point(App.Vector(%f,%f,0)))", + sketchgui->getObject()->getNameInDocument(), + focus1P.x,focus1P.y); + + Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.addConstraint(Sketcher.Constraint('InternalAlignment:EllipseFocus1',%d,%d,%d)) ", + sketchgui->getObject()->getNameInDocument(),currentgeoid+3,Sketcher::start,currentgeoid); + + Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.addGeometry(Part.Point(App.Vector(%f,%f,0)))", + sketchgui->getObject()->getNameInDocument(), + focus2P.x,focus2P.y); + + Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.addConstraint(Sketcher.Constraint('InternalAlignment:EllipseFocus2',%d,%d,%d)) ", + sketchgui->getObject()->getNameInDocument(),currentgeoid+4,Sketcher::start,currentgeoid); + } + catch (const Base::Exception& e) { + Base::Console().Error("%s\n", e.what()); + Gui::Command::abortCommand(); + Gui::Command::updateActive(); + return false; + } Gui::Command::commitCommand(); Gui::Command::updateActive(); @@ -2290,14 +2348,19 @@ public: startAngle += M_PI/2; } - //calculate focus point vecF2 - double cf;//distance from center to focus - cf = sqrt( abs(a*a - b*b) );//using abs, avoided using different formula for a>b/ab/agetObject()->getNameInDocument(), - vecF2.fX,vecF2.fY); - int iPointF2 = getHighestCurveIndex();//index of the point we just created - - Gui::Command::doCommand(Gui::Command::Doc, - "App.ActiveDocument.%s.addConstraint(Sketcher.Constraint('InternalAlignment:EllipseFocus2',%d,%d,%d)) ", + majorpositiveend.x,majorpositiveend.y,majornegativeend.x,majornegativeend.y); // create line for major axis + + Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.toggleConstruction(%d) ", + sketchgui->getObject()->getNameInDocument(),currentgeoid+1); + + Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.addConstraint(Sketcher.Constraint('InternalAlignment:EllipseMajorDiameter',%d,%d)) ", + sketchgui->getObject()->getNameInDocument(),currentgeoid+1,currentgeoid); // constrain major axis + + Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.addGeometry(Part.Line(App.Vector(%f,%f,0),App.Vector(%f,%f,0)))", sketchgui->getObject()->getNameInDocument(), - iPointF2,Sketcher::start,iAOE); + minorpositiveend.x,minorpositiveend.y,minornegativeend.x,minornegativeend.y); // create line for minor axis + + Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.toggleConstruction(%d) ", + sketchgui->getObject()->getNameInDocument(),currentgeoid+2); + + Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.addConstraint(Sketcher.Constraint('InternalAlignment:EllipseMinorDiameter',%d,%d)) ", + sketchgui->getObject()->getNameInDocument(),currentgeoid+2,currentgeoid); // constrain minor axis + Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.addGeometry(Part.Point(App.Vector(%f,%f,0)))", + sketchgui->getObject()->getNameInDocument(), + focus1P.x,focus1P.y); + + Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.addConstraint(Sketcher.Constraint('InternalAlignment:EllipseFocus1',%d,%d,%d)) ", + sketchgui->getObject()->getNameInDocument(),currentgeoid+3,Sketcher::start,currentgeoid); + Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.addGeometry(Part.Point(App.Vector(%f,%f,0)))", + sketchgui->getObject()->getNameInDocument(), + focus2P.x,focus2P.y); + + Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.addConstraint(Sketcher.Constraint('InternalAlignment:EllipseFocus2',%d,%d,%d)) ", + sketchgui->getObject()->getNameInDocument(),currentgeoid+4,Sketcher::start,currentgeoid); + } + catch (const Base::Exception& e) { + Base::Console().Error("%s\n", e.what()); + Gui::Command::abortCommand(); + Gui::Command::updateActive(); + return false; + } Gui::Command::commitCommand(); Gui::Command::updateActive(); diff --git a/src/Mod/Sketcher/Gui/DrawSketchHandler.cpp b/src/Mod/Sketcher/Gui/DrawSketchHandler.cpp index 681eeb7b31..bdc71f58f4 100644 --- a/src/Mod/Sketcher/Gui/DrawSketchHandler.cpp +++ b/src/Mod/Sketcher/Gui/DrawSketchHandler.cpp @@ -242,7 +242,7 @@ int DrawSketchHandler::seekAutoConstraint(std::vector &suggested } } else if ((*it)->getTypeId() == Part::GeomEllipse::getClassTypeId()) { - // TODO: Ellipse + const Part::GeomEllipse *ellipse = dynamic_cast((*it)); Base::Vector3d center = ellipse->getCenter(); diff --git a/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp b/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp index 0323b03e3c..8d5a743fb6 100644 --- a/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp +++ b/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp @@ -718,7 +718,7 @@ bool ViewProviderSketch::mouseButtonPressed(int Button, bool pressed, const SbVe geo->getTypeId() == Part::GeomArcOfCircle::getClassTypeId() || geo->getTypeId() == Part::GeomCircle::getClassTypeId() || geo->getTypeId() == Part::GeomEllipse::getClassTypeId()|| - geo->getTypeId() == Part::GeomArcOfEllipse::getClassTypeId()) { // TODO: ellipse + geo->getTypeId() == Part::GeomArcOfEllipse::getClassTypeId()) { Gui::Command::openCommand("Drag Curve"); Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.movePoint(%i,%i,App.Vector(%f,%f,0),%i)" ,getObject()->getNameInDocument() @@ -3133,7 +3133,7 @@ Restart: norm1 = Base::Vector3d(cos(midangle),sin(midangle),0); dir1 = Base::Vector3d(-norm1.y,norm1.x,0); midpos1 = arc->getCenter() + arc->getRadius() * norm1; - } else if (geo1->getTypeId() == Part::GeomCircle::getClassTypeId()) { // TODO: ellipse + } else if (geo1->getTypeId() == Part::GeomCircle::getClassTypeId()) { const Part::GeomCircle *circle = dynamic_cast(geo1); norm1 = Base::Vector3d(cos(M_PI/4),sin(M_PI/4),0); dir1 = Base::Vector3d(-norm1.y,norm1.x,0); @@ -3154,7 +3154,7 @@ Restart: norm2 = Base::Vector3d(cos(midangle),sin(midangle),0); dir2 = Base::Vector3d(-norm2.y,norm2.x,0); midpos2 = arc->getCenter() + arc->getRadius() * norm2; - } else if (geo2->getTypeId() == Part::GeomCircle::getClassTypeId()) { // TODO: ellipse + } else if (geo2->getTypeId() == Part::GeomCircle::getClassTypeId()) { const Part::GeomCircle *circle = dynamic_cast(geo2); norm2 = Base::Vector3d(cos(M_PI/4),sin(M_PI/4),0); dir2 = Base::Vector3d(-norm2.y,norm2.x,0); @@ -3201,7 +3201,7 @@ Restart: if (Constr->Type == Equal) { double r1a,r1b,r2a,r2b; double angle1,angle1plus=0., angle2, angle2plus=0.;//angle1 = rotation of object as a whole; angle1plus = arc angle (t parameter for ellipses). - if (geo1->getTypeId() == Part::GeomCircle::getClassTypeId()) { // TODO: ellipse + if (geo1->getTypeId() == Part::GeomCircle::getClassTypeId()) { const Part::GeomCircle *circle = dynamic_cast(geo1); r1a = circle->getRadius(); angle1 = M_PI/4; @@ -3463,7 +3463,7 @@ Restart: const Part::GeomLineSegment *lineSeg = dynamic_cast(geo1); Base::Vector3d dir = (lineSeg->getEndPoint() - lineSeg->getStartPoint()).Normalize(); Base::Vector3d norm(-dir.y, dir.x, 0); - if (geo2->getTypeId()== Part::GeomCircle::getClassTypeId()) { // TODO: ellipse + if (geo2->getTypeId()== Part::GeomCircle::getClassTypeId()) { const Part::GeomCircle *circle = dynamic_cast(geo2); // tangency between a line and a circle float length = (circle->getCenter() - lineSeg->getStartPoint())*dir; @@ -3472,7 +3472,7 @@ Restart: relPos = norm * 1; //TODO Huh? } else if (geo2->getTypeId()== Part::GeomEllipse::getClassTypeId() || - geo2->getTypeId()== Part::GeomArcOfEllipse::getClassTypeId()) { // TODO: ellipse + geo2->getTypeId()== Part::GeomArcOfEllipse::getClassTypeId()) { Base::Vector3d center; if(geo2->getTypeId()== Part::GeomEllipse::getClassTypeId()){ @@ -3499,7 +3499,7 @@ Restart: } } - if (geo1->getTypeId()== Part::GeomCircle::getClassTypeId() && // TODO: ellipse + if (geo1->getTypeId()== Part::GeomCircle::getClassTypeId() && geo2->getTypeId()== Part::GeomCircle::getClassTypeId()) { const Part::GeomCircle *circle1 = dynamic_cast(geo1); const Part::GeomCircle *circle2 = dynamic_cast(geo2); @@ -3508,12 +3508,12 @@ Restart: pos = circle1->getCenter() + dir * circle1->getRadius(); relPos = dir * 1; } - else if (geo2->getTypeId()== Part::GeomCircle::getClassTypeId()) { // TODO: ellipse + else if (geo2->getTypeId()== Part::GeomCircle::getClassTypeId()) { std::swap(geo1,geo2); } if (geo1->getTypeId()== Part::GeomCircle::getClassTypeId() && - geo2->getTypeId()== Part::GeomArcOfCircle::getClassTypeId()) { // TODO: ellipse + geo2->getTypeId()== Part::GeomArcOfCircle::getClassTypeId()) { const Part::GeomCircle *circle = dynamic_cast(geo1); const Part::GeomArcOfCircle *arc = dynamic_cast(geo2); // tangency between a circle and an arc