Advertisement

Name that graph

Started by January 16, 2003 03:54 PM
7 comments, last by MENTAL 22 years, 1 month ago
okay, anyone know of a function (or combination of funcions) that have an output like: it doesn''t have to be exactly like that (ph33r 4h3 m5p41n7 5k1llz), but as long as for about the first 1/3 it stays roughly the same then declines dramatically afterwards. also, a way of modifying when it begins the steep decline would be good too. *sigh* all this to implement view- and aim-independant firing . thanks in advance
How ''bout 1 - x^n? The larger the value of n, the flatter the top and the steeper the drop-off.

HTH
Advertisement
Y = -2^x + 2 seems to work correctly.

Edit: Well, the only problem is that the function starts to dip at about x = -4.5. But other than that, it should roughly model what you're looking for.

[edited by - Apocalypse_Demon on January 16, 2003 8:53:44 PM]
i agree exponential function seems right
Depending on how you interpret that curve, it could be anything. For example, you could draw a straight line between (0,1) and (1,0) and have a curve that at least starts and ends at the right place. Also, you could draw a quarter of a circle of radius 1 centered at the origin and get something close.

Another simple approach that approximate the desired curve would be to have two line segments, one from (0,1) to (1/3,1) and another from (1/3,1) to (1,0). You wouldn''t have the nice smooth transition, but evaluation of the curve would be cheaper than the exponential functions.

Graham Rhodes
Senior Scientist
Applied Research Associates, Inc.
Graham Rhodes Moderator, Math & Physics forum @ gamedev.net
I wonder if the happy smile in the origo indicates something of the nature of this post.... (-?

But yeah, 1-x^n gives good results.

- Mikko Kauppila
Advertisement
How about 2 line-segments and a bezier curve?



[grrrrrr...can''t seem to get this to post! server problems...grrrr]
quote:
Original post by bob_the_third
How about 2 line-segments and a bezier curve?



That''d give you something smooth. Not sure if it''d be any cheaper to calc than the exponent.



quote:
Original post by bob_the_third [grrrrrr...can''t seem to get this to post! server problems...grrrr]


Yeah, there are problems today.



Graham Rhodes
Senior Scientist
Applied Research Associates, Inc.
Graham Rhodes Moderator, Math & Physics forum @ gamedev.net
uutee: i was wondering when someone would pick up on that , unfortunatly the question was actually a serious one!

anyway, thanks for all the replies. 1 - x^n works rather nicely actually (thanks AP).

i''m sure you''ll be seeing some more of my drawings in the near future (this weekend hopefully)...

thanks again

This topic is closed to new replies.

Advertisement