You will need 4 different pointers for terrains then (worst case scenario in the "top right" corner you would end up with all of the verts on different terrains).

Also you have to take into account that in this "worst case" you would actually have to manipulate 9 vertices if closest_vert is in the top right corner of a terrain!

-one vert for the terrain with current_vert
-two verts in the terrain above it (the overlapping corner vert and the vert above it)
-two verts in the terrain to the right (the overlapping vert and the vert to the right of it)
-four verts in the diagonal terrain! (the one in the bottom left corner overlapping all of the terrains, the vert above that and the one to the right becouse it overlaps for the two other terrains, and a fourth vert in diagonal that is exclusive for this last terrain)

For this I would first use 3 "if" to determine the possible cases, and afterwards do the actual vert manipulation inside either a 4 way switch/case instuction, or a chain of 4 if/else branches


"The more you know, the more you realize how little you know..."

I <3 HORUS
http://www.opserver.de/ubb7/ubbthreads.php?ubb=showflat&Number=401929&page=1