+}
+
+
+// =============== Auxiliary functions ==================================
+std::shared_ptr<GeomAPI_Pnt2d> intersect(FeaturePtr theLine1, FeaturePtr theLine2)
+{
+ // Start and end points of lines
+ std::shared_ptr<GeomDataAPI_Point2D> aPointA1 = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
+ theLine1->attribute(SketchPlugin_Line::START_ID()));
+ std::shared_ptr<GeomDataAPI_Point2D> aPointA2 = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
+ theLine1->attribute(SketchPlugin_Line::END_ID()));
+
+ std::shared_ptr<GeomDataAPI_Point2D> aPointB1 = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
+ theLine2->attribute(SketchPlugin_Line::START_ID()));
+ std::shared_ptr<GeomDataAPI_Point2D> aPointB2 = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
+ theLine2->attribute(SketchPlugin_Line::END_ID()));
+
+ std::shared_ptr<GeomAPI_Pnt2d> aStartA = aPointA1->pnt();
+ std::shared_ptr<GeomAPI_Pnt2d> aEndA = aPointA2->pnt();
+ std::shared_ptr<GeomAPI_Pnt2d> aStartB = aPointB1->pnt();
+ std::shared_ptr<GeomAPI_Pnt2d> aEndB = aPointB2->pnt();
+ if (aStartA->distance(aEndA) < tolerance || aStartB->distance(aEndB) < tolerance)
+ std::shared_ptr<GeomAPI_Pnt2d>();
+
+ // Lines and their intersection point
+ std::shared_ptr<GeomAPI_Lin2d> aLA(new GeomAPI_Lin2d(aStartA, aEndA));
+ std::shared_ptr<GeomAPI_Lin2d> aLB(new GeomAPI_Lin2d(aStartB, aEndB));
+ return aLA->intersect(aLB);
+}