Is it possible to get a formula [modified]
-
Here are the x and y values: y = 25, x = 0 y = 100, x = 50 y = 400, x = 100 What I want is a direct formula that gives continuous values x = f(y) that satisfies the condition. I tried everything including logarithms but could not get a formula yet. Here is what I am trying to achieve: If you look at the slider control in Microsoft Office 2007 the slider ranges from 25% to 400% with 100% being in the middle. You can smoothly zoom the UI by moving the slider.
Co-Author ASP.NET AJAX in Action
-
Here are the x and y values: y = 25, x = 0 y = 100, x = 50 y = 400, x = 100 What I want is a direct formula that gives continuous values x = f(y) that satisfies the condition. I tried everything including logarithms but could not get a formula yet. Here is what I am trying to achieve: If you look at the slider control in Microsoft Office 2007 the slider ranges from 25% to 400% with 100% being in the middle. You can smoothly zoom the UI by moving the slider.
Co-Author ASP.NET AJAX in Action
There are an infinite number of answers to your question, here is one: x=50(y-25)(y-400)/(-75*300)+100(y-25)(y-100)/(375*300)
Peter "Until the invention of the computer, the machine gun was the device that enabled humans to make the most mistakes in the smallest amount of time."
-
There are an infinite number of answers to your question, here is one: x=50(y-25)(y-400)/(-75*300)+100(y-25)(y-100)/(375*300)
Peter "Until the invention of the computer, the machine gun was the device that enabled humans to make the most mistakes in the smallest amount of time."
Yes, I realize that so I added more information to my original post. It has been a while soince I did maths so I have forgot all the terminology and I am not able to express my problem properly. :(
Co-Author ASP.NET AJAX in Action
-
Here are the x and y values: y = 25, x = 0 y = 100, x = 50 y = 400, x = 100 What I want is a direct formula that gives continuous values x = f(y) that satisfies the condition. I tried everything including logarithms but could not get a formula yet. Here is what I am trying to achieve: If you look at the slider control in Microsoft Office 2007 the slider ranges from 25% to 400% with 100% being in the middle. You can smoothly zoom the UI by moving the slider.
Co-Author ASP.NET AJAX in Action
Hi, one exponential relation that satisfies your numbers is:
y = 25 * 2 ^ (x/25)
so the inverse formula would be:x=25*log(y/25)/log(2)
BTW: it does not matter what the base of the log function is (2, e, 10, whatever). :)Luc Pattyn [Forum Guidelines] [My Articles]
this months tips: - use PRE tags to preserve formatting when showing multi-line code snippets - before you ask a question here, search CodeProject, then Google
-
Yes, I realize that so I added more information to my original post. It has been a while soince I did maths so I have forgot all the terminology and I am not able to express my problem properly. :(
Co-Author ASP.NET AJAX in Action
From reading your modified posting, it appears that what you want to preserve is equal ratios for equal distance from the centre (the limits are 1/4 x and 4x relative to the centre), so probably 1/2 x and 2x (i.e. 50 and 200) should also be equal distances from the centre. In this case exponentials are your friend and you should use Luc's solution.
Peter "Until the invention of the computer, the machine gun was the device that enabled humans to make the most mistakes in the smallest amount of time."
-
Hi, one exponential relation that satisfies your numbers is:
y = 25 * 2 ^ (x/25)
so the inverse formula would be:x=25*log(y/25)/log(2)
BTW: it does not matter what the base of the log function is (2, e, 10, whatever). :)Luc Pattyn [Forum Guidelines] [My Articles]
this months tips: - use PRE tags to preserve formatting when showing multi-line code snippets - before you ask a question here, search CodeProject, then Google
Awesome, that does the job. Thank you!:)
Co-Author ASP.NET AJAX in Action
-
Here are the x and y values: y = 25, x = 0 y = 100, x = 50 y = 400, x = 100 What I want is a direct formula that gives continuous values x = f(y) that satisfies the condition. I tried everything including logarithms but could not get a formula yet. Here is what I am trying to achieve: If you look at the slider control in Microsoft Office 2007 the slider ranges from 25% to 400% with 100% being in the middle. You can smoothly zoom the UI by moving the slider.
Co-Author ASP.NET AJAX in Action