Whats the quad for the initial universe?
It’s between (-R, -R) and (+R, +R) where R is the radius of the universe. Don’t forget to check that each body is in the universe before inserting it into the tree. I get a stack overflow error? Most likely you have an infinite recursive loop in your insert method. Also, be sure that when you insert a body that it will only end up in one of the four quads, e.g., use if-else-if-else-if-else or ensure that your contains method will only place a point in at most one of the four sub-quadrants of a quad. How do I tell if a tree node is internal or external? Check if all four children are null. Consider writing a helper method isExternal() to check this. How do I calculate center-of-mass of a body with an aggregate body? Just treat the aggregate body like any other body – the center of mass formula works even if one body is already the center of mass of several other bodies. None of the particles appear on the screen. What could I be doing wrong? Make sure that your particles are not being d