Linear Algebra and the C Language/a0c3


The coefficients of a conic with the QR Decomposition

I use QR_mR(); to calculate the coefficients of a conic.


Presentation :
 Find the coefficients a, b, c, d, e of the conic,
      
      ax**2 + by**2 + cx + dy + e  = 0 
          
    which crosses these four points   
         
      (x[1],y[1])  (x[2],y[2])  (x[3],y[3])  (x[4],y[4]) 
      
 Using the four points we obtain the matrix.
 
 (a)x**2   (b)y**2   (c)x      (d)y        (e) = 0               
    x[1]**2   y[1]**2   x[1]      y[1]      1    0
    x[2]**2   y[2]**2   x[2]      y[2]      1    0
    x[3]**2   y[3]**2   x[3]      y[3]      1    0
    x[4]**2   y[4]**2   x[4]      y[4]      1    0
    
 This system has four lines and five unknowns (a, b, c, d, e).
 It is a homogeneous system, so it has an infinite number of solutions.
 
 To find a solution, I chose to set a = 1.
 We therefore have five rows and five unknowns.

    1         0         0         0         0    1 
    x[1]**2   y[1]**2   x[1]      y[1]      1    0 
    x[2]**2   y[2]**2   x[2]      y[2]      1    0 
    x[3]**2   y[3]**2   x[3]      y[3]      1    0 
    x[4]**2   y[4]**2   x[4]      y[4]      1    0 

  All that remains is to solve the system.