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