def testSeStesso(self): self.assertEqual(geo2d.intersect(self.p1, self.p1, True), True) self.assertEqual(geo2d.intersect(self.p1, self.p1, False), False) self.assertEqual(geo2d.intersect(self.p4), True)
def testDiagonale(self): self.p3 = self.p3*geo2d.xlate(P(11,6)) self.assertEqual(geo2d.intersect(self.p1, self.p3), True) self.assertEqual(geo2d.intersect(self.p1, self.p3, False), True)
def testVerticeInComune(self): self.p3 = self.p3*geo2d.xlate(P(10,10)) self.assertEqual(geo2d.intersect(self.p1, self.p3, True), True) self.assertEqual(geo2d.intersect(self.p1, self.p3, False), False)
def testVerticeQuasiInComune(self): self.p3 = self.p3*geo2d.xlate(P(10.00000001,10.00000001)) self.assertEqual(geo2d.intersect(self.p1, self.p3), False)
def testLatoQuasiSuLato(self): self.p2 = self.p2*geo2d.xlate(P(0,-0.99999999)) self.assertEqual(geo2d.intersect(self.p1, self.p2), False)
def testLatoSuLato(self): self.p2 = self.p2*geo2d.xlate(P(0,-1)) self.assertEqual(geo2d.intersect(self.p1, self.p2, False), False) self.assertEqual(geo2d.intersect(self.p1, self.p2, True), True)
def testVerticiQuasiSuLato(self): self.p2 = self.p2*geo2d.xlate(P(-0.9999999,0)) self.assertEqual(geo2d.intersect(self.p1, self.p2), False)
def testVerticiSuLato(self): self.p2 = self.p2*geo2d.xlate(P(-1,0)) self.assertEqual(geo2d.intersect(self.p1, self.p2), True) self.assertEqual(geo2d.intersect(self.p1, self.p2, False), False)
def testIntersect(self): """Quadrato aperto dentro quadrato chiuso""" self.assertEqual(geo2d.intersect(self.p1, self.p2), False)