Gets a heuristic delegate function that returns the square distance dx^2 + dy^2 as a cost evaluation of the distance between two pieces of the routing grid.
Namespace: MindFusion.Diagramming
Assembly: MindFusion.Diagramming
C# Copy Code |
---|
public static RouteHeuristics DistSquare { get; } |
Visual Basic Copy Code |
---|
Public Shared ReadOnly Property DistSquare As RouteHeuristics |
A predefined RouteHeuristics delegate instance.
While generating a path, the routing algorithm evaluates pieces of the routing grid adjacent to the current one. It takes into account the cost for passing trough a piece and adds to that cost a heuristic value calculated by a RouteHeuristics delegate. So the smaller heuristic value a piece has, the greater the chance the found route to go through that piece.
DistSquare is a predefined delegate that assigns to pieces a heuristic value equaling the piece distance to the target raised to the second power. DistSquare can be assigned to the RouteHeuristics property. By returning larger values than the default heuristic function Distance, it makes the prediction part of the routing algorithm have greater impact on the evaluated routes.That would lead to faster path-finding, but the real cost functions might have less impact and thus the quality of the found routes could be low.
The following sample demonstrates how to use this property:
C# Copy Code |
---|
diagram.RoutingOptions.RouteHeuristics = RoutingOptions.DistSquare; |
Visual Basic Copy Code |
---|
Diagram.RoutingOptions.RouteHeuristics = RoutingOptions.DistSquare |