% solves the eikonal equation in 2D: 

% abs(grad(T(x, y))) = F(x, y)

% employs iteration



HUGE = 10000.0;

m = 10;

n = 10;



% ititialization

T = HUGE * ones(m, n);

T(1, 1) = 0.0;



%F = ones(m, n);

for i=1:m,

   for j=1:n,

      dtds = i/j;

      F(i,j) = abs(k2*dtds - k1) + lambda*abs(dtds - 1);

   end

end



for iter = 1:m*n,

   for i = 1:m,

      for j = 1:n,

         T(i, j) = solveQuadratic(T, F, i, j, m, n);

      end

   end

end