0

If I have a rotation that goes from 0º to 90º and I want to base the rotation on the touch of my finger, how can I calculate this?

My current situation is that if I touch at the end of the object (height equals 150 units) I would like a degree of 0º, if I touch at the very beginning (0) I would like 90º. How can put this into an equation?

Rui Peres
  • 105
  • This sounds like a right triangle with a hypotenuse of $150$ and the other two sides being equal. Am I interpreting this correctly? Also you ask how to put this into an equation. What's the equation trying to find? – RandomUser May 09 '14 at 19:30
  • if x=75 it should give me 45º (for example). – Rui Peres May 09 '14 at 19:31
  • @JonathanLandrum no. If x=150 then y=90 where the goal is to be 0. The same thing with x=0 then y=0, where goal would be 90º. – Rui Peres May 09 '14 at 19:36
  • 1
    Is this a slider for a computer program? Try $f(x) = \frac{150 - x}{150} \cdot 90$, which is just $90 - \frac{3}{5}x$. The division by $150$ reverses it and normalizes it to $[0,1]$, and multiplying by $90$ scales it up to the interval you want. – Henry Swanson May 09 '14 at 19:46
  • @HenrySwanson yes it is. Thanks, that was the solution. – Rui Peres May 09 '14 at 20:03

1 Answers1

2

From your comments, it sounds like this is the scenario.

You want to find a function $f(x)=y$ such that $f(0)=90$, $f(75)=45$ and $f(150)=0$.

Since the halfway point along $150$ corresponds with the halfway point along $90$, this is looking linear.

$$\frac{\Delta y}{\Delta x}=\frac{y_2-y_1}{x_2-x_1}=\frac{0-45}{150-75}=\frac{-45}{75}=-\frac{3}{5}$$

So that's your slope. Plug that into the equation for a line.

$$y=mx+b$$ $$y=-\frac{3}{5}x+b$$ $$90=-\frac{3}{5}(0)+b$$ $$b=90$$

Making your equation $$y=-\frac{3}{5}x+90$$

RandomUser
  • 1,275