The equations for a loop are, of course, similar to the equations for an open curve.
However, they lead to an equation that involves a matrix that is non-diagonal (and not even band-diagonal), because there is an element in every corner.
| b0 c0 0 0 ... . . . a0 |
| a1 b1 c1 0 ... . . . 0 |
| 0 a2 b2 c2 .. . . . 0 |
| . . . . ... . . . . |
| . . . . ... . . . . |
| 0 0 0 0 ... a[n-3] b[n-3] c[n-3] 0 |
| 0 0 0 0 ... 0 a[n-2] b[n-2] c[n-2] |
|c[n-1] 0 0 0 ... 0 0 a[n-1] b[n-1] |
However, there are so many zeros in the matrix, that gaussian elimination can be reduced to a process of order n (in stead of n^{2}).
Read the theory for details.
Or look at the source code for details.
Or you may tinker with the development code to try alternative calculations.