public void TestGetLine(Point start, Point end, Brush brush) { Task.Run(() => { var line = Util.GetLine(start, end, brush); Assert.Equal(line.X1, start.X); Assert.Equal(line.Y1, start.Y); Assert.Equal(line.X2, end.X); Assert.Equal(line.Y2, end.Y); Assert.Equal(line.Fill, brush); }); }
/// <summary> /// Function to check if point is in BrokenLine. /// </summary> /// <param name="point">Point to check.</param> /// <param name="brokenLine">BrokenLine in which point might be.</param> /// <returns>True if point is located in given BrokenLine.</returns> public static bool PointIsInBrokenLine(Point point, Polyline brokenLine) { var eps = 4.7; for (var i = 0; i < brokenLine.Points.Count; ++i) { var next = (i + 1) % brokenLine.Points.Count; if (distFromPointToLine(point, brokenLine.Points[i], brokenLine.Points[next]) < eps) { return(true); } } return(false); }