package quality
Import Path
github.com/pancsta/d2/d2layouts/d2talalayout/internal/quality (on go.dev)
Dependency Relation
imports 10 packages, and imported by 2 packages
Involved Source Files
crossings.go
evaluation_guard.go
inspection.go
inspection_geometry.go
inspection_labels.go
labels.go
score.go
Package quality evaluates completed TALA layouts. It reads layoutgraph's
positioned graph model without mutating it; lower scores are better.
Package-Level Type Names (total 2)
Metrics describe a positioned drawing for bounded repair triggers and safety
checks. They are not weights or ordering components in the layout score.
Obstruction measurements cover rectangular shapes and polygonal routes only.
Crossings float64
Detour float64
NodeOverlaps int64
RouteLength float64
RouteObstructions int64
TextOcclusions int64
func Inspect(ctx context.Context, graph *layoutgraph.Graph) (Metrics, error)
Score preserves the original TALA penalty and separate area tie-breaker.
Diagnostic geometry from Inspect is deliberately absent from this ordering.
Area float64
Penalty float64
Compare orders penalties exactly, then areas, with the same handling of
non-finite values as the original seed-result comparator.
func Evaluate(ctx context.Context, graph *layoutgraph.Graph) (Score, error)
func Score.Compare(other Score) int
Package-Level Functions (total 3)
Evaluate adapts the original evaluator for bounded refinement callers.
EvaluateWithArea returns the human-facing layout score and the graph area
separately. Area is a strict tie-breaker: encoding it into the float score
made 100 smaller than 99 (0.1 versus 0.99) and could outweigh real layout
differences.
Inspect reads diagnostics without mutating the graph or influencing Score.
![]() |
The pages are generated with Golds v0.8.7. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |