18 template<Position TILE_SIZE>
35 return toPoint(pos / TILE_SIZE);
42 template<Position TILE_SIZE>
51 return { (xy[1] + xy[0]) * TILE_SIZE[0] / 2.0, (xy[1] - xy[0]) * TILE_SIZE[1] / 2.0 };
60 return toPoint(
Position{ xy_div[0] - xy_div[1] + 0.5, xy_div[0] + xy_div[1] - 0.5 });
68 constexpr Position TILE_SIZE_HALF = TILE_SIZE / 2.0;
69 unsigned sum = size[0] + size[1];
70 return TILE_SIZE_HALF * (
Float)sum;
75 template<Position TILE_SIZE>
84 Position pos = { TILE_SIZE[0] * xy[0] , TILE_SIZE[1] / 2 * xy[1] };
87 pos[0] += TILE_SIZE[0] / 2;
97 constexpr Position TILE_SIZE_HALF = TILE_SIZE / 2.0;
105 Float sp = std::fabs(p1[0] * TILE_SIZE_HALF[1])
106 + std::fabs(p1[1] * TILE_SIZE_HALF[0]);
110 if (p1[0] > 0 && p1[1] > 0)
111 return p +
Point{ 0, 1 };
112 else if (p1[0] < 0 && p1[1] > 0)
113 return p +
Point{ -1, 1 };
114 else if (p1[0] < 0 && p1[1] < 0)
115 return p +
Point{ -1, -1 };
116 else if (p1[0] > 0 && p1[1] < 0)
117 return p +
Point{ 0, -1 };
constexpr Point World2Map(const Position &pos)
世界坐标 -> 地图坐标
constexpr Position Map2World(const Point &xy)
地图坐标 -> 世界坐标
constexpr Position GetSizeBound(const Size &size)
返回包围盒大小,传入地图格子数量
constexpr Position Map2World(const Point &xy)
地图坐标 -> 世界坐标
constexpr Point World2Map(const Position &pos)
世界坐标 -> 地图坐标
constexpr Position GetSize()
constexpr Position Map2World(const Point &xy)
地图坐标 -> 世界坐标
constexpr Point World2Map(const Position &pos)
世界坐标 -> 地图坐标
constexpr auto Mul(const C &container)
求积product
constexpr std::array< Point::value_type, N > toPoint(const std::array< T, N > &a)
转换到Point,已知长度
constexpr std::array< Position::value_type, N > toPosition(const std::array< T, N > &a)
转换到Position,已知长度