未验证 提交 b49688eb 编写于 作者: cocos2d-lua.org's avatar cocos2d-lua.org 提交者: GitHub

optimization cc.pGetAngle()

上级 994b5820
......@@ -74,14 +74,7 @@ function cc.pToAngleSelf(self)
end
function cc.pGetAngle(self,other)
local a2 = cc.pNormalize(self)
local b2 = cc.pNormalize(other)
local angle = math.atan2(cc.pCross(a2, b2), cc.pDot(a2, b2) )
if math.abs(angle) < 1.192092896e-7 then
return 0.0
end
return angle
return math.atan2(other.y - self.y, other.x - self.x)
end
function cc.pGetDistance(startP,endP)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册