36 lines
590 B
C++
36 lines
590 B
C++
#include "precompile.h"
|
|
|
|
#include <math.h>
|
|
|
|
#include "metamgr.h"
|
|
#include "human.h"
|
|
|
|
float Position::Distance2D(a8::Vec2 pos)
|
|
{
|
|
return pos.Distance(ToVec2());
|
|
}
|
|
|
|
float Position::Distance2D2(const Position& pos)
|
|
{
|
|
return Distance2D(pos.ToVec2());
|
|
}
|
|
|
|
float Position::ManhattanDistance2D(const Position& target_pos)
|
|
{
|
|
return ToVec2().ManhattanDistance(target_pos.ToVec2());
|
|
}
|
|
|
|
a8::Vec2 Position::CalcDir2D(const Position& target_pos)
|
|
{
|
|
return target_pos.ToVec2() - ToVec2();
|
|
}
|
|
|
|
|
|
a8::Vec2 Position::ToVec2() const
|
|
{
|
|
a8::Vec2 v2;
|
|
v2.x = x;
|
|
v2.y = y;
|
|
return v2;
|
|
}
|