[Bf-blender-cvs] [10f1972ff78] master: GPencil: Fix missing Fill stroke cross detection

Antonio Vazquez noreply at git.blender.org
Thu Sep 29 13:52:06 CEST 2022


Commit: 10f1972ff78bffb5323cebb85125c64efc7b5ca8
Author: Antonio Vazquez
Date:   Thu Sep 29 13:51:58 2022 +0200
Branches: master
https://developer.blender.org/rB10f1972ff78bffb5323cebb85125c64efc7b5ca8

GPencil: Fix missing Fill stroke cross detection

If the cross point was in the extreme of the stroke the
collision was not detected because it could be
outside of the bbox.

Removed the bbox check because now it is
not necessary.

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

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

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

diff --git a/source/blender/editors/gpencil/gpencil_fill.c b/source/blender/editors/gpencil/gpencil_fill.c
index aec0af6cd9f..d1e51bf64d2 100644
--- a/source/blender/editors/gpencil/gpencil_fill.c
+++ b/source/blender/editors/gpencil/gpencil_fill.c
@@ -479,21 +479,6 @@ static void gpencil_load_array_strokes(tGPDfill *tgpf)
   tgpf->stroke_array_num = idx;
 }
 
-/* Check if a 2D point is inside a 2D Bounding Box. */
-static bool is_point_in_bbox(tGPDfill *tgpf,
-                             bGPDstroke *gps,
-                             float diff_mat[4][4],
-                             float point2d[2])
-{
-  float boundbox_min[2];
-  float boundbox_max[2];
-
-  ED_gpencil_projected_2d_bound_box(&tgpf->gsc, gps, diff_mat, boundbox_min, boundbox_max);
-
-  rctf rect_stroke = {boundbox_min[0], boundbox_max[0], boundbox_min[1], boundbox_max[1]};
-  return BLI_rctf_isect_pt_v(&rect_stroke, point2d);
-}
-
 static void set_stroke_collide(bGPDstroke *gps_a, bGPDstroke *gps_b, const float connection_dist)
 {
   gps_a->flag |= GP_STROKE_COLLIDE;
@@ -544,11 +529,6 @@ static void gpencil_stroke_collision(
         float intersection2D[2];
         isect_line_line_v2_point(
             a1xy, a2xy, stroke->points2d[i], stroke->points2d[i + 1], intersection2D);
-        /* Verify the collision is inside the bounding box of the strokes. */
-        if (!is_point_in_bbox(tgpf, gps_a, diff_mat, intersection2D) &&
-            !is_point_in_bbox(tgpf, gps_b, diff_mat, intersection2D)) {
-          continue;
-        }
 
         gpencil_point_xy_to_3d(&tgpf->gsc, tgpf->scene, intersection2D, &extreme_a->x);
         mul_m4_v3(inv_mat, &extreme_a->x);



More information about the Bf-blender-cvs mailing list