private void DrawPath(Point origination, Point destination, float decreasePct) { Canvas.Children.Clear(); var distance = GetLineLength(origination, destination); var path = new PathFigure(); path.StartPoint = origination; path.Segments.Add(new LineSegment(destination, true)); // Create a PathGeometry to contain the figure. var pathGeometry = new PathGeometry(); pathGeometry.Figures.Add(path); // Display the PathGeometry. var myPath = new Path {Stroke = Brushes.Black, StrokeThickness = 6, Data = pathGeometry}; Canvas.Children.Add(myPath); } private int GetLineLength(Point origination, Point destination) { var x = destination.X - origination.X; var y = destination.Y - origination.Y; var pyth = Math.Pow(x, 2) + Math.Pow(y, 2); return (int)Math.Sqrt(pyth); }
x3 = x1 + (x2-x1)*p/100; y3 = y1 + (y2-y1)*p/100;
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)