예제 #1
0
파일: Canvas.cs 프로젝트: Gregory365/Braess
 public void AddPoint(Point point)
 {
     points.Add(point);
 }
예제 #2
0
파일: Canvas.cs 프로젝트: Gregory365/Braess
 private Line GetClosestLine(Point point)
 {
     return lines.Count == 0 ? null : lines.MinBy(x => GetLinesDistance(x, point)).First();
 }
예제 #3
0
파일: Canvas.cs 프로젝트: Gregory365/Braess
 private Point GetClosestPoint(Point point)
 {
     return points.Count == 0 ? null : points.MinBy(x => GetPointsDistance(x, point)).First();
 }
예제 #4
0
파일: Canvas.cs 프로젝트: Gregory365/Braess
 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
파일: Canvas.cs 프로젝트: Gregory365/Braess
 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
파일: Canvas.cs 프로젝트: Gregory365/Braess
 private static Point GetOtherPoint(Line line, Point point)
 {
     return line.Point1 == point ? line.Point2 : line.Point1;
 }