Help figuring out equation

kamlanie

New member
Joined
Jan 31, 2012
Messages
1
Hello everyone! I am doing a self started project for programming and I need to make an equation to figure out what angle to tilt something based on where it is on the stage.

I need an equation that gives me 45 if the object is at 0 pixels on the stage, a 90 if the object is in the center of the stage at 400 pixels, and 135 if the object is at 800 pixels on the stage. Hope that makes sense.
any help would be awesome!

Thx, Kam
 
Last edited:
Hello, Kam!

I need an equation that gives me 45 if the object is at 0 pixels on the stage,
a 90 if the object is in the center of the stage at 400 pixels, and 135 if the object is at 800 pixels on the stage.

We have a linear function: .\(\displaystyle \begin{array}{c|ccc}x & 0 & 400 & 800 \\ \hline y & 45 & 90 & 135 \end{array}\)


Find the equation of the line through two of the points, say: .\(\displaystyle (0,45)\text{ and }(400,90)\)

The slope is: .\(\displaystyle m \:=\:\frac{90-45}{400-0} \:=\:\frac{45}{400} \:=\:\frac{9}{80}\)

The equation is: .\(\displaystyle y - 45 \:=\:\frac{9}{80}(x-0) \quad\Rightarrow\quad y \:=\:\frac{9}{80}x + 45\)
 
Top