int main(int argc, char **argv) { if (argc == 1) { interactive(); } else { parametric(argc, argv); } return 0; }
GeoPoint solve() { // find approx solution first, being the offset for the local function // minimiser search p_offset = fixed_zero; fixed f_best= f(fixed_zero); for (; p_offset < fixed_one; p_offset += fixed(0.25)) { fixed ff = f(fixed_zero); if (ff< f_best) { f_best = ff; } } // now detailed search, returning result return parametric(find_min(fixed_zero)); }
virtual fixed f(const fixed p) { return ::DoubleDistance(loc_from, parametric(p), loc_to); }
fixed f(const fixed p) { return ::DoubleDistance(m_loc_from,parametric(p),m_loc_to); }