def test_rotation(self):
        my_obj = self._obj

        # rotation about the y-axis by 90 degree should change the direction vector to x
        my_obj.rotate_y(90, units="deg")
        self.assertTrue(
            np.allclose(my_obj.get_orientation(), cg.Vector(1., 0, 0)))

        # now rotation it about the z-axis 90 degree should have it point to positive y
        my_obj.rotate_z(90, units="deg")
        self.assertTrue(
            np.allclose(my_obj.get_orientation(), cg.Vector(0, 1., 0)))

        # rotation 90 degree about the x-axis should reset it to positive z
        my_obj.rotate_x(90, units="deg")
        self.assertTrue(
            np.allclose(my_obj.get_orientation(), cg.Vector(0, 0, 1.)))
 def test_rotation_units(self):
     # rotations should work for radians and degrees
     rotation_angles = [90, np.pi / 2]
     rotation_units = ["deg", "rad"]
     for angle, unit in zip(rotation_angles, rotation_units):
         self._obj.rotate_y(angle, units=unit).rotate_z(
             angle, units=unit).rotate_x(angle, units=unit)
         self.assertTrue(
             np.allclose(self._obj.get_orientation(), cg.Vector(0, 0, 1.)),
             f"Test Failed for unit {unit}, has orientation {self._obj.get_orientation()}"
         )
 def test_orientation_does_not_scale(self):
     self._obj.scale(100, 100, 100)
     self.assertTrue(
         np.allclose(self._obj.get_orientation(), cg.Vector(0, 0, 1.)))
 def test_object_creation(self):
     # the object should be centered at the origin facing the positive z-axis
     self.assertTrue(
         np.array_equal(self._obj.get_position(), cg.Point(0, 0, 0)))
     self.assertTrue(
         np.array_equal(self._obj.get_orientation(), cg.Vector(0, 0, 1)))
 def setUp(self):
     self.coord = cg.Vector(3, 4, 5)
 def test_rotation_chain(self):
     # rotations should be able to be cascaded
     self._obj.rotate_y(90, units="deg").rotate_z(90, units="deg").rotate_x(
         90, units="deg")
     self.assertTrue(
         np.allclose(self._obj.get_orientation(), cg.Vector(0, 0, 1.)))