protected override void Update() { base.Update(); ControlPointVisualiser[] ordered = controlPointContainer.OrderBy(p => p.PointPosition.Value.X).ToArray(); for (int i = 0; i < ordered.Length; i++) { ordered[i].Last = i > 0 ? ordered[i - 1] : null; ordered[i].Next = i < ordered.Length - 1 ? ordered[i + 1] : null; } var vectorPath = new List <Vector2> { new Vector2(0, DrawHeight) }; vectorPath.AddRange(ordered.Select(p => p.PointPosition.Value)); vectorPath.Add(new Vector2(DrawWidth, 0)); var bezierPath = PathApproximator.ApproximateBezier(vectorPath.ToArray()); path.Vertices = bezierPath; path.Position = -path.PositionInBoundingBox(Vector2.Zero); easingVertices.Clear(); easingVertices.AddRange(bezierPath.Select(p => Vector2.Divide(p, DrawSize)).Select(p => new Vector2(p.X, 1 - p.Y))); }
protected override void Update() { base.Update(); path.ClearVertices(); path.AddVertex(Last?.PointPosition.Value ?? new Vector2(0, DrawHeight)); path.AddVertex(PointPosition.Value); if (Next == null) { path.AddVertex(new Vector2(DrawWidth, 0)); } path.Position = -path.PositionInBoundingBox(Vector2.Zero); }