如何求向量的角度
www.dimcax.com
如何求向量的角度
,
有2个方向相反的向量,采用如下方求与x轴的角度:
vector2d v1 = new vector2d(0,1);
vector2d v2 = new vector2d(0, -1);
double a1 = v1.getangleto(vector2d.xaxis);
double a2 = v2.getangleto(vector2d.xaxis);
所得结果,2个角度相等。不知其中原因,请指教!
看看帮助:returns the angle between this vector and the vector vector in the range [0, pi].
谢谢回答!原来vector2d有angle属性的。