예제 #1
0
    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)
예제 #2
0
    def testRotate2(self):
        L1 = Line((20, 30), (0, 10))
        L2 = L1.rotate(-226)

        self.assertAlmostEqual(L1.angle(), 225)
        self.assertAlmostEqual(L2.angle(), 359)
예제 #3
0
    def testRotate1(self):
        L1 = Line((20, 30), (20, 10))
        L2 = L1.rotate(33)

        self.assertAlmostEqual(L1.angle(), 270)
        self.assertAlmostEqual(L2.angle(), 303)