Cheap algorithm to find measure of angle between vectors

前端 未结 9 1613
旧时难觅i
旧时难觅i 2020-12-13 01:02

Finding the angle between two vectors is not hard using the cosine rule. However, because I am programming for a platform with very limited resources, I would like to avoid

9条回答
  •  余生分开走
    2020-12-13 01:20

    if you need to compute the square root, then consider using the invsqrt hack.

    acos((x1*x2 + y1*y2) * invsqrt((x1*x1+y1*y1)*(x2*x2+y2*y2)));
    

提交回复
热议问题