Currently, non-attracting particles are simply implemented as vectors of positions and velocities, whereas attracting particles are encapsulated in a class. This should be changed to implement everything the same way.
The options are to implement everything as vectors of parameters, or as encapsulated objects. Since this project generally leans towards encapsulation and object-oriented programming, encapsulating all particles is probably best.
Overall, this should reduce complexity, reduce repetition in code and make future changes easier.
Non-attracting particles should have mass 0. Since a mass of zero is physically impossible, and because the acceleration is calculated by dividing force by mass, there must be a check within the tick that checks if the mass of the particle being accelerated is zero, and in this case treats it as a particle of nonzero mass, but simply does not attract other particles towards it.
Currently, the force of gravity between every pair of particles in the simulation is calculated twice. Since the force is equal, just opposite in direction, for each pair, this can be optimized to not recalculate the force. It should also mitigate or overcome the impact having to check if a particle's mass is zero adds to performance.
Currently, non-attracting particles are simply implemented as vectors of positions and velocities, whereas attracting particles are encapsulated in a class. This should be changed to implement everything the same way. The options are to implement everything as vectors of parameters, or as encapsulated objects. Since this project generally leans towards encapsulation and object-oriented programming, encapsulating all particles is probably best. Overall, this should reduce complexity, reduce repetition in code and make future changes easier. Non-attracting particles should have mass 0. Since a mass of zero is physically impossible, and because the acceleration is calculated by dividing force by mass, there must be a check within the tick that checks if the mass of the particle being accelerated is zero, and in this case treats it as a particle of nonzero mass, but simply does not attract other particles towards it. Currently, the force of gravity between every pair of particles in the simulation is calculated twice. Since the force is equal, just opposite in direction, for each pair, this can be optimized to not recalculate the force. It should also mitigate or overcome the impact having to check if a particle's mass is zero adds to performance.