Table of Contents

Class EdgePathHelper

Namespace
FlowGraph.Avalonia.Rendering
Assembly
FlowGraph.Avalonia.dll

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

from Point
to Point

Returns

double

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

tip Point

The arrow tip point (target position).

fromPoint Point

The point the edge comes from (preceding the tip).

targetPortPosition PortPosition?

Optional port position for logical direction hint.

angleThreshold double

Angle 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

point Point

The tip of the arrow.

angle double

The angle of the arrow in radians (0 = pointing right).

size double

The size of the arrow.

closed bool

If 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

start Point
end Point
horizontalBias bool

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

points IReadOnlyList<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

points IReadOnlyList<Point>
cornerRadius double

Returns

PathGeometry

CreateMultiSegmentStepPath(IReadOnlyList<Point>)

Creates a multi-segment step path through waypoints.

public static PathGeometry CreateMultiSegmentStepPath(IReadOnlyList<Point> points)

Parameters

points IReadOnlyList<Point>

Returns

PathGeometry

CreateMultiSegmentStraightPath(IReadOnlyList<Point>)

Creates a multi-segment straight line path through waypoints.

public static PathGeometry CreateMultiSegmentStraightPath(IReadOnlyList<Point> points)

Parameters

points IReadOnlyList<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

start Point

The start point of the path.

end Point

The end point of the path.

edgeType EdgeType

The type of edge path to create.

cornerRadius double

Corner 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

start Point

The start point of the path.

end Point

The end point of the path.

waypoints IReadOnlyList<Point>

Optional intermediate waypoints.

edgeType EdgeType

The type of edge path to create.

cornerRadius double

Corner 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

start Point
end Point
cornerRadius double

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

start Point
end Point

Returns

PathGeometry

CreateStraightPath(Point, Point)

Creates a straight line path between two points.

public static PathGeometry CreateStraightPath(Point start, Point end)

Parameters

start Point
end Point

Returns

PathGeometry