Which way does it turn: cross products and convex hull

The board is a map of the patterns that solve most problems. This lesson adds a small one for points on a flat page: one multiplication that says which way a path turns.
Take a made-up farmer, Ramesh. He has seven wooden pegs in a field and one rope. He wants the rope to go round the outside of all the pegs, pulled tight, so that every peg is inside the rope or on it. Which pegs does the rope actually touch?
A person looks at the pegs and sees the answer. A program has only the peg positions, as pairs of numbers. It cannot look. This lesson gives it one cheap test that works on numbers alone, and builds three things on that test.
By the end you will be able to find which way a path turns, check whether two straight lines cross, find the tight rope round a set of points (the convex hull), and count the most points on one straight line, without ever dividing.
The history (optional)
The method used here to find the rope is called the monotone chain. It was published in 1979 by A. M. Andrew. It is a version of an older method, Graham scan, that sorts the points first. Its running time is O(n log n), and O(n) when the points are already sorted.
Before you start. Fibonacci in forty steps: matrix exponentiation gave you a 2 by 2 table of numbers and the habit of multiplying across and adding up, one cell at a time. The test below is one such cross-multiplication. Foundations #05: Sorting & Searching gave you sorting, and here we sort points by x and then by y. Foundations #04: Hashing (O(1) "yaad") gave you the dictionary, which we use to count points that share a direction. What is near me (geohash cells, and fences by ray casting) counted how many edges a line crosses to tell inside from outside, and here you will test whether two single lines cross.