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:
parent
92ebd59539
commit
91eafcc47d
@ -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>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user