示例#1
0
    def _update_text_box(self, msg):
        expected = [self._expected_points[p] for p in [1, 2, 3]]
        actual = [self.actual_points[p] for p in [1, 2, 3]]
        points = '\n'.join([
            # Highlight point being calibrated
            # Display actual and expected coordinates
            ('* ' if self._current_point == point else '') +
            "{0} {1}".format(coord[0], coord[1])
            for point, coord in enumerate(zip(actual, expected))
        ])

        text = '\n'.join([
            points, 'World: {}'.format(
                apply_transform(inv(self.current_transform),
                                self.current_position)),
            'Step: {}'.format(self.current_step()), 'Message: {}'.format(msg)
        ])

        self._status_text_box.set_text(text)
示例#2
0
def test_apply_transform():
    x = 1
    y = 2
    z = 3

    x_delta = -0.1
    y_delta = -0.2
    z_delta = 0.3

    transform = [
        [1, 0, 0, x_delta],
        [0, 1, 0, y_delta],
        [0, 0, 1, z_delta],
        [0, 0, 0, 1]]

    expected = (
        round(x - x_delta, 2),
        round(y - y_delta, 2),
        round(z - z_delta, 2))

    result = apply_transform(inv(transform), (x, y, z))
    assert result == expected