def test_active_matrices_from_intrinsic_euler_angles_1dim(): random_state = np.random.RandomState(8384) e = random_state.randn(10, 3) Rs = pbr.active_matrices_from_intrinsic_euler_angles(2, 1, 0, e) for i in range(len(e)): Ri = pr.active_matrix_from_intrinsic_euler_zyx(e[i]) assert_array_almost_equal(Rs[i], Ri)
def test_active_matrices_from_intrinsic_euler_angles_3dims(): random_state = np.random.RandomState(8385) e = random_state.randn(2, 3, 4, 3) Rs = pbr.active_matrices_from_intrinsic_euler_angles(2, 1, 0, e).reshape(-1, 3, 3) e = e.reshape(-1, 3) for i in range(len(e)): Ri = pr.active_matrix_from_intrinsic_euler_zyx(e[i]) assert_array_almost_equal(Rs[i], Ri)
def test_active_matrices_from_intrinsic_euler_angles_1dim_output_variables(): random_state = np.random.RandomState(8384) e = random_state.randn(10, 3) Rs = np.empty((10, 3, 3)) pbr.active_matrices_from_intrinsic_euler_angles(2, 1, 0, e, out=Rs) for i in range(len(e)): Ri = pr.active_matrix_from_intrinsic_euler_zyx(e[i]) assert_array_almost_equal(Rs[i], Ri)
from pytransform3d import rotations as pr ax = pr.plot_basis(R=np.eye(3), ax_s=2, lw=3) axis = 2 angle = np.pi p = np.array([1.0, 1.0, 1.0]) euler = [0, 0, 0] euler[axis] = angle R = pr.active_matrix_from_intrinsic_euler_xyz(euler) pr.plot_basis(ax, R, p) p = np.array([-1.0, 1.0, 1.0]) euler = [0, 0, 0] euler[2 - axis] = angle R = pr.active_matrix_from_intrinsic_euler_zyx(euler) pr.plot_basis(ax, R, p) p = np.array([1.0, 1.0, -1.0]) R = pr.active_matrix_from_angle(axis, angle) pr.plot_basis(ax, R, p) p = np.array([1.0, -1.0, -1.0]) e = [pr.unitx, pr.unity, pr.unitz][axis] a = np.hstack((e, (angle, ))) R = pr.matrix_from_axis_angle(a) pr.plot_basis(ax, R, p) pr.plot_axis_angle(ax, a, p) p = np.array([-1.0, -1.0, -1.0]) q = pr.quaternion_from_axis_angle(a)
def test_active_matrices_from_intrinsic_euler_angles_0dims(): random_state = np.random.RandomState(8383) e = random_state.randn(3) R = pbr.active_matrices_from_intrinsic_euler_angles(2, 1, 0, e) R2 = pr.active_matrix_from_intrinsic_euler_zyx(e) assert_array_almost_equal(R, R2)