Skip to content

Instantly share code, notes, and snippets.

@kevinmoran
Created October 9, 2019 15:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kevinmoran/d61e0e86079a4ca118e02649257267ad to your computer and use it in GitHub Desktop.
Save kevinmoran/d61e0e86079a4ca118e02649257267ad to your computer and use it in GitHub Desktop.
Cubic approximation of sinf(), if you only need something sinusoid-ish
// Source: https://www.youtube.com/watch?v=1xlCVBIF_ig
float cubicSinf(float x)
{
float t = x * 0.15915f;
t = t - (int)t;
return 20.785f * t * (t - 0.5f) * (t - 1.f);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment