Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

USE_IGNORE_SEGMENT_ENDINGS = True doesn't ignore "T" intersections #14

Open
smichr opened this issue Jan 18, 2018 · 0 comments
Open

USE_IGNORE_SEGMENT_ENDINGS = True doesn't ignore "T" intersections #14

smichr opened this issue Jan 18, 2018 · 0 comments

Comments

@smichr
Copy link

smichr commented Jan 18, 2018

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.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant