Class EdgePathHelper
Helper class for creating edge path geometries between points.
public static class EdgePathHelper
- Inheritance
-
EdgePathHelper
- Inherited Members
Methods
CalculateAngle(Point, Point)
Calculates the angle of a line at a given point (for arrow direction).
public static double CalculateAngle(Point from, Point to)
Parameters
fromPointtoPoint
Returns
CalculateArrowAngle(Point, Point, PortPosition?, double)
Calculates the arrow angle using a hybrid approach that combines port position (logical direction) with path geometry (visual direction) for consistent, accurate arrow rendering.
public static double CalculateArrowAngle(Point tip, Point fromPoint, PortPosition? targetPortPosition = null, double angleThreshold = 0.7853981633974483)
Parameters
tipPointThe arrow tip point (target position).
fromPointPointThe point the edge comes from (preceding the tip).
targetPortPositionPortPosition?Optional port position for logical direction hint.
angleThresholddoubleAngle tolerance in radians for preferring port direction (default: π/4 = 45°).
Returns
- double
The angle in radians for the arrow direction.
Remarks
This method implements a hybrid approach: 1. If port position is provided, get the expected angle from port side 2. Calculate the actual segment angle from path geometry 3. If segment angle is within threshold of expected, use port direction (cleaner) 4. Otherwise, use actual segment direction (handles unusual routing)
This ensures consistency between custom renderers and default rendering while handling edge cases like curved paths or unusual node arrangements.
CreateArrowMarker(Point, double, double, bool)
Creates an arrow marker geometry at the specified point.
public static PathGeometry CreateArrowMarker(Point point, double angle, double size = 10, bool closed = false)
Parameters
pointPointThe tip of the arrow.
angledoubleThe angle of the arrow in radians (0 = pointing right).
sizedoubleThe size of the arrow.
closedboolIf true, creates a filled triangle; if false, creates open arrow lines.
Returns
- PathGeometry
CreateBezierPath(Point, Point, bool)
Creates a bezier path geometry between two points.
public static PathGeometry CreateBezierPath(Point start, Point end, bool horizontalBias = true)
Parameters
startPointendPointhorizontalBiasbool
Returns
- PathGeometry
CreateMultiSegmentBezierPath(IReadOnlyList<Point>)
Creates a multi-segment bezier path through waypoints. Uses smooth curves between consecutive waypoints.
public static PathGeometry CreateMultiSegmentBezierPath(IReadOnlyList<Point> points)
Parameters
pointsIReadOnlyList<Point>
Returns
- PathGeometry
CreateMultiSegmentSmoothPath(IReadOnlyList<Point>, double)
Creates a multi-segment smooth step path with rounded corners through waypoints.
public static PathGeometry CreateMultiSegmentSmoothPath(IReadOnlyList<Point> points, double cornerRadius = 10)
Parameters
pointsIReadOnlyList<Point>cornerRadiusdouble
Returns
- PathGeometry
CreateMultiSegmentStepPath(IReadOnlyList<Point>)
Creates a multi-segment step path through waypoints.
public static PathGeometry CreateMultiSegmentStepPath(IReadOnlyList<Point> points)
Parameters
pointsIReadOnlyList<Point>
Returns
- PathGeometry
CreateMultiSegmentStraightPath(IReadOnlyList<Point>)
Creates a multi-segment straight line path through waypoints.
public static PathGeometry CreateMultiSegmentStraightPath(IReadOnlyList<Point> points)
Parameters
pointsIReadOnlyList<Point>
Returns
- PathGeometry
CreatePath(Point, Point, EdgeType, double)
Creates a path geometry between two points based on the edge type.
public static PathGeometry CreatePath(Point start, Point end, EdgeType edgeType, double cornerRadius = 10)
Parameters
startPointThe start point of the path.
endPointThe end point of the path.
edgeTypeEdgeTypeThe type of edge path to create.
cornerRadiusdoubleCorner radius for SmoothStep edges. Uses default if not specified.
Returns
- PathGeometry
CreatePathWithWaypoints(Point, Point, IReadOnlyList<Point>?, EdgeType, double)
Creates a path geometry through waypoints based on the edge type.
public static PathGeometry CreatePathWithWaypoints(Point start, Point end, IReadOnlyList<Point>? waypoints, EdgeType edgeType, double cornerRadius = 10)
Parameters
startPointThe start point of the path.
endPointThe end point of the path.
waypointsIReadOnlyList<Point>Optional intermediate waypoints.
edgeTypeEdgeTypeThe type of edge path to create.
cornerRadiusdoubleCorner radius for SmoothStep edges. Uses default if not specified.
Returns
- PathGeometry
CreateSmoothStepPath(Point, Point, double)
Creates a smooth step path with rounded corners between two points.
public static PathGeometry CreateSmoothStepPath(Point start, Point end, double cornerRadius = 10)
Parameters
startPointendPointcornerRadiusdouble
Returns
- PathGeometry
CreateStepPath(Point, Point)
Creates a step (right-angle) path between two points. The path goes horizontally from start, then vertically, then horizontally to end.
public static PathGeometry CreateStepPath(Point start, Point end)
Parameters
startPointendPoint
Returns
- PathGeometry
CreateStraightPath(Point, Point)
Creates a straight line path between two points.
public static PathGeometry CreateStraightPath(Point start, Point end)
Parameters
startPointendPoint
Returns
- PathGeometry