def intersect (self, line):
    """intersect (line) -> Point | None

    Returns the intersection point of this line segment with another.
    If this line segment and the other line segment are conincident,
    the first point on this line segment is returned.  If the line
    segments do not intersect, None is returned.

    See http://local.wasp.uwa.edu.au/~pbourke/geometry/lineline2d/

    Examples:

    >>> A = Line( Point(0.0, 0.0), Point(5.0, 5.0) )
    >>> B = Line( Point(5.0, 0.0), Point(0.0, 5.0) )
    >>> C = Line( Point(1.0, 3.0), Point(9.0, 3.0) )
    >>> D = Line( Point(0.5, 3.0), Point(6.0, 4.0) )
    >>> E = Line( Point(1.0, 1.0), Point(3.0, 8.0) )
    >>> F = Line( Point(0.5, 2.0), Point(4.0, 7.0) )
    >>> G = Line( Point(1.0, 2.0), Point(3.0, 6.0) )
    >>> H = Line( Point(2.0, 4.0), Point(4.0, 8.0) )
    >>> I = Line( Point(3.5, 9.0), Point(3.5, 0.5) )
    >>> J = Line( Point(3.0, 1.0), Point(9.0, 1.0) )
    >>> K = Line( Point(2.0, 3.0), Point(7.0, 9.0) )
    >>> L = Line( Point(1.0, 2.0), Point(5.0, 7.0) )

    >>> A.intersect(B)
    Point(2.5, 2.5)

    >>> C.intersect(D) == None
    True

    >>> E.intersect(F)
    Point(1.8275862069, 3.89655172414)

    >>> G.intersect(H)
    Point(1.0, 2.0)

    >>> I.intersect(J)
    Point(3.5, 1.0)

    >>> K.intersect(L) == None
    True
    """
    (x1, y1)  = (self.p.x, self.p.y)
    (x2, y2)  = (self.q.x, self.q.y)
    (x3, y3)  = (line.p.x, line.p.y)
    (x4, y4)  = (line.q.x, line.q.y)
    denom     = ((y4 - y3) * (x2 - x1)) - ((x4 - x3) * (y2 - y1))
    num1      = ((x4 - x3) * (y1 - y3)) - ((y4 - y3) * (x1 - x3))
    num2      = ((x2 - x1) * (y1 - y3)) - ((y2 - y1) * (x1 - x3))
    intersect = None

    if num1 == 0 and num2 == 0 and denom == 0:    # Coincident lines
      intersect = self.p
    elif denom != 0:                              # Parallel lines (denom == 0)
      ua = float(num1) / denom
      ub = float(num2) / denom
      if ua >= 0.0 and ua <= 1.0 and ub >= 0.0 and ub <= 1.0:
        x = x1 + (ua * (x2 - x1))
        y = y1 + (ua * (y2 - y1))
        intersect = Point(x, y)

    return intersect
intersect (line) -> Point | None

    Returns the intersection point of this line segment with another.
    If this line segment and the other line segment are conincident,
    the first point on this line segment is returned.  If the line
    segments do not intersect, None is returned.

    See http://local.wasp.uwa.edu.au/~pbourke/geometry/lineline2d/

    Examples:

    >>> A = Line( Point(0.0, 0.0), Point(5.0, 5.0) )
    >>> B = Line( Point(5.0, 0.0), Point(0.0, 5.0) )
    >>> C = Line( Point(1.0, 3.0), Point(9.0, 3.0) )
    >>> D = Line( Point(0.5, 3.0), Point(6.0, 4.0) )
    >>> E = Line( Point(1.0, 1.0), Point(3.0, 8.0) )
    >>> F = Line( Point(0.5, 2.0), Point(4.0, 7.0) )
    >>> G = Line( Point(1.0, 2.0), Point(3.0, 6.0) )
    >>> H = Line( Point(2.0, 4.0), Point(4.0, 8.0) )
    >>> I = Line( Point(3.5, 9.0), Point(3.5, 0.5) )
    >>> J = Line( Point(3.0, 1.0), Point(9.0, 1.0) )
    >>> K = Line( Point(2.0, 3.0), Point(7.0, 9.0) )
    >>> L = Line( Point(1.0, 2.0), Point(5.0, 7.0) )

    >>> A.intersect(B)
    Point(2.5, 2.5)

    >>> C.intersect(D) == None
    True

    >>> E.intersect(F)
    Point(1.8275862069, 3.89655172414)

    >>> G.intersect(H)
    Point(1.0, 2.0)

    >>> I.intersect(J)
    Point(3.5, 1.0)

    >>> K.intersect(L) == None
    True