Sorry, I should be able to do this but I have coder’s block

I want to use indices into a vertex array to avoid duplication. What I’ve worked out so far is that for an n*n heightmp:

- number of unique vertices = n*n
- number of quads = (n-1)*(n-1)
- number of triangles = 2 * quads

What I want to know is the general formula for calculating the number of indices required. i.e. for a 3*3 there are 9 unique vertices but 12 indices or for a 4*4 there are 16 unique vertices but 24 indices.

Thanks

*edit* a breath of fresh air can work wonders. (2*n)*(n-1)

[This message has been edited by swiych (edited 09-14-2003).]