<-- Previous || Up || Next -->

Lines Intersect Function
Math Geometry Class

Public Function LinesIntersect( _
      ByVal vLine1 As Variant _
    , ByVal vLine2 As Variant _
    ) As Boolean

Determine if two lines intersect each other.

Summary: Function returns True if the lines intersect. Function returns False if the lines do not intersect. Common endpoints are considered intersection. vLineN(LBound(vLineN)) contains another array of Variants with the first point and vLineN(UBound(vLineN)) contains another array of Variants with the second point. Adapted from Algorithms in C by Robert Sedgewick.
Example:
    Assuming
       Dim varLine1 As Variant
       Dim varLine2 As Variant
       varLine1 = MakeLine(0, 1, 4, 2)
       varLine2 = MakeLine(0, -1, 4, 4)
    for example
       LinesIntersect(varLine1, varLine2) = True
See also:
    LinesCounterClockwise Function
    MakeLine Function
vLine1: First of the two line segments that are checked to see if they intersect. vLine1 is assumed to be a Variant that contains a one-dimensional array of "points" where the lower-bound element represents one point and the upper-bound element represents another. Each "point" is in turn a one-dimensional array of Variant values where the lower-bound element represents the X coordinate and the upper-bound element represents the Y coordinate.
vLine2: Second of the two line segments that are checked to see if they intersect. vLine1 is assumed to be a Variant that contains a one-dimensional array of "points" where the lower-bound element represents one point and the upper-bound element represents another. Each "point" is in turn a one-dimensional array of Variant values where the lower-bound element represents the X coordinate and the upper-bound element represents the Y coordinate.

Copyright 1996-1999 Entisoft
Entisoft Tools is a trademark of Entisoft.