INNER CODE UNIT · C++
halfEnd
camila314/gdp · Slerp2D.cpp:3
float halfEnd = endAngle * 0.5f;
float cosStart = cosf(halfStart);
float sinStart = sinf(halfStart);
float cosEnd = cosf(halfEnd);
float sinEnd = sinf(halfEnd);
float dot = (cosStart * cosEnd) + (sinStart * sinEnd);
float weightStart, weightEnd;
if (dot < 0.f) {
dot = -dot;
sinEnd = -sinEnd;
cosEnd = -cosEnd;
}
if (1.f - dot > 0.0001f) {
float theta = acosf(dot);