Storage of Irregular Tiles

Monkey Forums/Monkey Programming/Storage of Irregular Tiles

zoqfotpik(Posted 2012) [#1]
Anyone have any ideas for handling irregular 2D meshes?

It's somewhat more subtle than it appears. If you have a square grid, that's fine. If you have a list of irregular polygons that's fine.

But when you start perturbing the vertices in the mesh, you now have a more complicated data structure problem-- polygons must now keep track of which vertices they are associated with.

Just for fun, any ideas of how to accomplish this in a simple way? This would be real easy in a language with pointers. Tomorrow I'll look into having each polygon (really just a quad) keep track of a list of node ID numbers.

If that fails I may use Voronoi regions.




muddy_shoes(Posted 2012) [#2]
Not sure I understand the problem that requires pointers. If you've got vertex/vector objects then polys can use lists of vertex references and can share them. If your vertices are stored as arrays of primitives then you've got an index to use. Either is effectively a pointer to the underlying vertex info.


zoqfotpik(Posted 2012) [#3]
Yes, I keep forgetting that Monkey has references.

I only remember it after having tried and failed to copy an object for an hour. (that is, deep copy...)

I may still end up using Voronoi regions because they're a great way of getting elegant looking cells.