コード例 #1
0
    def test_camera_rotation(self):
        viewer = IntegrableViewer()

        # Rotate camera
        rotation = [90.0, 10.0, 45.0]

        assert self.equal_list([0.0, 0.0, 0.0], viewer.get_rotation_angle())
        viewer.rotate(*rotation)
        assert self.equal_list([90.0, 10.0, 45.0], viewer.get_rotation_angle())
        viewer.rotate(*rotation)
        assert self.equal_list([180.0, 20.0, 90.0],
                               viewer.get_rotation_angle())

        viewer.set_rotation_angle(rotation)
        assert self.equal_list(rotation, viewer.get_rotation_angle())
コード例 #2
0
    def test_angles_from_vectors(self):
        viewer = IntegrableViewer()

        # Make the normal face the camera
        default = [0.0, 0.0, 0.0]
        expected = [-90.0, 0.0, -90.0]

        normal = [1.0, 0.0, 0.0]
        up = [0.0, 0.0, 1.0]
        angles = viewer.angles_from_vectors(normal, up)
        assert self.equal_list(expected, angles)

        assert self.equal_list(default, viewer.get_rotation_angle())
        viewer.set_camera_from_vectors(normal, up)
        assert self.equal_list(expected, viewer.get_rotation_angle())