Edge* pEdge = m_pEdges[axis] + edge;
Edge* pPrev = pEdge - 1;
where m_pEdges[axis] + edge actually means m_pEdges[axis][edge], and
Edge* pPrev = pEdge - 1; is a short way of saying, pPrev = m_pEdges[axis][edge - 1]
This gets two pointers to elements in the edge array(allocation), the pointer to the edge specified by the index passed in and the previous edge.
Then, some operations are done on the edge values.
Then the edge pointers are swapped
Code: Select all
// swap the edges
Edge swap = *pEdge;
*pEdge = *pPrev;
*pPrev = swap;
Code: Select all
// decrement
pEdge--;
pPrev--;
To put it another way,
lets say I have Item0, Item1, Item2 and Item3.
pEdge = Item3;
pPrev = Item2;
if I swap them and decrement using the above code,
is pEdge-- == Item1 or Item0?
is pPrev-- == Item2 or Item1?
Thanks
Teravus