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

Question about intersect function #35

Open
ChenjieXu opened this issue Oct 6, 2019 · 1 comment
Open

Question about intersect function #35

ChenjieXu opened this issue Oct 6, 2019 · 1 comment

Comments

@ChenjieXu
Copy link

ChenjieXu commented Oct 6, 2019

I don't think it is correct to determine if two regions are intersected by comparing their bounding boxes.
For example, the following situation does not apply. Could anyone help me with this please? Thanks in advance.

image

@Taoboan1999
Copy link

你好,我非常开心发现你和我遇到了相同的看法
我修改了insection函数,考虑了欧氏距离

def intersect(a, b):
    set_a = set(a["position"])
    set_b = set(b["position"])
    for (y1, x1) in set_a:
        if (y1 + 1, x1) in set_b or (y1 - 1, x1) in set_b or (y1, x1 + 1) in set_b or (y1, x1 - 1) in set_b:
            return True
    return False

其中position包括当前区域的所有位置(y1,x1),(y2,x2)……

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

2 participants