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:


Parametrize the line from $(w,0)$ to $(0,h)$ by $(w,0) + t(-w, h)$. Then you are searching for the point $(x,y)$ on the line such that $(x,y)\cdot (-w,h) = 0$. 
