1
0
mirror of https://github.com/Siccity/xNode.git synced 2025-12-21 01:36:03 +08:00

the + and * was creating a lot of new vector2s, went down 80% in call time with this

This commit is contained in:
Simon Rodriguez 2019-11-13 00:10:45 +01:00
parent 92ebd59539
commit 91eafcc47d

View File

@ -121,7 +121,10 @@ namespace XNodeEditor {
float u = 1 - t; float u = 1 - t;
float tt = t * t, uu = u * u; float tt = t * t, uu = u * u;
float uuu = uu * u, ttt = tt * t; float uuu = uu * u, ttt = tt * t;
return (uuu * p0) + (3 * uu * t * p1) + (3 * u * tt * p2) + (ttt * p3); return new Vector2(
(uuu * p0.x) + (3 * uu * t * p1.x) + (3 * u * tt * p2.x) + (ttt * p3.x),
(uuu * p0.y) + (3 * uu * t * p1.y) + (3 * u * tt * p2.y) + (ttt * p3.y)
);
} }
/// <summary> Draws a line segment without allocating temporary arrays </summary> /// <summary> Draws a line segment without allocating temporary arrays </summary>