function [a0 a1 a2 a3 a4] = p3p_polynom( d12, d23, d31, c12, c23, c31 )
%P3P_POLYNOM  Coefficients of polynom for calibrated camera pose estimation.
%
%  [a0 a1 a2 a3 a4] = p3p_polynom( d12, d23, d31 )

% (c) 2011, Tomas Pajdla
% Last change: $Date::                            $
%              $Revision$

a4 = -4*d23^4*d12^2*d31^2*c23^2+d23^8-2*d23^6*d12^2-2*d23^6*d31^2+d23^4*d12^4+2*d23^4*d12^2*d31^2+d23^4*d31^4;

a3 = 8*d23^4*d12^2*d31^2*c12*c23^2+4*d23^6*d12^2*c31*c23-4*d23^4*d12^4*c31*c23+4*d23^4*d12^2*d31^2*c31*c23-4*d23^8*c12+4*d23^6*d12^2*c12+8*d23^6*d31^2*c12-4*d23^4*d12^2*d31^2*c12-4*d23^4*d31^4*c12;

a2 = -8*d23^6*d12^2*c31*c12*c23-8*d23^4*d12^2*d31^2*c31*c12*c23+4*d23^8*c12^2-4*d23^6*d12^2*c31^2-8*d23^6*d31^2*c12^2+4*d23^4*d12^4*c31^2+4*d23^4*d12^4*c23^2-4*d23^4*d12^2*d31^2*c23^2+4*d23^4*d31^4*c12^2+2*d23^8-4*d23^6*d31^2-2*d23^4*d12^4+2*d23^4*d31^4;

a1 = 8*d23^6*d12^2*c31^2*c12+4*d23^6*d12^2*c31*c23-4*d23^4*d12^4*c31*c23+4*d23^4*d12^2*d31^2*c31*c23-4*d23^8*c12-4*d23^6*d12^2*c12+8*d23^6*d31^2*c12+4*d23^4*d12^2*d31^2*c12-4*d23^4*d31^4*c12;

a0 = -4*d23^6*d12^2*c31^2+d23^8-2*d23^4*d12^2*d31^2+2*d23^6*d12^2+d23^4*d31^4+d23^4*d12^4-2*d23^6*d31^2; 
