示例#1
0
 def __rmul__(self, other):
     """
     x.__rmul__(y) <==> y*x
     """
     res = super(ProjectivePoint, self).__rmul__(other)
     if res.is_zero(self._tol):
         msg = 'you have left projective space'
         raise ExitSpaceError(msg)
示例#2
0
    def __init__(self, coordinates, tol=TOL*10):
        super(ProjectivePoint, self).__init__(coordinates)

        if self.is_zero(tol):
            corstr = '[' + ' : '.join([str(c) for c in self._coordinates]) + ']'
            msg = "{0} is not in projective space".format(corstr)
            raise ExitSpaceError(msg)
        self._dim = len(self._coordinates) - 1
        self._tol = tol
示例#3
0
 def __setslice__(self, i, j, sequence):
     """
     x.__setitem__(y, z) <==> x[y] = z
     """
     coordinates = self._coordinates.copy()
     super(ProjectivePoint, self).__setslice__(i, j, sequence)
     if self.is_zero(self._tol):
         self._coordinates = coordinates
         msg = 'you have left projective space'
         raise ExitSpaceError(msg)
示例#4
0
    def __truediv__(self, other):
        """
        x.__truediv__(y) <==> x/y
        """
        res = super(ProjectivePoint, self).__truediv__(other)
        if res.is_zero(self._tol):
            msg = 'you have left projective space'
            raise ExitSpaceError(msg)

        return res