示例#1
0
 public void AddPoint(Point point)
 {
     points.Add(point);
 }
示例#2
0
 private Line GetClosestLine(Point point)
 {
     return lines.Count == 0 ? null : lines.MinBy(x => GetLinesDistance(x, point)).First();
 }
示例#3
0
 private Point GetClosestPoint(Point point)
 {
     return points.Count == 0 ? null : points.MinBy(x => GetPointsDistance(x, point)).First();
 }
示例#4
0
 private static double GetLinesDistance(Line line, Point point)
 {
     return Math.Sqrt(Math.Pow(line.CentrePoint.X - point.X, 2) + Math.Pow(line.CentrePoint.Y - point.Y, 2));
 }
示例#5
0
 private static double GetPointsDistance(Point point1, Point point2)
 {
     return Math.Sqrt(Math.Pow(point1.X - point2.X, 2) + Math.Pow(point1.Y - point2.Y, 2));
 }
示例#6
0
 private static Point GetOtherPoint(Line line, Point point)
 {
     return line.Point1 == point ? line.Point2 : line.Point1;
 }