Start with Pythagoras:
x
2 + y
2 = z
2
You are given the width
x
and height
y
of the triangle, so you can calculate
z
:
z = Square Root(x * x + y * y)
You now need to know the ratio of this triangle to a triangle with a z of 1:
z
1 = 1 /
z
;
You can then multiply
x
and
y
by
z
1 and you have the values.