Simpler solution to this geometry/trig problem? i had a geometry/trignometry problem come up at work today, and i've been out of school too long: i've lost my tools.
i'm starting with a rectangle of known width (w) and height (h). For graphical simplification i can convert it into a right-angle triangle:

i'm trying to find the coordinates of that point above which is perpendicular to the origin:

i've labelled the opposite angle t1 (i.e. theta1, but Microsoft Paint cannot easily do greek and subscripts), and i deduce that the two triangles are similar (i.e. they have the same shape):

Now we come to my problem. Given w and h, find x and y.
Now things get very difficult to keep drawing graphically, to explain my attempts so far.
But if i call the length of the line segment common to both triangles M:

then:
M = w∙sin(t1)

Now i can focus on the other triangle, which i'll call O-x-M:

and use trig to break it down, giving:
x = M∙sin(t1)
  = w∙sin(t1)∙sin(t1)

y = M∙cos(t1)
  = w∙sin(t1)∙cos(t1)

with
t1 = atan(h/w)

Now this all works (i think, i've not actually tested it yet), and i'll be giving it to a computer, so speed isn't horribly important.
But my god, there must have been an easier way to get there. i feel like i'm missing something.

By the way, what this will be used for is drawing a linear gradient in along that perpendicular:


Another way: You have identified some angles as being equal in your last figure. This implies that several of the right triangles in the picture are similar. For example,
$$ \frac{h}{w} = \frac{x}{y} = \frac{y}{w-x},$$
from which it is not too difficult to solve for $x$ and $y$.
And yet another: The hypotenuse lies on the line with equation $x/w+y/h=1$ (since the two points $(x,y)=(w,0)$ and $(x,y)=(0,h)$ satisfy this equation, and two points uniquely determine a line). The normal vector to a line can be read off from the coefficients of $x$ and $y$; it is $\mathbf{n}=(1/w,1/h)$ in this case. The point that you seek (let me call it $(a,b)$ here) lies on the line which goes from the origin in the direction that $\mathbf{n}$ points, so the point must be of the form $(a,b)=t \mathbf{n} = (t/w,t/h)$ for some number $t$. Substituting $(x,y)=(t/w,t/h)$ into the equation for the hypotenuse gives $t(1/w^2+1/h^2)=1$, from which we immediately find $t$ and hence also
$$(a,b)=\left( \frac{1/w}{1/w^2+1/h^2}, \frac{1/h}{1/w^2+1/h^2} \right).$$
