Henri Verbeet hverbeet@gmail.com wrote:
+static void d2d_point_lerp(D2D1_POINT_2F *out,
const D2D1_POINT_2F *a, const D2D1_POINT_2F *b, float t)
+{
- out->x = a->x * (1.0f - t) + b->x * t;
- out->y = a->y * (1.0f - t) + b->y * t;
+}
According to my investigation of a better bilinear blending (lerp) implementation the above formula is better to explicitely simplify to
out->x = a->x + (b->x - a->x) * t; out->y = a->y + (b->y - a->y) * t;
For performance, quite possibly. This isn't particularly performance sensitive code though, and I'd be surprised if that variant had better accuracy.
I'd dare to claim that both variants should be equivalent in accuracy, and the 2nd version just avoids a redundant mutiplication.