[Bf-blender-cvs] [64438d679ff] lanpr-under-gp: LineArt: Slope throw away threshold in lineart_LineIntersectTest2d()

YimingWu noreply at git.blender.org
Sat Aug 29 05:30:05 CEST 2020


Commit: 64438d679fff5512d94db319d8ac18d69507a51f
Author: YimingWu
Date:   Sat Aug 29 11:29:13 2020 +0800
Branches: lanpr-under-gp
https://developer.blender.org/rB64438d679fff5512d94db319d8ac18d69507a51f

LineArt: Slope throw away threshold in lineart_LineIntersectTest2d()

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

M	source/blender/editors/include/ED_lineart.h
M	source/blender/editors/lineart/lineart_cpu.c

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

diff --git a/source/blender/editors/include/ED_lineart.h b/source/blender/editors/include/ED_lineart.h
index 1455bd2ae99..6f98045073e 100644
--- a/source/blender/editors/include/ED_lineart.h
+++ b/source/blender/editors/include/ED_lineart.h
@@ -446,8 +446,8 @@ BLI_INLINE int lineart_LineIntersectTest2d(
   double x_diff = (a2[0] - a1[0]);
   double x_diff2 = (b2[0] - b1[0]);
 
-  if (x_diff == 0) {
-    if (x_diff2 == 0) {
+  if (LRT_DOUBLE_CLOSE_ENOUGH(x_diff, 0)) {
+    if (LRT_DOUBLE_CLOSE_ENOUGH(x_diff2, 0)) {
       *aRatio = 0;
       return 0;
     }
@@ -457,7 +457,7 @@ BLI_INLINE int lineart_LineIntersectTest2d(
     *aRatio = ratio = lineart_get_linear_ratio(a1[1], a2[1], y);
   }
   else {
-    if (x_diff2 == 0) {
+    if (LRT_DOUBLE_CLOSE_ENOUGH(x_diff2, 0)) {
       ratio = lineart_get_linear_ratio(a1[0], a2[0], b1[0]);
       x = interpd(a2[0], a1[0], ratio);
       *aRatio = ratio;
@@ -477,7 +477,7 @@ BLI_INLINE int lineart_LineIntersectTest2d(
     }
   }
 
-  if (b1[0] == b2[0]) {
+  if (LRT_DOUBLE_CLOSE_ENOUGH(b1[0], b2[0])) {
     y = interpd(a2[1], a1[1], ratio);
     if (y > MAX2(b1[1], b2[1]) || y < MIN2(b1[1], b2[1]))
       return 0;
diff --git a/source/blender/editors/lineart/lineart_cpu.c b/source/blender/editors/lineart/lineart_cpu.c
index deb459e773d..76a1f7a823c 100644
--- a/source/blender/editors/lineart/lineart_cpu.c
+++ b/source/blender/editors/lineart/lineart_cpu.c
@@ -1791,7 +1791,7 @@ static LineartRenderLine *lineart_another_edge(const LineartRenderTriangle *rt,
 }
 static int lineart_edge_from_triangle(const LineartRenderTriangle *rt, const LineartRenderLine *rl)
 {
-  if (rl->tl == rt || rl->tr == rt) {
+  if (rt->rl[0] == rl || rt->rl[1] == rl || rt->rl[2] == rl) {
     return 1;
   }
   if (lineart_share.allow_overlapping_edges) {
@@ -1853,7 +1853,8 @@ static int lineart_triangle_line_imagespace_intersection_v2(SpinLock *UNUSED(spl
   if ((MAX3(FBC0[0], FBC1[0], FBC2[0]) < MIN2(LFBC[0], RFBC[0])) ||
       (MIN3(FBC0[0], FBC1[0], FBC2[0]) > MAX2(LFBC[0], RFBC[0])) ||
       (MAX3(FBC0[1], FBC1[1], FBC2[1]) < MIN2(LFBC[1], RFBC[1])) ||
-      (MIN3(FBC0[1], FBC1[1], FBC2[1]) > MAX2(LFBC[1], RFBC[1]))) {
+      (MIN3(FBC0[1], FBC1[1], FBC2[1]) > MAX2(LFBC[1], RFBC[1])) ||
+      (MIN3(FBC0[1], FBC1[1], FBC2[1]) > MAX2(LFBC[2], RFBC[2]))) {
     return 0;
   }



More information about the Bf-blender-cvs mailing list