While vertices ("V" intersections where segments touch at their vertices) are ignored with the USE_IGNORE_SEGMENT_ENDINGS set to True, the "T" intersections (where a segment endpoint touches the interior of another segment) are not ignored. This can be remedied by changing the 'and' to 'or' in the two places where this sort of test occurs:
if USE_IGNORE_SEGMENT_ENDINGS:
if ((len_squared_v2v2(ix, a0) < NUM_EPS_SQ or
len_squared_v2v2(ix, a1) < NUM_EPS_SQ) and # <-- change to 'or'
(len_squared_v2v2(ix, b0) < NUM_EPS_SQ or
len_squared_v2v2(ix, b1) < NUM_EPS_SQ)):
continue
I don't think it would be bad to ignore such intersections because these don't, for example, change properties of a polygon like area.
In addition, a quick test of 'if ix in (a0, a1, b0, b1)could be added, too, and it might be a good idea to modifyisect_seg_seg_v2_point` to have a quick return before the canonicalization of the args:
if v1 in (v3, v4):
return v1
if v2 in (v3, v4):
return v2
(Such a test is already done in isect_segments__naive with if a0 not in (b0, b1) and a1 not in (b0, b1): but maybe it makes more sense in that context where new intersections which create new segments don't need to be tested -- if my early understands of the BO algorithm are correct.)
While vertices ("V" intersections where segments touch at their vertices) are ignored with the
USE_IGNORE_SEGMENT_ENDINGS
set to True, the "T" intersections (where a segment endpoint touches the interior of another segment) are not ignored. This can be remedied by changing the 'and' to 'or' in the two places where this sort of test occurs:I don't think it would be bad to ignore such intersections because these don't, for example, change properties of a polygon like area.
In addition, a quick test of 'if ix in (a0, a1, b0, b1)
could be added, too, and it might be a good idea to modify
isect_seg_seg_v2_point` to have a quick return before the canonicalization of the args:(Such a test is already done in
isect_segments__naive
withif a0 not in (b0, b1) and a1 not in (b0, b1):
but maybe it makes more sense in that context where new intersections which create new segments don't need to be tested -- if my early understands of the BO algorithm are correct.)