public GraphNode[] GetPathDebug(Point from, Point to) { var toStruct = new PointStruct(to); if (!pointMap.IsInsideMap(to)) { toStruct = GetClosestPointOnEdge(to); } var fromStruct = new PointStruct(from); if (!pointMap.IsInsideMap(from)) { fromStruct = GetClosestPointOnEdge(from); } var nodeFrom = GetNearestNode(new PointStruct(fromStruct.X + xOffset, fromStruct.Y + yOffset)); var nodeTo = GetNearestNode(new PointStruct(toStruct.X + xOffset, toStruct.Y + yOffset)); if (nodeFrom != null && nodeTo != null) { var shortestPath = triGraph.Dijkstra(nodeFrom.Value, nodeTo.Value); var path = shortestPath.GetPath(); List <GraphNode> pathNodes = new List <GraphNode>(); //pathNodes.Add(triGraph[nodeFrom.Value].Item); foreach (uint node in path) { var tri = triGraph[node].Item; var point = tri.center; //pathPoints.Add(new Point(point.X - xOffset, point.Y - yOffset)); pathNodes.Add(tri); } //pathNodes.Add(triGraph[nodeTo.Value].Item); //var test = TunnelSmooth(pathNodes); return(pathNodes.ToArray()); } else { return(new GraphNode[0]); } }