2015-08-17 13:39:28 +00:00
|
|
|
namespace dk {
|
2015-05-24 15:17:53 +00:00
|
|
|
template <typename T, typename T1>
|
|
|
|
inline
|
2015-06-06 11:52:48 +00:00
|
|
|
dk::Vector<2> get_diamond_coordinates (const dk::TileIterator<T, 2, T1>& parIterator, const dk::Vector<2>& parSize) {
|
|
|
|
typedef dk::Vector<2> vec;
|
2015-05-24 15:17:53 +00:00
|
|
|
|
2015-08-17 11:36:47 +00:00
|
|
|
const auto from(parIterator.position());
|
|
|
|
const dk::CoordinateScalarType xoffs = from.y() % 2;
|
2015-05-24 15:17:53 +00:00
|
|
|
|
2015-08-17 11:36:47 +00:00
|
|
|
return from * parSize + vec(xoffs * parSize.x() / 2, 0);
|
2015-05-24 15:17:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
template <typename T, typename T1>
|
|
|
|
inline
|
2015-06-06 11:52:48 +00:00
|
|
|
dk::Vector<2> get_half_diamond_coordinates (const dk::TileIterator<T, 2, T1>& parIterator, const dk::Vector<2>& parSize) {
|
|
|
|
typedef dk::Vector<2> vec;
|
2015-05-24 15:17:53 +00:00
|
|
|
return get_diamond_coordinates(parIterator, parSize / vec(1, 2));
|
|
|
|
}
|
|
|
|
|
2015-08-17 11:36:47 +00:00
|
|
|
template <uint32_t D, typename T, typename T1>
|
2015-05-24 15:17:53 +00:00
|
|
|
inline
|
2015-06-06 11:52:48 +00:00
|
|
|
dk::Vector<D> get_square_coordinates (const dk::TileIterator<T, D, T1>& parIterator, const dk::Vector<D>& parSize) {
|
2015-08-17 11:36:47 +00:00
|
|
|
return parIterator.position() * parSize;
|
2015-05-24 15:17:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//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) {
|
|
|
|
//}
|
2015-08-17 13:39:28 +00:00
|
|
|
} //namespace dk
|