Example #1
0
    def quaternion(self):
        """Returns the Quaternion from the ``Rotation``.

        Returns
        -------
        :class:`Quaternion`

        Examples
        --------
        >>> q1 = [0.945, -0.021, -0.125, 0.303]
        >>> R = Rotation.from_quaternion(q1)
        >>> q2 = R.quaternion
        >>> allclose(q1, q2, tol=1e-3)
        True
        """
        from compas.geometry.primitives import Quaternion
        return Quaternion(*quaternion_from_matrix(self.matrix))
Example #2
0
 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))
Example #3
0
 def quaternion(self):
     """:class:`Quaternion` : The quaternion from the rotation given by the frame.
     """
     rotation = matrix_from_basis_vectors(self.xaxis, self.yaxis)
     return Quaternion(*quaternion_from_matrix(rotation))
Example #4
0
 def quaternion(self):
     R = matrix_from_basis_vectors(self.xaxis, self.yaxis)
     return Quaternion(*quaternion_from_matrix(R))