14 struct list_head list;
18 unsigned char r, g, b;
20 /* info about the planets in sub branches */
21 float tree_area; /* total area occupied by the tree */
22 double tree_mass; /* total mass occupied by the tree */
25 struct planet_search_iterator {
26 struct quadtree_iterator qt_iterator;
27 struct vector limit[2];
32 #define list_to_planet(list_head) container_of((list_head), struct planet, list)
34 #define tree_to_planet(qt) container_of((qt), struct planet, tree)
36 #define qt_itr_to_planet_itr(qt) \
37 container_of((qt), struct planet_search_iterator, qt_iterator)
39 void init_planet(struct planet *p);
40 void create_planets(struct planet *p, int num, double total_mass,
42 void draw_planet(SDL_Surface *screen, struct planet *p, const struct camera *);
43 int gravitize_planets(struct planet *a, struct planet *b, const double time);
44 struct planet *merge_planets(struct planet *a, struct planet *b);
45 struct planet *move_planet(struct planet *p, const double time);
46 void print_planet(const struct planet *p);
48 int planet_spatial_compare(struct quadtree *a, struct quadtree *b);
49 int planet_search_rectangular(struct quadtree *node,
50 struct quadtree_iterator *itr);
51 void planet_draw_iterator(struct quadtree *node, struct quadtree_iterator *it);