Updates:
        Cc: smi...@gmail.com

Comment #6 on issue 2360 by asmeurer: Bug in geometry intersection
http://code.google.com/p/sympy/issues/detail?id=2360

The problem is in Segment.__contains__ at the very bottom of line.py, which is copied below:

    def __contains__(self, o):
        """Is the other GeometryEntity contained within this Ray?"""
        if 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):
                d = self.length
if Point.distance(self.p1,o) <= d and Point.distance(self.p2,o) <= d:
                    return True

        # No other known entity can be contained in a Ray
        return False

The inequalities in that last if statement are being evaluated to symbolic Le()'s. It really should be checking is_nonnegative or something. Unfortunately, it can't seem to handle the particular symbol expression for this example, even after simplifying.

By the way, the code that used to be there, before the above commit that first broke it was:

    def __contains__(self, o):
        if 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):
                x1,x2 = self._p1[0], self._p2[0]
if (not x1.atoms(type=Basic.Symbol)) and (not x2.atoms(type=Basic.Symbol)):
                    return (min(x1,x2) <= o[0] <= max(x1,x2))
                else:
                    return True
            else:
                return False
        else:
            return False

Which worked fine, at least for this example.

Any ideas?

--
You received this message because you are subscribed to the Google Groups 
"sympy-issues" group.
To post to this group, send email to sympy-issues@googlegroups.com.
To unsubscribe from this group, send email to 
sympy-issues+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sympy-issues?hl=en.

Reply via email to