This commit is contained in:
Mayank Mohapatra 2025-03-08 11:20:18 +00:00
parent fd8d01dfe6
commit f37193a2c6

View file

@ -42,7 +42,7 @@ func Layout(ctx context.Context, g *d2graph.Graph, layout d2graph.LayoutGraph) e
// calculateRadius computes a radius ensuring that the circular layout does not overlap.
// For each object we compute the half-diagonal (i.e. the radius of the minimal enclosing circle),
// then ensure the chord between two adjacent centers (2*radius*sin(π/n)) is at least
// 2*(maxHalfDiagonal + PADDING). We also add a safety factor (1.2) to avoid floating-point issues.
// 2*(maxHalfDiag + PADDING). We also add a safety factor (1.2) to avoid floating-point issues.
func calculateRadius(objects []*d2graph.Object) float64 {
if len(objects) < 2 {
return MIN_RADIUS