Curve.inl 904 B

123456789101112131415161718192021222324252627282930313233343536
  1. namespace gameplay
  2. {
  3. inline float bezier(float eq0, float eq1, float eq2, float eq3, float from, float out, float to, float in)
  4. {
  5. return from * eq0 + out * eq1 + in * eq2 + to * eq3;
  6. }
  7. inline float bspline(float eq0, float eq1, float eq2, float eq3, float c0, float c1, float c2, float c3)
  8. {
  9. return c0 * eq0 + c1 * eq1 + c2 * eq2 + c3 * eq3;
  10. }
  11. inline float hermite(float h00, float h01, float h10, float h11, float from, float out, float to, float in)
  12. {
  13. return h00 * from + h01 * to + h10 * out + h11 * in;
  14. }
  15. inline float hermiteFlat(float h00, float h01, float from, float to)
  16. {
  17. return h00 * from + h01 * to;
  18. }
  19. inline float hermiteSmooth(float h00, float h01, float h10, float h11, float from, float out, float to, float in)
  20. {
  21. return h00 * from + h01 * to + h10 * out + h11 * in;
  22. }
  23. inline float lerpInl(float s, float from, float to)
  24. {
  25. return from + (to - from) * s;
  26. }
  27. }