]> git.itanic.dy.fi Git - sdl-planets/commitdiff
setup_planet: Concentrate the mass mostly in the middle of the system
authorTimo Kokkonen <kaapeli@itanic.dy.fi>
Fri, 2 Apr 2010 09:59:03 +0000 (12:59 +0300)
committerTimo Kokkonen <kaapeli@itanic.dy.fi>
Fri, 2 Apr 2010 09:59:03 +0000 (12:59 +0300)
This will increase the stability of the created planetar system. Most
of the central planets collapse into one large object, which will keep
most of the system more stable.

Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
planet.c

index 1cf5d1ef50251cf947edf7f58f5b19156a8291d5..c7b01a05995f91442d0c550df6e259a49c4e2dc4 100644 (file)
--- a/planet.c
+++ b/planet.c
@@ -51,7 +51,7 @@ static void setup_planet(struct planet *p, double mass, double total_mass,
        double velocity;
        double distance;
 
-       distance = radius * get_random_double();
+       distance = radius * pow(get_random_double(), 2);
        velocity = sqrt(total_mass / radius);
 
        velocity *= pow(distance / radius, 0.2);