calculatePlanetPlacements function
Implementation
List<PlanetPlacement> calculatePlanetPlacements(
HousePosition house,
List<String> planets,
) {
final placements = <PlanetPlacement>[];
final houseCenter = house.bounds.center;
// Calculate optimal positions for multiple planets using a circular distribution
final spacing = math.min(
house.bounds.width / (planets.length + 1),
house.bounds.height / (planets.length + 1),
);
for (int i = 0; i < planets.length; i++) {
final angle = (i * 2 * math.pi) / planets.length;
final radius = spacing / 2;
final x = houseCenter.dx + radius * math.cos(angle);
final y = houseCenter.dy + radius * math.sin(angle);
placements.add(PlanetPlacement(planets[i], Offset(x, y), angle));
}
return placements;
}