コード例 #1
0
    def test_transform_point_nrot(self):
        cpos = 1, 0
        rot = 0

        pt = 1, 1
        tpt = transform_point(pt, cpos, rot, 1)
        self.assertTupleEqual((2.0, 1.0), tpt)
コード例 #2
0
    def test_transform_point_nrot(self):
        cpos = 1, 0
        rot = 0

        pt = 1, 1
        tpt = transform_point(pt, cpos, rot, 1)
        self.assertTupleEqual((2.0, 1.0), tpt)
コード例 #3
0
    def test_transform_point_ntran_nrot(self):
        cpos = 0, 0
        rot = 0

        pt = 1, 1
        tpt = transform_point(pt, cpos, rot, 1)
        self.assertAlmostEqual(pt, tpt)
コード例 #4
0
    def test_transform_point_ntran_nrot(self):
        cpos = 0, 0
        rot = 0

        pt = 1, 1
        tpt = transform_point(pt, cpos, rot, 1)
        self.assertAlmostEqual(pt, tpt)
コード例 #5
0
    def test_transform_point(self):
        cpos = 1, 0
        rot = 90

        pt = 1, 0
        tpt = transform_point(pt, cpos, rot, 1)

        self.assertAlmostEqual(1.0, tpt[0])
        self.assertAlmostEqual(1.0, tpt[1])
コード例 #6
0
    def test_transform_point(self):
        cpos = 1, 0
        rot = 90

        pt = 1, 0
        tpt = transform_point(pt, cpos, rot, 1)

        self.assertAlmostEqual(1.0, tpt[0])
        self.assertAlmostEqual(1.0, tpt[1])
コード例 #7
0
    def test_transform_point3(self):
        cpos = 1.5, -1.5
        rot = 45

        pt = 1, 0
        tpt = transform_point(pt, cpos, rot, 1)

        r2 = 0.5**0.5
        self.assertAlmostEqual(1.5 + r2, tpt[0])
        self.assertAlmostEqual(-1.5 + r2, tpt[1])
コード例 #8
0
    def test_transform_point2(self):
        cpos = 0, 0
        rot = 45

        pt = 1, 0
        tpt = transform_point(pt, cpos, rot, 1)

        r2 = 0.5**0.5
        self.assertAlmostEqual(r2, tpt[0])
        self.assertAlmostEqual(r2, tpt[1])
コード例 #9
0
    def test_transform_point3(self):
        cpos = 1.5, -1.5
        rot = 45

        pt = 1, 0
        tpt = transform_point(pt, cpos, rot, 1)

        r2 = 0.5 ** 0.5
        self.assertAlmostEqual(1.5 + r2, tpt[0])
        self.assertAlmostEqual(-1.5 + r2, tpt[1])
コード例 #10
0
    def test_transform_point2(self):
        cpos = 0, 0
        rot = 45

        pt = 1, 0
        tpt = transform_point(pt, cpos, rot, 1)

        r2 = 0.5 ** 0.5
        self.assertAlmostEqual(r2, tpt[0])
        self.assertAlmostEqual(r2, tpt[1])
コード例 #11
0
    def test_transform_point4(self):
        cpos = -2.1, -0.3
        rot = 1
        t = math.radians(rot)

        pt = 1, 0
        tpt = transform_point(pt, cpos, rot, 1)

        x = pt[0] * math.cos(t) - pt[1] * math.sin(t)
        y = pt[0] * math.sin(t) + pt[1] * math.cos(t)

        self.assertAlmostEqual(-2.1 + x, tpt[0])
        self.assertAlmostEqual(-0.3 + y, tpt[1])
コード例 #12
0
    def test_transform_point4(self):
        cpos = -2.1, -0.3
        rot = 1
        t = math.radians(rot)

        pt = 1, 0
        tpt = transform_point(pt, cpos, rot, 1)

        x = pt[0] * math.cos(t) - pt[1] * math.sin(t)
        y = pt[0] * math.sin(t) + pt[1] * math.cos(t)

        self.assertAlmostEqual(-2.1 + x, tpt[0])
        self.assertAlmostEqual(-0.3 + y, tpt[1])
コード例 #13
0
ファイル: base_stage_map.py プロジェクト: waffle-iron/pychron
    def map_to_calibration(self, pos, cpos=None, rot=None, scale=None):
        cpos, rot, scale = self._get_calibration_params(cpos, rot, scale)

        return transform_point(pos, cpos, rot, scale)
コード例 #14
0
ファイル: base_stage_map.py プロジェクト: NMGRL/pychron
    def map_to_calibration(self, pos, cpos=None, rot=None, scale=None):
        cpos, rot, scale = self._get_calibration_params(cpos, rot, scale)

        return transform_point(pos, cpos, rot, scale)