Help to find stretch factor of a function

QuickshotDev

New member
Joined
Nov 27, 2014
Messages
2
graph.jpg

The function is (x+100)^2 (x-100)^2 *0.0000005

I have modeled this function for a computer game I am working on.
I need a way to be able to change the defined vertex points to anything but continue to have the maximum vertex stationary at 50.
I found that if the defined points lie at -100 and 100 then I can just multiply it by 0.0000005 but this value does not work when I shift the minimum vertexes apart.

this is what I am working with in my actual code: ( power( clamp(xx,x-splash_width/2,x+splash_width/2) -1*(x-splash_width/2),2) *power( clamp(xx,x-splash_width/2,x+splash_width/2) -1*(x+splash_width/2),2) )

splash_width is equal to 200
but I want to be able to change this variable and keep the maximum point at 50.

thanks :D
 
If I am understanding you correctly, you want a function like you have with the minima at \(\displaystyle \pm\)s where 2s is your splash width, and with the maximum at zero to have a height of 50. If so your function is
f(x) = a (x-s)2 (x+s)2
so that
f(0) = a s4 = 50
and
a = \(\displaystyle \frac{50}{s^4}\)

As a (partial) check
0.0000005 = 5 10-7 = \(\displaystyle \frac{50}{100^4} = \frac{50}{10^8}\) = 5 10-7
 
If I am understanding you correctly, you want a function like you have with the minima at \(\displaystyle \pm\)s where 2s is your splash width, and with the maximum at zero to have a height of 50. If so your function is
f(x) = a (x-s)2 (x+s)2
so that
f(0) = a s4 = 50
and
a = \(\displaystyle \frac{50}{s^4}\)

As a (partial) check
0.0000005 = 5 10-7 = \(\displaystyle \frac{50}{100^4} = \frac{50}{10^8}\) = 5 10-7

Thanks so much :) I don't know why I didn't figure this out. I haven't tested it yet but it looks good thanks.

EDIT: ok I just tested it and it works perfectly thanks again.
 
Last edited:
Top