Updated handling of collinear edges while searching for intersection.
authorVitaly Tuzov <terfendail@mediana.jetos.com>
Tue, 20 Mar 2018 12:39:44 +0000 (15:39 +0300)
committerVitaly Tuzov <terfendail@mediana.jetos.com>
Wed, 21 Mar 2018 16:15:34 +0000 (19:15 +0300)
modules/imgproc/src/min_enclosing_triangle.cpp

index 0d0783f..bb372fe 100644 (file)
@@ -988,14 +988,15 @@ static bool findGammaIntersectionPoints(const std::vector<cv::Point2f> &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