This commit is contained in:
aozhiwei 2021-05-14 11:33:13 +08:00
parent 8b6410826d
commit f32b842baf
2 changed files with 4 additions and 4 deletions

View File

@ -66,7 +66,7 @@ namespace a8
y = v[1];
}
float Vec2::CalcAngle(const Vec2& b)
float Vec2::CalcAngle(const Vec2& b) const
{
float a1 = acos(Dot(b) / Norm() / b.Norm());
bool at_right_side = Vec2::RIGHT.Dot(*this) > 0.0001f;
@ -76,7 +76,7 @@ namespace a8
return a1 / 3.1415926f;
}
float Vec2::CalcAngleEx(const Vec2& b)
float Vec2::CalcAngleEx(const Vec2& b) const
{
float a1 = acos(Dot(b) / Norm() / b.Norm());
return a1 / 3.1415926f;

View File

@ -12,8 +12,8 @@ namespace a8
void Normalize();
void Rotate(float angle);
float CalcAngle(const Vec2& b);
float CalcAngleEx(const Vec2& b);
float CalcAngle(const Vec2& b) const;
float CalcAngleEx(const Vec2& b) const;
static Vec2 FromAngle(float angle);
float Distance(const Vec2& b);
float ManhattanDistance(const Vec2& b);