Advertisement
Tkap1

Untitled

Dec 2nd, 2023
660
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.29 KB | None | 0 0
  1. func s_v3 slerp(s_v3 start, s_v3 end, float t)
  2. {
  3.     float dot = v3_dot(start, end);
  4.     dot = clamp(dot, -1.0f, 1.0f);
  5.     float theta = acosf(dot) * t;
  6.  
  7.     // nocheckin parenthesis?
  8.     s_v3 relative_vec = v3_normalized(end - start * dot);
  9.     return ((start * cosf(theta)) + (relative_vec * sinf(theta)));
  10. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement