Exemple #1
0
    def transform(self, pointsFromImage, orientation, scale):
        transformedPoints = PointsCloudOperations.scale(pointsFromImage[0], 60 / int(pointsFromImage[1]))

        movedPoints = PointsCloudOperations.move(transformedPoints, -30, -30)

        if orientation == ManchesterSignalInterpreter.EAST:
            rotatedPoints = PointsCloudOperations.rotate(movedPoints, 90)
        elif orientation == ManchesterSignalInterpreter.WEST:
            rotatedPoints = PointsCloudOperations.rotate(movedPoints, 270)
        elif orientation == ManchesterSignalInterpreter.SOUTH:
            rotatedPoints = PointsCloudOperations.rotate(movedPoints, 180)
        else:
            rotatedPoints = PointsCloudOperations.rotate(movedPoints, 0)

        if scale == ManchesterSignalInterpreter.FACTOR_2:
            rotatedPoints = PointsCloudOperations.scale(rotatedPoints, 0.5)
            transformedPoints = PointsCloudOperations.move(rotatedPoints, 30, 30)
        else:
            transformedPoints = PointsCloudOperations.move(rotatedPoints, 30, 30)

        return transformedPoints
Exemple #2
0
    def test_scale_simpleCase_1(self):
        cloud = [(0, 0), (2, 0), (2, 2), (0, 2)]

        self.assertEqual([(0, 0), (1, 0), (1, 1), (0, 1)], PointsCloudOperations.scale(cloud, 0.5))
Exemple #3
0
    def test_scale_simpleCase_4(self):
        cloud = [(103, 90), (254, 78), (691, 690), (3, 4)]

        self.assertEqual([(8.24, 7.2), (20.32, 6.24), (55.28, 55.2), (0.24, 0.32)],
            PointsCloudOperations.scale(cloud, 60 / 750))
Exemple #4
0
    def test_scale_simpleCase_3(self):
        cloud = [(100, 100), (250, 80), (400, 400), (0, 0)]

        self.assertEqual([(15, 15), (37.5, 12), (60, 60), (0, 0)], PointsCloudOperations.scale(cloud, 60 / 400))
Exemple #5
0
    def test_scale_simpleCase_2(self):
        cloud = [(1, 1), (2, 2), (2, 0), (0, 0)]

        self.assertEqual([(2, 2), (4, 4), (4, 0), (0, 0)], PointsCloudOperations.scale(cloud, 2))