diff --git a/modules/imgproc/src/min_enclosing_triangle.cpp b/modules/imgproc/src/min_enclosing_triangle.cpp index 0d0783f374..bb372fe338 100644 --- a/modules/imgproc/src/min_enclosing_triangle.cpp +++ b/modules/imgproc/src/min_enclosing_triangle.cpp @@ -988,14 +988,15 @@ static bool findGammaIntersectionPoints(const std::vector &polygon, double sideCExtraParam = 2 * polygonPointHeight * distFormulaDenom; // Get intersection points if they exist or if lines are identical - if (!areIntersectingLines(side1Params, side2Params, sideCExtraParam, intersectionPoint1, intersectionPoint2)) { - return false; + if (areIntersectingLines(side1Params, side2Params, sideCExtraParam, intersectionPoint1, intersectionPoint2)) { + return true; } else if (areIdenticalLines(side1Params, side2Params, sideCExtraParam)) { intersectionPoint1 = side1StartVertex; intersectionPoint2 = side1EndVertex; + return true; } - return true; + return false; } //! Check if the given lines are identical or not