예제 #1
0
    def test01(self):
        """Verify diffAngle functionality."""
        self.assertRoughly(PathGeom.diffAngle(0, +0*math.pi/4, 'CW') / math.pi, 0/4.)
        self.assertRoughly(PathGeom.diffAngle(0, +3*math.pi/4, 'CW') / math.pi, 5/4.)
        self.assertRoughly(PathGeom.diffAngle(0, -3*math.pi/4, 'CW') / math.pi, 3/4.)
        self.assertRoughly(PathGeom.diffAngle(0, +4*math.pi/4, 'CW') / math.pi, 4/4.)
        self.assertRoughly(PathGeom.diffAngle(0, +0*math.pi/4, 'CCW')/ math.pi, 0/4.)
        self.assertRoughly(PathGeom.diffAngle(0, +3*math.pi/4, 'CCW')/ math.pi, 3/4.)
        self.assertRoughly(PathGeom.diffAngle(0, -3*math.pi/4, 'CCW')/ math.pi, 5/4.)
        self.assertRoughly(PathGeom.diffAngle(0, +4*math.pi/4, 'CCW')/ math.pi, 4/4.)

        self.assertRoughly(PathGeom.diffAngle(+math.pi/4, +0*math.pi/4,  'CW') / math.pi, 1/4.)
        self.assertRoughly(PathGeom.diffAngle(+math.pi/4, +3*math.pi/4,  'CW') / math.pi, 6/4.)
        self.assertRoughly(PathGeom.diffAngle(+math.pi/4, -1*math.pi/4,  'CW') / math.pi, 2/4.)
        self.assertRoughly(PathGeom.diffAngle(-math.pi/4, +0*math.pi/4,  'CW') / math.pi, 7/4.)
        self.assertRoughly(PathGeom.diffAngle(-math.pi/4, +3*math.pi/4,  'CW') / math.pi, 4/4.)
        self.assertRoughly(PathGeom.diffAngle(-math.pi/4, -1*math.pi/4,  'CW') / math.pi, 0/4.)

        self.assertRoughly(PathGeom.diffAngle(+math.pi/4, +0*math.pi/4, 'CCW') / math.pi, 7/4.)
        self.assertRoughly(PathGeom.diffAngle(+math.pi/4, +3*math.pi/4, 'CCW') / math.pi, 2/4.)
        self.assertRoughly(PathGeom.diffAngle(+math.pi/4, -1*math.pi/4, 'CCW') / math.pi, 6/4.)
        self.assertRoughly(PathGeom.diffAngle(-math.pi/4, +0*math.pi/4, 'CCW') / math.pi, 1/4.)
        self.assertRoughly(PathGeom.diffAngle(-math.pi/4, +3*math.pi/4, 'CCW') / math.pi, 4/4.)
        self.assertRoughly(PathGeom.diffAngle(-math.pi/4, -1*math.pi/4, 'CCW') / math.pi, 0/4.)
예제 #2
0
    def test01(self):
        """Verify diffAngle functionality."""
        self.assertRoughly(
            PathGeom.diffAngle(0, +0 * math.pi / 4, 'CW') / math.pi, 0 / 4.)
        self.assertRoughly(
            PathGeom.diffAngle(0, +3 * math.pi / 4, 'CW') / math.pi, 5 / 4.)
        self.assertRoughly(
            PathGeom.diffAngle(0, -3 * math.pi / 4, 'CW') / math.pi, 3 / 4.)
        self.assertRoughly(
            PathGeom.diffAngle(0, +4 * math.pi / 4, 'CW') / math.pi, 4 / 4.)
        self.assertRoughly(
            PathGeom.diffAngle(0, +0 * math.pi / 4, 'CCW') / math.pi, 0 / 4.)
        self.assertRoughly(
            PathGeom.diffAngle(0, +3 * math.pi / 4, 'CCW') / math.pi, 3 / 4.)
        self.assertRoughly(
            PathGeom.diffAngle(0, -3 * math.pi / 4, 'CCW') / math.pi, 5 / 4.)
        self.assertRoughly(
            PathGeom.diffAngle(0, +4 * math.pi / 4, 'CCW') / math.pi, 4 / 4.)

        self.assertRoughly(
            PathGeom.diffAngle(+math.pi / 4, +0 * math.pi / 4, 'CW') / math.pi,
            1 / 4.)
        self.assertRoughly(
            PathGeom.diffAngle(+math.pi / 4, +3 * math.pi / 4, 'CW') / math.pi,
            6 / 4.)
        self.assertRoughly(
            PathGeom.diffAngle(+math.pi / 4, -1 * math.pi / 4, 'CW') / math.pi,
            2 / 4.)
        self.assertRoughly(
            PathGeom.diffAngle(-math.pi / 4, +0 * math.pi / 4, 'CW') / math.pi,
            7 / 4.)
        self.assertRoughly(
            PathGeom.diffAngle(-math.pi / 4, +3 * math.pi / 4, 'CW') / math.pi,
            4 / 4.)
        self.assertRoughly(
            PathGeom.diffAngle(-math.pi / 4, -1 * math.pi / 4, 'CW') / math.pi,
            0 / 4.)

        self.assertRoughly(
            PathGeom.diffAngle(+math.pi / 4, +0 * math.pi / 4, 'CCW') /
            math.pi, 7 / 4.)
        self.assertRoughly(
            PathGeom.diffAngle(+math.pi / 4, +3 * math.pi / 4, 'CCW') /
            math.pi, 2 / 4.)
        self.assertRoughly(
            PathGeom.diffAngle(+math.pi / 4, -1 * math.pi / 4, 'CCW') /
            math.pi, 6 / 4.)
        self.assertRoughly(
            PathGeom.diffAngle(-math.pi / 4, +0 * math.pi / 4, 'CCW') /
            math.pi, 1 / 4.)
        self.assertRoughly(
            PathGeom.diffAngle(-math.pi / 4, +3 * math.pi / 4, 'CCW') /
            math.pi, 4 / 4.)
        self.assertRoughly(
            PathGeom.diffAngle(-math.pi / 4, -1 * math.pi / 4, 'CCW') /
            math.pi, 0 / 4.)