The linear system solver:
Before and after each pivoting step, the tableau (represented by the arrray a[][], the column vector b[], and the header vectors rowhad[] and colhead[]) determines a set of linear equalities and inequalities among n+m scalar variables: the independent ones x1, x2, ..., xm, each corresponding to one of the m columns of a, and the dependent ones, y1, y2, ..., yn, associated with the rows of a. The LinSolve procedure tries to determine the values of those variables so as to satisfy those equalities and inequalities.
Each variable can be either a point coordinate or a "slack variable". The former is the x- or y-coordinate of some undetermined point p, and is denoted by the corresponding element of rowhead or colhead being of the form [p, x] or [p, y]. A slack variable represents the numerical value of some constraint; for example, the constraint hor (p, q) has numerical value p.y-q.y. The TableauLabel for a slack variable is either [NIL, eq] or [NIL, geq], depending on whether its value must be zero or non-negative for the constraint to be satisfied. For now, geq labels are generated only by the ccw constraint.
At the start of the Newton-Raphson step, all point coordinates are independent variables, and all slack variables are dependent, but this will in general not be true during and after the algorithm. At all times, the tableau can be read as follows: for each row i, we have one equation of the form yi = a[i][1].x1 + a[i][2].x2 + ... + a[i][m].xm + b[i]. In addition, for each variable z (dependent or independent) with label [NIL, eq] we have the equation z=0, and for each one with label [NIL, geq] we have the inequality z geq 0.
The goal of the algorithm is to transform the original tableau into an equivalent one with the property that every row constraint is trivially satisfiable. That is, for every dependent slack variable yi we must have b[i]=0 if rowhead[i].tag=eq, and b[i] geq 0 if rowhead[i].tag=geq. Such a tableau admits the trivial solution xj=0 for j=1..m, and yi=b[i] for i=1..n.
The algorihm achieves this by a sequence of pivoting steps. A pivoting step consists in rewriting the system so that some independent variable xj becomes dependent, and some yi becomes independent (the element a[i][j] is called the pivot for that step). This changes the matrix a and the vector b, so it may change the satisfiablity of other row constraints. The trick is to choose the pivot so that none of the the rows that are already trivially satisfiable ceases to be so, and so that their number is bound to increase after a sufficient number of pivoting steps.