def euler_angles(self, static=True, axes='xyz'): """Returns Euler angles from the ``Rotation`` according to specified axis sequence and rotation type. Parameters ---------- static : bool, optional If true the rotations are applied to a static frame. If not, to a rotational. Defaults to True. axes : str, optional A 3 character string specifying the order of the axes. Defaults to 'xyz'. Returns ------- list of float: The 3 Euler angles. Examples -------- >>> ea1 = 1.4, 0.5, 2.3 >>> args = False, 'xyz' >>> R1 = Rotation.from_euler_angles(ea1, *args) >>> ea2 = R1.euler_angles(*args) >>> allclose(ea1, ea2) True """ return euler_angles_from_matrix(self.matrix, static, axes)
def euler_angles(self, static=True, axes='xyz'): """The Euler angles from the rotation given by the frame. Parameters ---------- static : :obj:`bool`, optional If true the rotations are applied to a static frame. If not, to a rotational. Defaults to True. axes : :obj:`str`, optional A 3 character string specifying the order of the axes. Defaults to 'xyz'. Returns ------- :obj:`list` of :obj:`float` Three numbers that represent the angles of rotations about the defined axes. Examples -------- >>> from compas.geometry import Frame >>> ea1 = 1.4, 0.5, 2.3 >>> f = Frame.from_euler_angles(ea1, static = True, axes = 'xyz') >>> ea2 = f.euler_angles(static = True, axes = 'xyz') >>> allclose(ea1, ea2) True """ R = matrix_from_basis_vectors(self.xaxis, self.yaxis) return euler_angles_from_matrix(R, static, axes)
def euler_angles(self, static=True, axes='xyz'): """Returns Euler angles from the rotation according to specified axis sequence and rotation type. Parameters ---------- static : bool, optional If True the rotations are applied to a static frame. If False, to a rotational. axes : str, optional A 3 character string specifying the order of the axes. Returns ------- [float, float, float] The 3 Euler angles. Examples -------- >>> from compas.geometry import allclose >>> ea1 = 1.4, 0.5, 2.3 >>> args = False, 'xyz' >>> R1 = Rotation.from_euler_angles(ea1, *args) >>> ea2 = R1.euler_angles(*args) >>> allclose(ea1, ea2) True """ return euler_angles_from_matrix(self.matrix, static, axes)
def test_euler_angles_from_matrix(): ea1 = 1.4, 0.5, 2.3 args = True, 'xyz' R = matrix_from_euler_angles(ea1, *args) ea2 = euler_angles_from_matrix(R, *args) assert np.allclose(ea1, ea2)