53 uint16_t mosaicWidth, uint16_t mosaicHeight) :
54 _topoWidth(topoWidth),
55 _topoHeight(topoHeight),
56 _mosaicWidth(mosaicWidth),
57 _mosaicHeight(mosaicHeight)
61 uint16_t
Map(int16_t x, int16_t y)
const
66 if (x >=
static_cast<int16_t
>(totalWidth))
75 if (y >=
static_cast<int16_t
>(totalHeight))
87 calculate(x, y, &localIndex, &tileOffset);
89 return localIndex + tileOffset;
97 if (x < 0 || x >= totalWidth || y < 0 || y >= totalHeight)
99 return totalWidth * totalHeight;
105 calculate(x, y, &localIndex, &tileOffset);
107 return localIndex + tileOffset;
115 if (x < 0 || x >=
static_cast<int16_t
>(totalWidth) ||
116 y < 0 || y >=
static_cast<int16_t
>(totalHeight))
125 calculate(x, y, &localIndex, &tileOffset);
131 else if (localIndex == (_topoWidth * _topoHeight - 1))
145 return _topoWidth * _mosaicWidth;
150 return _topoHeight * _mosaicHeight;
154 const uint16_t _topoWidth;
155 const uint16_t _topoHeight;
156 const uint16_t _mosaicWidth;
157 const uint16_t _mosaicHeight;
159 void calculate(uint16_t x, uint16_t y, uint16_t* pLocalIndex, uint16_t* pTileOffset)
const
161 uint16_t tileX = x / _topoWidth;
162 uint16_t topoX = x % _topoWidth;
164 uint16_t tileY = y / _topoHeight;
165 uint16_t topoY = y % _topoHeight;
170 tileY) * _topoWidth * _topoHeight;
177 *pLocalIndex = T_LAYOUT::OddRowOddColumnLayout::Map(_topoWidth, _topoHeight, topoX, topoY);
181 *pLocalIndex = T_LAYOUT::EvenRowOddColumnLayout::Map(_topoWidth, _topoHeight, topoX, topoY);
189 *pLocalIndex = T_LAYOUT::OddRowEvenColumnLayout::Map(_topoWidth, _topoHeight, topoX, topoY);
193 *pLocalIndex = T_LAYOUT::EvenRowEvenColumnLayout::Map(_topoWidth, _topoHeight, topoX, topoY);
NeoTopologyHint
Definition: NeoTopology.h:30
@ NeoTopologyHint_LastOnPanel
Definition: NeoTopology.h:33
@ NeoTopologyHint_OutOfBounds
Definition: NeoTopology.h:34
@ NeoTopologyHint_InPanel
Definition: NeoTopology.h:32
@ NeoTopologyHint_FirstOnPanel
Definition: NeoTopology.h:31
Definition: NeoMosaic.h:50
uint16_t Map(int16_t x, int16_t y) const
Definition: NeoMosaic.h:61
NeoMosaic(uint16_t topoWidth, uint16_t topoHeight, uint16_t mosaicWidth, uint16_t mosaicHeight)
Definition: NeoMosaic.h:52
uint16_t getWidth() const
Definition: NeoMosaic.h:143
NeoTopologyHint TopologyHint(int16_t x, int16_t y) const
Definition: NeoMosaic.h:110
uint16_t MapProbe(int16_t x, int16_t y) const
Definition: NeoMosaic.h:92
uint16_t getHeight() const
Definition: NeoMosaic.h:148
static uint16_t Map(uint16_t width, uint16_t, uint16_t x, uint16_t y)
Definition: RowMajorAlternatingLayout.h:53