32 lines
1.4 KiB
Text
32 lines
1.4 KiB
Text
|
namespace dkh {
|
||
|
template <typename T, typename T1>
|
||
|
inline
|
||
|
dk::Vector<dk::CoordinateScalarType, 2> get_diamond_coordinates (const dk::TileIterator<T, 2, T1>& parIterator, const dk::Vector<dk::CoordinateScalarType, 2>& parSize) {
|
||
|
typedef dk::Vector<dk::CoordinateScalarType, 2> vec;
|
||
|
|
||
|
const auto abspos(parIterator.abs_position());
|
||
|
const auto from(dk::implem::get_from_from_iterator(parIterator));
|
||
|
const dk::CoordinateScalarType xoffs = abspos.y() % 2;
|
||
|
|
||
|
return (abspos - from) * parSize + vec(xoffs * parSize.x() / 2, 0);
|
||
|
}
|
||
|
|
||
|
template <typename T, typename T1>
|
||
|
inline
|
||
|
dk::Vector<dk::CoordinateScalarType, 2> get_half_diamond_coordinates (const dk::TileIterator<T, 2, T1>& parIterator, const dk::Vector<dk::CoordinateScalarType, 2>& parSize) {
|
||
|
typedef dk::Vector<dk::CoordinateScalarType, 2> vec;
|
||
|
return get_diamond_coordinates(parIterator, parSize / vec(1, 2));
|
||
|
}
|
||
|
|
||
|
template <typename T, uint32_t D, typename T1>
|
||
|
inline
|
||
|
dk::Vector<dk::CoordinateScalarType, D> get_square_coordinates (const dk::TileIterator<T, D, T1>& parIterator, const dk::Vector<dk::CoordinateScalarType, D>& parSize) {
|
||
|
return (parIterator.abs_position() - dk::implem::get_from_from_iterator(parIterator)) * 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
|