Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fastapprox.h and function curve #8

Closed
ziaoang opened this issue Apr 21, 2020 · 2 comments
Closed

fastapprox.h and function curve #8

ziaoang opened this issue Apr 21, 2020 · 2 comments

Comments

@ziaoang
Copy link

ziaoang commented Apr 21, 2020

Hi BazkieBumpercar,
There is a function called "curve" shows many times in the code, but I can not find its definition. It seems come from fastapprox.h, but no this file included.
Could you give the definition of this function "curve"?
Thank you~

@BazkieBumpercar
Copy link
Owner

BazkieBumpercar commented Apr 21, 2020

It's in the engine, the blunted2 project (also on github), in src/base/math/bluntmath.hpp
Here's the definition:

inline float curve(float source, float bias = 1.0f) { // make linear / into sined _/-
    return (sin((source - 0.5f) * pi) * 0.5f + 0.5f) * bias + source * (1.0f - bias);
}

So it will make a linear line into a nice sine curve :)

@ziaoang
Copy link
Author

ziaoang commented Apr 21, 2020

Cool, I find it in the blunted2 project~

@ziaoang ziaoang closed this as completed Apr 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants