double InitTangentLineY (const Vect2& s, const double D, const int eps) { // double x; double y; double sq_s = s.sqv(); double sq_D = sq(D); if (Util::almost_equals(sq_s,sq_D)) { // x = eps*s.y; y = -eps*s.x; } else { Vect2 q = TangentLine::Q(s,D,eps); // x = q.x; y = q.y; if (!q.isZero()) { // x -= s.x; y -= s.y; } } return y; }
double TCAS2D::nominal_tau(double B, double T, const Vect2& s, const Vect2& v, double rr) { if (v.isZero()) return B; return std::max(B,std::min(T,-s.dot(v) / v.sqv()-rr/2)); }