萌新在写计算几何求两向量夹角的时候分别用了 atan2 和点乘 + acos 求,结果 atan2 喜提WA ,用点乘 + acos 就过了,不太清楚为什么 atan2 会错,求帮看代码。。。/bx
db dis(pair<ll, ll> x) { return sqrt(x.fi * x.fi + x.se * x.se); }
db ang(pair<ll, ll> x, pair<ll, ll> y)
{ return acos((db)(x.fi * y.fi + x.se * y.se) / dis(x) / dis(y)); }
db ang(pair<ll, ll> x, pair<ll, ll> y)
{ return fabs(atan2(x.se, x.fi) - atan2(y.se, y.fi)); }
/bx/bx/bx