INNER CODE UNIT · C++
cosEnd
camila314/gdp · Slerp2D.cpp:16
cosEnd = -cosEnd;
}
if (1.f - dot > 0.0001f) {
float theta = acosf(dot);
float sinTheta = sinf(theta);
weightStart = sinf(theta * (1.f - t)) / sinTheta;
weightEnd = sinf(theta * t) / sinTheta;
} else {
weightStart = 1.f - t;
weightEnd = t;
}
float interpSin = (sinStart * weightStart) + (sinEnd * weightEnd);
float interpCos = (cosStart * weightStart) + (cosEnd * weightEnd);
double out = atan2(interpSin, interpCos);
return out + out;