[Bf-blender-cvs] [82422c8d1fd] lanpr-under-gp: LineArt: 2d Intersection function ratio check improvements.

YimingWu noreply at git.blender.org
Sun Sep 27 13:16:07 CEST 2020


Commit: 82422c8d1fd09267c975a1f990559697f8ae16de
Author: YimingWu
Date:   Sun Sep 27 19:15:31 2020 +0800
Branches: lanpr-under-gp
https://developer.blender.org/rB82422c8d1fd09267c975a1f990559697f8ae16de

LineArt: 2d Intersection function ratio check improvements.

===================================================================

M	source/blender/editors/include/ED_lineart.h

===================================================================

diff --git a/source/blender/editors/include/ED_lineart.h b/source/blender/editors/include/ED_lineart.h
index fe66aed8522..449b0bf94aa 100644
--- a/source/blender/editors/include/ED_lineart.h
+++ b/source/blender/editors/include/ED_lineart.h
@@ -469,7 +469,12 @@ BLI_INLINE int lineart_LineIntersectTest2d(
 
     if (fabs(a2[0] - a1[0]) > fabs(a2[1] - a1[1])) {
       *aRatio = ratiod(a1[0], a2[0], rx);
-      rr = ratiod(b1[1], b2[1], ry);
+      if (fabs(b2[0] - b1[0]) > fabs(b2[1] - b1[1])) {
+        rr = ratiod(b1[0], b2[0], rx);
+      }
+      else {
+        rr = ratiod(b1[1], b2[1], ry);
+      }
       if ((*aRatio) > 0 && (*aRatio) < 1 && rr > 0 && rr < 1) {
         return 1;
       }
@@ -477,7 +482,12 @@ BLI_INLINE int lineart_LineIntersectTest2d(
     }
     else {
       *aRatio = ratiod(a1[1], a2[1], ry);
-      rr = ratiod(b1[0], b2[0], rx);
+      if (fabs(b2[0] - b1[0]) > fabs(b2[1] - b1[1])) {
+        rr = ratiod(b1[0], b2[0], rx);
+      }
+      else {
+        rr = ratiod(b1[1], b2[1], ry);
+      }
       if ((*aRatio) > 0 && (*aRatio) < 1 && rr > 0 && rr < 1) {
         return 1;
       }



More information about the Bf-blender-cvs mailing list