def euler_angles(self, static=True, axes='xyz'): """The Euler angles from the rotation given by the frame. 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 Three numbers that represent the angles of rotations about the defined axes. Examples -------- >>> 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 test_matrix_from_basis_vectors(): xaxis = [0.68, 0.68, 0.27] yaxis = [-0.67, 0.73, -0.15] R = matrix_from_basis_vectors(xaxis, yaxis) r = [[0.6807833515407016, -0.6687681611113407, -0.29880282253789103, 0.0], [0.6807833515407016, 0.7282315114847181, -0.07882160714891209, 0.0], [0.2703110366411609, -0.14975954908850603, 0.9510541192112079, 0.0], [0.0, 0.0, 0.0, 1.0]] assert allclose(R, r)
def axis_angle_vector(self): """:class:`compas.geometry.Vector` : The axis-angle vector representing the rotation of the frame.""" R = matrix_from_basis_vectors(self.xaxis, self.yaxis) return Vector(*axis_angle_vector_from_matrix(R))
def quaternion(self): """:class:`compas.geometry.Quaternion` : The quaternion from the rotation given by the frame. """ R = matrix_from_basis_vectors(self.xaxis, self.yaxis) return Quaternion(*quaternion_from_matrix(R))
def axis_angle_vector(self): R = matrix_from_basis_vectors(self.xaxis, self.yaxis) return Vector(*axis_angle_vector_from_matrix(R))
def quaternion(self): R = matrix_from_basis_vectors(self.xaxis, self.yaxis) return Quaternion(*quaternion_from_matrix(R))