(self, o)
return False
Is other GeometryEntity contained in this Ray?
Is other GeometryEntity contained in this Ray?
Is other GeometryEntity contained in this Ray?
def contains(self, o):
        """Is other GeometryEntity contained in this Ray?"""
        if isinstance(o, Ray):
            return (Point.is_collinear(self.p1, self.p2, o.p1, o.p2) and
                    self.xdirection == o.xdirection and
                    self.ydirection == o.ydirection)
        elif isinstance(o, Segment):
            return o.p1 in self and o.p2 in self
        elif isinstance(o, Point):
            if Point.is_collinear(self.p1, self.p2, o):
                if self.xdirection is S.Infinity:
                    rv = o.x >= self.source.x
                elif self.xdirection is S.NegativeInfinity:
                    rv = o.x <= self.source.x
                elif self.ydirection is S.Infinity:
                    rv = o.y >= self.source.y
                else:
                    rv = o.y <= self.source.y
                if rv == True or rv == False:
                    return bool(rv)
                raise Undecidable(
                    'Cannot determine if %s is in %s' % (o, self))
            else:
                # Points are not collinear, so the rays are not parallel
                # and hence it is impossible for self to contain o
                return False

        # No other known entity can be contained in a Ray
        return False
def contains ( self , o ) : if isinstance ( o , Ray ) : return ( Point . is_collinear ( self . p1 , self . p2 , o . p1 , o . p2 ) and self . xdirection == o . xdirection and self . ydirection == o . ydirection ) elif isinstance ( o , Segment ) : return o . p1 in self and o . p2 in self elif isinstance ( o , Point ) : if Point . is_collinear ( self . p1 , self . p2 , o ) : if self . xdirection is S . Infinity : rv = o . x >= self . source . x elif self . xdirection is S . NegativeInfinity : rv = o . x <= self . source . x elif self . ydirection is S . Infinity : rv = o . y >= self . source . y else : rv = o . y <= self . source . y if rv == True or rv == False : return bool ( rv ) raise Undecidable ( 'Cannot determine if %s is in %s' % ( o , self ) ) else : # Points are not collinear, so the rays are not parallel # and hence it is impossible for self to contain o return False # No other known entity can be contained in a Ray return False