Adjacent Vertex

BlitzMax Forums/MiniB3D Module/Adjacent Vertex

FBEpyon(Posted 2010) [#1]
Hello,

So i'm getting th game programmed quite nicely, but I still have a problem with when I raise and lower the terrain, I'm not able to figure out how to raise the adjacent vertex, if the one you are changing going to high. Basicly i'm try to make it so you can raise one point on my terrain, and the 4 vertices around the one raise evenly with the center one. Here is a picture to help better reference how my terrain is built, and what I'm looking for.



Basicly

#1 the normal raise,

#2 raised twice

#3 is the outcome I want instead of #2 when raising twice.

#4 is the next step and then it goes on from there, any help would be greatful..


*(Posted 2010) [#2]
Basically what you have to do is work out how high the vertices are above the ground level so if its raised once you have the pyramid and if the user clicks again you get the hill with plateau then the biger pyramid etc. Its all to do with how high the vertex is above the ground level.


FBEpyon(Posted 2010) [#3]
Okay I don't understand how to find the vertexes above the ground level, can you explain this a little more..?


FBEpyon(Posted 2010) [#4]
Hello,

So I have been doing alot of looking and I still can't find the answer, I'm sure someone has it, can anyone offer more help, examples, math??


markcw(Posted 2010) [#5]
Loop through the mesh and for each vertex loop through the mesh again and check the distances to the primary vertex, if it's close enough it's adjacent, so add it to a list for the primary vertex and continue. Use a map to store the data with the key storing the primary vertex index and the value storing an array of adjacent vertex indices.