Interface CurvatureSource
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
A source of explicit per-edge curvature factors that supplements the implicit antiparallel
curvature computed automatically by
VectorTraversal.
The total curvature applied to an edge during export is the sum of the explicit
curvature returned by this source and the implicit antiparallel curvature computed by
VectorTraversal:
total = curvatureOf(edge) + implicitAntiparallelCurvature(edge)
This matches the rule used by GraphCanvas.computeEdgeShape (at the line
getCurvature(edge) + implicit.getOrDefault(edge, 0.0)): the explicit curvature set by
the user in the canvas is added to the implicit curvature that separates antiparallel edge pairs.
For self-loop edges the implicit antiparallel curvature is always zero, so the total reduces to
the explicit curvature alone — again matching the canvas behaviour.
Callers that have no explicit curvature to contribute (automated pipelines, tests that do not
exercise explicit curvature) should pass none(), which makes the total curvature of
every edge equal to the implicit antiparallel curvature alone.
- Author:
- posenato
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptiondoublecurvatureOf(Edge edge) Returns the explicit curvature factor foredge.static CurvatureSourcenone()Returns a neutral curvature source that returns zero for every edge.
-
Method Details
-
curvatureOf
Returns the explicit curvature factor foredge.- Parameters:
edge- the edge whose explicit curvature is requested, not null- Returns:
- the explicit curvature factor;
0.0means no explicit curvature is set for this edge
-
none
Returns a neutral curvature source that returns zero for every edge. When this source is used, the total curvature of each edge equals only the implicit antiparallel curvature computed byVectorTraversal, reproducing the behaviour of a fresh canvas in which no explicit curvature has ever been set.- Returns:
- the neutral curvature source, never null
-