Hmmm, you made me doubt my suggestion. Let's see.
I'm writing this whiling analizing the cases, so I won't know my final conclusion until the end of the post.
The succession of polyline segments are created in 1 of 4 cases. I'm attaching the image describing those 4 cases.
Note: case 4 is the most comon case.
In all cases the point for the end of segment 1 is the same as the start of segment 2, so comparing them won't give us any information. That is why I suggested comparing the start point of segment 1 and the end point of segment 2.
Let's analize the cases:
Let's call the coordinates Seg1Start.X, Seg1Start.Y, Seg2Start.X and Seg2Start.Y.
Case 1:
- The Seg1Start.X is higher than Seg2End.X and Seg1Start.Y lower than Seg2End.Y, that means Seg1Start is to the right and below of Seg2End. Seg2 can be as long as you want. The angle can go from 0 to 180 degrees. If the angle is 0 and if Seg2End and Seg1Start are the same, the result of comparing them would be ambiguous, something that would have to be controlled. If the angle is 180. Seg2End would be left of Seg1Start, making the polyline clockwise. Anything out of that angle range would make Case1 turn into Case3. Case 1 is clockwise.
Case 2:
- Anything out of angle range turns it into Case4. Overlapping of Seg1Start and Seg2End points must be controlled for ambiguity. Case2 is counter-clockwise.
Case 3:
- Anything out of angle range turns it into Case1. Overlapping of Seg1Start and Seg2End points must be controlled for ambiguity. Case3 is counter-clockwise.
Case 4:
- Anything out of angle range turns it into Case2. Overlapping of Seg1Start and Seg2End points must be controlled for ambiguity. Case4 is clockwise.
I might be missing something (validation for weird cases). It's just a quick look at the problem.
Can you take a look at my post about hatches?
I always create threads and no one replies with ideas or advise @.@My hatch post