Got inference rule-style addCurve working. It is full of kludges and unnecessary object creation/copying etc, but takes the operation from 2^n to n^2 (after a cleanup).