I'm not sure the functions will still return the correct screen coordinates. For now it builds, I will add tests in the next commits.
30 lines
1.1 KiB
C++
30 lines
1.1 KiB
C++
namespace dkh {
|
|
template <typename T, typename T1>
|
|
inline
|
|
dk::Vector<2> get_diamond_coordinates (const dk::TileIterator<T, 2, T1>& parIterator, const dk::Vector<2>& parSize) {
|
|
typedef dk::Vector<2> vec;
|
|
|
|
const auto from(parIterator.position());
|
|
const dk::CoordinateScalarType xoffs = from.y() % 2;
|
|
|
|
return from * parSize + vec(xoffs * parSize.x() / 2, 0);
|
|
}
|
|
|
|
template <typename T, typename T1>
|
|
inline
|
|
dk::Vector<2> get_half_diamond_coordinates (const dk::TileIterator<T, 2, T1>& parIterator, const dk::Vector<2>& parSize) {
|
|
typedef dk::Vector<2> vec;
|
|
return get_diamond_coordinates(parIterator, parSize / vec(1, 2));
|
|
}
|
|
|
|
template <uint32_t D, typename T, typename T1>
|
|
inline
|
|
dk::Vector<D> get_square_coordinates (const dk::TileIterator<T, D, T1>& parIterator, const dk::Vector<D>& parSize) {
|
|
return parIterator.position() * parSize;
|
|
}
|
|
|
|
//template <typename T, typename T1>
|
|
//inline
|
|
//dk::Vector<dk::CoordinateScalarType, 2> get_hex_coordinates (const dk::TileIterator<T, 2, T1>& parIterator, const dk::Vector<dk::CoordinateScalarType, 2>& parSize) {
|
|
//}
|
|
} //namespace dkh
|