Пример #1
0
    def unitized(self):
        """Returns a quaternion with a unit-length.

        Examples
        --------
        >>> q = Quaternion(1.0, 1.0, 1.0, 1.0)
        >>> q.is_unit
        False
        >>> p = q.unitized()
        >>> p.is_unit
        True
        """
        qu = quaternion_unitize(self)
        return Quaternion(*qu)
Пример #2
0
    def unitize(self):
        """Scales the quaternion to make it unit-length.

        Examples
        --------
        >>> q = Quaternion(1.0, 1.0, 1.0, 1.0)
        >>> q.is_unit
        False
        >>> q.unitize()
        >>> q.is_unit
        True
        """
        qu = quaternion_unitize(self)
        self.w, self.x, self.y, self.z = qu
Пример #3
0
    def unitized(self):
        """Returns a quaternion with a unit-length.

        Returns
        -------
        :class:`compas.geometry.Quaternion`

        Examples
        --------
        >>> q = Quaternion(1.0, 1.0, 1.0, 1.0)
        >>> q.is_unit
        False
        >>> p = q.unitized()
        >>> p.is_unit
        True

        """
        qu = quaternion_unitize(self)
        return Quaternion(*qu)
Пример #4
0
 def unitized(self):
     """Returns a :obj:`Quaternion` with a unit-length.
     """
     qu = quaternion_unitize(self)
     return Quaternion(*qu)
Пример #5
0
 def unitize(self):
     """Scales the quaternion to make it unit-length.
     """
     qu = quaternion_unitize(self)
     self.w, self.x, self.y, self.z = qu