[Bf-blender-cvs] [9081f3643a7] temp-gpencil-io: Cleanup: Simplify vector direction comparison

Antonio Vazquez noreply at git.blender.org
Wed Feb 24 16:43:42 CET 2021


Commit: 9081f3643a785dc162957b31e6db6fc4fd0ad3d3
Author: Antonio Vazquez
Date:   Wed Feb 24 16:43:18 2021 +0100
Branches: temp-gpencil-io
https://developer.blender.org/rB9081f3643a785dc162957b31e6db6fc4fd0ad3d3

Cleanup: Simplify vector direction comparison

Multiply the two number together. If the sign of the result is positive, then the sign was the same. If the sign of the result is negative, then the signs were different.

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

M	source/blender/editors/gpencil/gpencil_interpolate.c

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

diff --git a/source/blender/editors/gpencil/gpencil_interpolate.c b/source/blender/editors/gpencil/gpencil_interpolate.c
index ff5ce7101f1..ae3dae326c0 100644
--- a/source/blender/editors/gpencil/gpencil_interpolate.c
+++ b/source/blender/editors/gpencil/gpencil_interpolate.c
@@ -237,8 +237,8 @@ static bool gpencil_stroke_need_flip(Depsgraph *depsgraph,
     float v1[2], v2[2];
     sub_v2_v2v2(v1, v_from_end, v_from_start);
     sub_v2_v2v2(v2, v_to_end, v_to_start);
-    if (((v1[0] > 0.0f && v2[0] < 0.0f) || (v1[0] < 0.0f && v2[0] > 0.0f)) &&
-        ((v1[1] > 0.0f && v2[1] < 0.0f) || (v1[1] < 0.0f && v2[1] > 0.0f))) {
+    mul_v2_v2v2(v1, v1, v2);
+    if ((v1[0] < 0.0f) && (v1[1] < 0.0f)) {
       return true;
     }
   }



More information about the Bf-blender-cvs mailing list