Four points, two lines, 1 value- how?

I’m trying to work out a non-picking based terrain following system to see how it compares with using a picking based one. At the moment, my terrain is described by a grid of heights (doing the binary subdivision auto-generated terrain thing at the moment) and it’s looking fine but I can’t seem to accurately find the height of a point on the grid.

So if I am looking for the point at 0.7, 0.5 and my current height map is looking like this:
[ 1 ]----[2.5] | | | | | | | | [1.2]---[2.0]
How should I go about finding it?

The things I have tried seem to just come out wrong the whole time. Not necessarily very wrong, but wrong enough that it is noticeable.

It is rendered as two triangles. If you are going to match what is on screen you have to know where the diagonal is. Then it’s fairly easy to figure out how to get the height when you got a single triangle.

Is there an easy way to judge where it would put the triangles if I’m using the automatic stripifier type tools?

Depends on the tool but I’d imagine not (short of scanning the geometry array afterwards)…

Probably easiest just to feed triangle geometry in so you know for sure.

Kev

I kind of thought that would be the case. Nothing is ever easy…

The sample code from this article includes triangle based terrain generation (http://www.sys-con.com/story/?storyid=46231&de=1). Hopefully that will be helpful getting you started.

Mike