Enhance path finding using path cost

This commit is contained in:
2026-08-11 02:01:08 +02:00
parent f0accc8df8
commit 03c91fb55a
3 changed files with 49 additions and 34 deletions
+1 -1
View File
@@ -3,7 +3,7 @@ namespace PamhagenSysCtrl.Helpers.Pipeline {
INode Start,
IEnumerable<(IEdge Edge, INode Node)> Hops)
{
public readonly double Bends => Hops.Sum(h => (h.Node is not Valve && h.Node is not PipeJoin ? 1 : 0) + (h.Edge.Start.CenterX != h.Edge.End.CenterX && h.Edge.Start.CenterY != h.Edge.End.CenterY ? 1 : 0));
public readonly int Bends => Hops.Sum(h => (h.Node is not Valve && h.Node is not PipeJoin ? 1 : 0) + (h.Edge.Start.CenterX != h.Edge.End.CenterX && h.Edge.Start.CenterY != h.Edge.End.CenterY ? 1 : 0));
public readonly double Length => Hops.Sum(h => Math.Abs(h.Edge.Start.CenterX - h.Edge.End.CenterX) + Math.Abs(h.Edge.Start.CenterY - h.Edge.End.CenterY));
}
}