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

Lines Counter Clockwise Function
Math Geometry Class

Public Function LinesCounterClockwise( _
      ByVal vPoint0 As Variant _
    , ByVal vPoint1 As Variant _
    , ByVal vPoint2 As Variant _
    ) As Integer

Determine if two line segments which have point vPoint1 in common are clockwise, counter-clockwise, or straight.

Summary: Function returns 1 (one) if the turn from line segment p0...p1 to p1...p2 is counter-clockwise. Function returns -1 if that turn is clockwise. Function returns 0 (zero) if no turn is involved. vPointN(LBound(vPointN)) contains the X coordinate and vPointN(UBound(vPointN)) contains the Y coordinate of each point. Adapted from Algorithms in C by Robert Sedgewick.
Examples:
    LinesCounterClockwise(MakePoint(0, 1), MakePoint(1, 1), MakePoint(1, 0)) = -1
    LinesCounterClockwise(MakePoint(0, 1), MakePoint(0, 2), MakePoint(0, 1)) = 0
    LinesCounterClockwise(MakePoint(0, 1), MakePoint(0, 2), MakePoint(0, 3)) = 1
See also:
    LinesIntersect Function
    MakePoint Function
vPoint0: One of the points on line segment #1. vPoint0 is assumed to be a Variant that contains 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.
vPoint1: The point which both line segments have in common. vPoint1 is assumed to be a Variant that contains 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.
vPoint2: One of the points on line segment #2. vPoint2 is assumed to be a Variant that contains 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.