@ thephönix: Ich weiß wofür Interpolation gut ist
@ Sylence: Dass gilt doch wohl eher für zb. GetLenght/GetLenghtSQ.
Wenn man sich mal den Code in zb Vector2d anguckt:
Code:
//! returns interpolated vector
//! \param other: other vector to interpolate between
//! \param d: value between 0.0f and 1.0f.
vector2d<T> getInterpolated(const vector2d<T>& other, f32 d) const
{
T inv = (T) 1.0 - d;
return vector2d<T>(other.X*inv + X*d, other.Y*inv + Y*d);
}
//! Returns (quadratically) interpolated vector between this and the two given ones.
/** \param v2: second vector to interpolate with
\param v3: third vector to interpolate with
\param d: value between 0.0f and 1.0f. */
vector2d<T> getInterpolated_quadratic(const vector2d<T>& v2, const vector2d<T>& v3, const T d) const
{
const T inv = (T) 1.0 - d;
const T mul0 = inv * inv;
const T mul1 = (T) 2.0 * d * inv;
const T mul2 = d * d;
return vector2d<T> ( X * mul0 + v2.X * mul1 + v3.X * mul2,
Y * mul0 + v2.Y * mul1 + v3.Y * mul2);
}
In GetInterpolated gibt es keine quadratwurzel die in GetInterpolated_Quadratic weggelassen werden könnte, statdessen wird dort mit zwei zusätzlichen Vectoren gearbeitet, und
nur dass verstehe ich nicht wirklich...