Signature (Visual Basic / VBA)
Public Function LinesCounterClockwise( _
ByVal vPoint0 As Variant _
, ByVal vPoint1 As Variant _
, ByVal vPoint2 As Variant _
) As Integer
Code Example
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
Parameters
| Parameter | Description |
|---|---|
| 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. |
Notes & Version History
| 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. |