Jump to content
• Advertisement

# Tweaking my sin curve

This topic is 4424 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

## Recommended Posts

I have not done math in a while, so I cannot remember how I can achieve this, but this is what I want: I have a function that takes a value between 0 and 1. Here is my function currently: f(x) = (sin(x*PI - PI/2) + 1.0) / 2.0 This *almost* does what I want, since I want: f(x) to be 0 when x is 0 f(x) to be 0.5 when x is 0.5 f(x) to be 1 when x is 1 But I want the curve to go a bit differently. Here is the image of what I have, and what I want: Clicky The red line being the above function which I have, and the blue line being what I would like to have approximatly. Basically, I want the curve to be a bit shallower initially, then steeper suddenly. Can anyone tell me where I can put a variable in my current equation to get what I need? Many thanks!

#### Share this post

##### Share on other sites
Advertisement
What you need is a sigmoid function. The basic setup is:
   1-------  1+e-x

Adjust accordingly to your need.

#### Share this post

##### Share on other sites
Your blue curve looks a bit like a shifted Langevin function.

http://scienceworld.wolfram.com/physics/LangevinFunction.html

#### Share this post

##### Share on other sites
Thanks!

1/(1+E^(-20*(x-0.5))) seems to do it perfect

#### Share this post

##### Share on other sites
Quote:
 Original post by AiroYour blue curve looks a bit like a shifted Langevin function.http://scienceworld.wolfram.com/physics/LangevinFunction.html

Yea, I think that would work to, but I went with sigmoid function; it seems just right.

#### Share this post

##### Share on other sites

• Advertisement
• Advertisement

• ### Popular Contributors

1. 1
2. 2
3. 3
Rutin
19
4. 4
5. 5
• Advertisement

• 14
• 30
• 13
• 11
• 11
• ### Forum Statistics

• Total Topics
631780
• Total Posts
3002314
×

## Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!