def from_axis_angle_vector(cls, axis_angle_vector, point=[0, 0, 0]): """Construct a frame from an axis-angle vector representing the rotation. Parameters ---------- axis_angle_vector : :obj:`list` of :obj:`float` Three numbers that represent the axis of rotation and angle of rotation by its magnitude. point : :obj:`list` of :obj:`float`, optional The point of the frame. Defaults to [0, 0, 0]. Returns ------- Frame The constructed frame. Examples -------- >>> from compas.geometry import Frame >>> aav1 = [-0.043, -0.254, 0.617] >>> f = Frame.from_axis_angle_vector(aav1, point = [0, 0, 0]) >>> aav2 = f.axis_angle_vector >>> allclose(aav1, aav2) True """ R = matrix_from_axis_angle_vector(axis_angle_vector) xaxis, yaxis = basis_vectors_from_matrix(R) return cls(point, xaxis, yaxis)
def test_axis_angle_vector_from_matrix(): aav1 = [-0.043, -0.254, 0.617] R = matrix_from_axis_angle_vector(aav1) aav2 = axis_angle_vector_from_matrix(R) assert allclose(aav1, aav2)