I'm building a mountain out of triangles using C++. But for each triangle I need to know it's slope. Each triangle contains a (x,y,z) coordinate. I've done some searching but can't find a formula, so I'm wondering if slope is called something else when referring to objects and not lines. Can anyone give me the formula or at least tell me the correct term to look for? Thanks.
I think what you need is to find a normal, normalize it (so that it is really normal :D ) and measure it's projection on xy plane. What you'll get is 0 if triangle is parallel to xy plane and 1 if it's perpendicular.
To find a normal you'll have to take a cross product of two edges of the triangle. I don't remember the formula. Wikipedia it. Note that there are two normals you could get by multiplying edges in different order. Luckily, if you only need a scalar at [0;1], it doesn't matter which you take.
To normalize a vector means to divide it by it's length, so that its length is 1.
To find the projection on xy plane simply take sqrt(x*x+y*y).