小编gre*_*pit的帖子

如何在Mac OS X上使用JDK 7运行IDEA IntelliJ?

我使用的是Mac OS X 10.8.2,并使用JDK 7.现在我下载了最新版本的IDEA IntelliJ,11.但是没有JDK 6它似乎没有开始.有没有解决方法?

如何在Mac OS X上使用JDK 7运行IDEA IntelliJ?

java macos intellij-idea

86
推荐指数
3
解决办法
7万
查看次数

使用两个左下角和右上角检查两个矩形是否在python中重叠

class Point:

    def __init__(self, xcoord=0, ycoord=0):
        self.x = xcoord
        self.y = ycoord

class Rectangle:
    def __init__(self, bottom_left, top_right, colour):
        self.bottom_left = bottom_left
        self.top_right = top_right
        self.colour = colour

    def intersects(self, other):
Run Code Online (Sandbox Code Playgroud)

我试图看看两个矩形是否基于右上角和左下角相交,但是当我创建函数时:

def intersects(self, other):
    return self.top_right.x>=other.top_right.x>=self.bottom_left.x and self.top_right.x>=other.bottom_left.x>=self.bottom_left.x and self.top_right.y>=other.top_right.y>=self.bottom_left.y and self.top_right.x>=other.bottom_left.x>=self.bottom_left.x
Run Code Online (Sandbox Code Playgroud)

输入时该函数将返回false:

r1=Rectangle(Point(1,1), Point(2,2), 'blue')
r3=Rectangle(Point(1.5,0), Point(1.7,3), 'red')
r1.intersects(r3)
Run Code Online (Sandbox Code Playgroud)

进壳.

python python-3.x

10
推荐指数
2
解决办法
1万
查看次数

标签 统计

intellij-idea ×1

java ×1

macos ×1

python ×1

python-3.x ×1