I have an array of structs, these structs are basically two points forming an edge. I use structs because of performance.
Now i have object A holding the edges and a method in this object to tell another object B about a list of consecutive of edges in this edges-array.
Edges:
e0 e1 e2 e3 e4 e5 e6 e7
Possible edges to return:
e0 e1 e2
e6 e7 e0 e1 e2
How would you return the info about the list of edges? They have to be ordered as shown. My problem is the case when the range starts near the end. Otherwise i could just use NSIndexSet. Using arrays seems not to be a good idea in this case because of performance. There will be many points and edges and things with points and edges.
You can store a set of consecutive "wrapping-around" indices as three numbers:
That would be (8, 0, 3)
for your first example e0 e1 e2
, and
(8, 6, 5)
for your second example e6 e7 e0 e1 e2
.