I'm developing a 2-dimensional physics simulator (it includes gravity, electric force, and collisions as of now, between spherical objects of varying masses, charges, and radii). I'm trying to improve my collision algorithm, though, and I'm not sure how to handle coefficients of restitution; currently the program allows a user to choose a global coefficient of restitution that is applied to all collisions, but in reality it varies with materials. However, it is impractical to require the user to select a coefficient between every group of two materials; I need to give the objects some sort of number representing their material, and then using that, their velocities, their masses, their temperatures, or whatever I need to use, determine a coefficient of restitution for each collision. How ought I to go about this? Is there some sort of formula relation a coefficient of restitution between two objects to their respective coefficients of restitution in collision with a third? Is there some formula relating the coefficient of restitution to other constants and to the properties of an object--or, at least, do you know what variables the coefficient is proportional to? Thanks.