Пример #1
0
Float3<T> Float3<T>::slerp(const Float3 &end, T percent) const
{
	T theta = static_cast<T>(std::acos(this->dot(end) / (this->length() * end.length())));
	T sinThetaRecip = static_cast<T>(1.0 / std::sin(theta));
	T beginScale = static_cast<T>(std::sin((1.0 - percent) * theta) * sinThetaRecip);
	T endScale = static_cast<T>(std::sin(percent * theta) * sinThetaRecip);
	return this->scaledBy(beginScale) + end.scaledBy(endScale);
}