def testAngle1(self): import math for angle in [0, 45, 90, 135, 180, 225, 270]: dx = 100 * math.cos(angle / 180 * math.pi) dy = 100 * math.sin(angle / 180 * math.pi) p1xy = [100, 200] p2xy = [p1xy[0] + dx, p1xy[1] + dy] line = Line(p1xy, p2xy) self.assertAlmostEqual(line.angle(), angle)
def testRotate2(self): L1 = Line((20, 30), (0, 10)) L2 = L1.rotate(-226) self.assertAlmostEqual(L1.angle(), 225) self.assertAlmostEqual(L2.angle(), 359)
def testRotate1(self): L1 = Line((20, 30), (20, 10)) L2 = L1.rotate(33) self.assertAlmostEqual(L1.angle(), 270) self.assertAlmostEqual(L2.angle(), 303)