Closed oleg-alexandrov closed 10 months ago
Also note that tweaked version in cam_gen.cc, which is an improvement but not enough. Once the main code is fixed, the fork in cam_gen.cc needs to be removed and the main code should be used instead.
This algorithm got replaced by a root-finding algorithm (secant method). The new method is also faster.
The function for intersecting a ray with a DEM minimizes the distance from a point on the ray to its vertical projection onto the DEM. I managed to find a situation where it was stuck in a local minimum, presumably on a high hill the closest local distance from the ray to the DEM was achieved, though if one keeps on traveling on the ray, for a while the distance from the ray to the DEM will increase again, and then it will decrease to 0 when the ray intersects it. Need to use here an algorithm for solving f(x) = 0 rather than for minimizing f(x)^2.