At first it was kind of obvious that you can just use basic trig to get the hight of the triangle. But that comes into error when you have a z offset, or a y offset.
The code here is very simple, so I'll just break it down as such:
First you just see the trig function that this is based of off.
var length = 10; // basically the hypotenuse of the triangle.
var theta = 45; // the angle of elevation, between the base and the hypotenuse
var newheight = sin(theta)*length;// This is the projected height, and as you can see, really primitive.