Sorting a 2D quadrangle mesh

On 14/06/2014 at 01:48, xxxxxxxx wrote:

Does anyone here know of any algorithms or code that can speedily reassemble a mesh comprised of square quadrangles in RAM? I'm trying to take a grid-like mesh and split it into rows and columns. Since the point order isn't guaranteed to be in any kind of sequence at all, this isn't as simple as just iterating over the polygons in order (since the polygon orders are randomized too).

I've been searching high and low for some sort of solution to this, and I can't find anything that would even suggest someone has had to tackle this problem before. To clarify, what I have is a mesh that is equivalent to what you'd get out of a Plane object- but the point indices are all totally scrambled. I need to "reassemble" this mesh in RAM somehow so that I can address things by rows and columns in sequence (ie, row 1 = [1, 2, 3, 8, 7, 6, 5, 4, 10 11, 12, 14], etc).


On 14/06/2014 at 11:04, xxxxxxxx wrote:


you can "jump over the edge" from one polygon to another (ie. run over a polygon loop).
You could use that to re-order the polygons. This is only simple to accomplish when the 
structure really is the same as for a plane object.