package placementcost

Import Path
	github.com/pancsta/d2/d2layouts/d2talalayout/internal/placementcost (on go.dev)

Dependency Relation
	imports 10 packages, and imported by one package

Involved Source Files axis.go cluster.go Package placementcost evaluates candidate node geometry for placement and refinement algorithms. edge_length.go edge_length_scorer.go flow_continuity.go geometry.go graph.go obstruction_bounds.go symmetry.go
Package-Level Type Names (total 2)
/* sort by: | */
EdgeLengthOptions controls which geometric penalties contribute to edge length. EdgeAbductions supplies temporary endpoint ownership during placement. EnforceMinimumGap penalizes connected nodes that are too close together. IncludeNodeSizes measures distances between node boundaries instead of origins. PenalizeDirection adds cost when an edge departs from its preferred direction. func EdgeLength(ctx context.Context, graph *layoutgraph.Graph, options EdgeLengthOptions) (float64, error) func NewNodeEdgeLengthScorer(node *layoutgraph.Node, options EdgeLengthOptions) NodeEdgeLengthScorer func NodeEdgeLength(ctx context.Context, node *layoutgraph.Node, options EdgeLengthOptions) (float64, error) func NodesEdgeLength(ctx context.Context, nodes layoutgraph.Nodes, options EdgeLengthOptions) (float64, error)
NodeEdgeLengthScorer reuses incident-edge topology during one candidate sweep. Geometry is read from live nodes on every Score. The caller must keep edges, abductions, container/cluster membership, labels and directions unchanged until Close. In particular, a scorer must not survive a topology-changing swap. It is local mutable scratch and must not be shared between goroutines. Close releases scratch and makes the scorer unusable. It is safe to call more than once, including after an unsuccessful Score. Score has the same value and cancellation checkpoints as NodeEdgeLength while the scorer's topology remains fixed. The caller still charges the original scoring work budget for each candidate; reusing setup does not bypass limits. func NewNodeEdgeLengthScorer(node *layoutgraph.Node, options EdgeLengthOptions) NodeEdgeLengthScorer
Package-Level Functions (total 10)
AxisScore measures how strongly nodes share one visual axis.
ColumnCrossingCost scores crossings between labeled table-column edges.
ContainerAlignmentCost scores misalignment between peer containers.
EdgeLength evaluates the graph's placement cost and may populate its graph-owned edge-length cache.
GraphEdgeCrossings counts crossings between edges that do not share a node.
NewNodeEdgeLengthScorer starts an unprepared sweep. Preparation is lazy so cancellation and the caller's work charge occur at the original score point. The returned value must not be copied after its first Score; call Close when the sweep ends to release references retained by its pooled scratch.
NodeEdgeLength evaluates the incident-edge cost rooted at node.
NodesEdgeLength sums the edge-length cost rooted at each node in order.
NodesSymmetry sums local symmetry scores for nodes in order.
NodeSymmetry evaluates a node and the neighboring symmetry it contributes to.
Package-Level Constants (total 2)
IdealGapSize is the target separation between connected node boundaries.
SideEdgeSpacing is the minimum spacing used to distinguish aligned side ports.