]> git.itanic.dy.fi Git - sdl-planets/commitdiff
reshape_planet: Better size estimation for the planet
authorTimo Kokkonen <kaapeli@itanic.dy.fi>
Sun, 7 Mar 2010 12:35:40 +0000 (14:35 +0200)
committerTimo Kokkonen <kaapeli@itanic.dy.fi>
Sun, 7 Mar 2010 12:35:40 +0000 (14:35 +0200)
The size is now proprtional to the cubic root of the planet mass.

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

index d268829ff7366c906994eea472a138b46a2d93d9..9dcf8d890c1ec529fb70e21e2d23b3d8ee242c86 100644 (file)
--- a/planet.c
+++ b/planet.c
@@ -18,7 +18,7 @@ static void putpixel(struct SDL_Surface *screen, const int x, const int y,
 
 static void reshape_planet(struct planet *p)
 {
-       p->size = sqrt(p->mass / 100);
+       p->size = pow(p->mass / 100, 1 / 3.0);
 }
 
 void init_planet(const SDL_Surface *screen, struct planet *p)