It looks like your accumulation is trying to sum polar coordinates. You can't do that. I.e., if you have (r1,theta1) and (r2,theta2), you can't directly sum them in the fashion you are trying to do in polar coordinates. You would have to convert them back to cartesian coordinates, do the sum, and then convert back to polar to get your new r and theta values. Or do some combination of Law of Cosines and Law of Sines to get the new polar result. I don't see how you can get your proposed scheme to work.