def test_from_basis_vectors(): xaxis = [0.68, 0.68, 0.27] yaxis = [-0.67, 0.73, -0.15] R = Rotation.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 np.allclose(R, r)
"""There are several ways to construct a `Rotation`. """ import math from compas.geometry import Frame from compas.geometry import Rotation R = Rotation.from_axis_and_angle([1, 0, 0], math.radians(30)) R = Rotation.from_axis_and_angle([1, 0, 0], math.radians(30), point=[1, 0, 0]) R = Rotation.from_basis_vectors([0.68, 0.68, 0.27], [-0.67, 0.73, -0.15]) R = Rotation.from_frame(Frame([1, 1, 1], [0.68, 0.68, 0.27], [-0.67, 0.73, -0.15])) R = Rotation.from_axis_angle_vector([-0.043, -0.254, 0.617]) R = Rotation.from_quaternion([0.945, -0.021, -0.125, 0.303]) R = Rotation.from_euler_angles([1.4, 0.5, 2.3], static=True, axes='xyz') print(R)