in reply to Help with clockwise
* C \ \ \ * B / / / / * A
and you travel from A to C, whether at B you go "right" or "left". There's a simple formula for that.
Let A, B and C have coordinates (xa,ya), (xb,yb), and (xc,yc).
Then you turn "left" or "counter-clockwise" at B if, and only if, the determinant
| |
| xa - xb xc - xb |
| | =
| ya - yb yc - yb |
| |
(xa - xb) * (yc - yb) - (xc - xb) * (ya - yb)
is negative. If it's positive, you turn "right", or "clockwise". If the
result is 0, you continue in a straight line.
Abigail
|
|---|