Наконец-то я реализовал свой алгоритм:
fun roundedRectanglePerimeterPoints(positions: Int, rect: RectF, xRadius: Float, yRadius: Float): List<PointF> {
val segments = listOf(
Line(rect.centerX(), rect.bottom, rect.left + xRadius, rect.bottom),
EllipseQuarter(rect.left + xRadius, rect.bottom - yRadius, xRadius, yRadius, EllipseQuarter.Direction.SOUTH_WEST),
Line(rect.left, rect.bottom - yRadius, rect.left, rect.top + yRadius),
EllipseQuarter(rect.left + xRadius, rect.top + yRadius, xRadius, yRadius, EllipseQuarter.Direction.NORTH_WEST),
Line(rect.left + xRadius, rect.top, rect.right - xRadius, rect.top),
EllipseQuarter(rect.right - xRadius, rect.top + yRadius, xRadius, yRadius, EllipseQuarter.Direction.NORTH_EAST),
Line(rect.right, rect.top + yRadius, rect.right, rect.bottom - yRadius),
EllipseQuarter(rect.right - xRadius, rect.bottom - yRadius, xRadius, yRadius, EllipseQuarter.Direction.SOUTH_EAST),
Line(rect.right - xRadius, rect.bottom, rect.centerX(), rect.bottom)
)
val perimeter = segments.sumByDouble { it.length.toDouble() }
val distancePerPlayer = perimeter / positions
val playerPoints = mutableListOf<PointF>()
for (i in 0 until positions) {
var distanceFromOrigin = i * distancePerPlayer.toFloat()
var pathIndex = 0
while (distanceFromOrigin > segments[pathIndex].length) {
distanceFromOrigin -= segments[pathIndex].length
pathIndex++
}
val p = segments[pathIndex].pointForDistance(distanceFromOrigin)
playerPoints.add(p)
}
return playerPoints
}