Maths Problem

I know A (it's actually 0,0) I also know B, C, and theta. C is clamped between A and B.

 

I need to know at what distance (x) along the line at y=C would a point make a triangle with the angle theta and the opposite side AB.

 

Should have paid more attention in school.

 

UPDATE: So @brucehoult found a good solution. His Summary:

 

The trick here is that, no matter what theta is, as you vary C from 0 to B the solution point lies on a cicle. When theta is 90 degrees, the center of the circle lies on the line between A and B, but for other values of theta it doesn't, so you need to find it.

 

See Bruce's C code solution: hoult.org/bruce/frampton.cpp

 

This is a problem I never saw in the text books. The solution means that the camera in Chopper 2 can automatically zoom in and out (translate in and out really) when the playing area becomes shorter or taller, but still display exactly the area where everything is happening. Looks great.

 

Stay in school!

596 views
0 faves
0 comments
Uploaded on July 2, 2009