Signed-off-by: Mayank Mohapatra <125661248+Mayank77maruti@users.noreply.github.com>
This commit is contained in:
Mayank Mohapatra 2025-02-23 18:46:31 +00:00
parent 5b28501fd9
commit 090a225ec0
4 changed files with 9 additions and 10 deletions

View file

@ -55,7 +55,7 @@ func positionObjects(objects []*d2graph.Object, radius float64) {
angleOffset := -math.Pi / 2 angleOffset := -math.Pi / 2
for i, obj := range objects { for i, obj := range objects {
angle := angleOffset + (2*math.Pi*float64(i)/numObjects) angle := angleOffset + (2 * math.Pi * float64(i) / numObjects)
x := radius * math.Cos(angle) x := radius * math.Cos(angle)
y := radius * math.Sin(angle) y := radius * math.Sin(angle)
obj.TopLeft = geo.NewPoint( obj.TopLeft = geo.NewPoint(
@ -141,7 +141,6 @@ func createCircularArc(edge *d2graph.Edge) {
} }
} }
// clampPointOutsideBox walks forward along the path until it finds a point outside the box, // clampPointOutsideBox walks forward along the path until it finds a point outside the box,
// then replaces the point with a precise intersection. // then replaces the point with a precise intersection.
func clampPointOutsideBox(box *geo.Box, path []*geo.Point, startIdx int) (int, *geo.Point) { func clampPointOutsideBox(box *geo.Box, path []*geo.Point, startIdx int) (int, *geo.Point) {
@ -163,7 +162,7 @@ func clampPointOutsideBox(box *geo.Box, path []*geo.Point, startIdx int) (int, *
} }
return i, path[i] return i, path[i]
} }
return len(path)-1, path[len(path)-1] return len(path) - 1, path[len(path)-1]
} }
// clampPointOutsideBoxReverse works similarly but in reverse order. // clampPointOutsideBoxReverse works similarly but in reverse order.