예제 #1
0
        public static unsafe void DrawHermite(ImDrawList *drawList, Vector2 p1, Vector2 p2, int steps, Color color)
        {
            var t1 = new Vector2(80.0f, 0.0f);
            var t2 = new Vector2(80.0f, 0.0f);

            for (var step = 0; step <= steps; step++)
            {
                var t  = (float)step / steps;
                var h1 = +2 * t * t * t - 3 * t * t + 1.0f;
                var h2 = -2 * t * t * t + 3 * t * t;
                var h3 = t * t * t - 2 * t * t + t;
                var h4 = t * t * t - t * t;

                ImGuiNative.ImDrawList_PathLineTo(drawList, new Vector2(h1 * p1.X + h2 * p2.X + h3 * t1.X + h4 * t2.X, h1 * p1.Y + h2 * p2.Y + h3 * t1.Y + h4 * t2.Y));
            }

            ImGuiNative.ImDrawList_PathStroke(drawList, color.PackedValue, 0, 3.0f);
        }