Edwin,
Nice analysis, initially as mine, but Declan's code doesn't just achieve your cos(a.b) curve (good but not quite complete) it produces the paired offset Cos2 curves of Bell, of Born's rule ('Law'), and indeed Malus's Law (Intensity = the square).!!
While it looks to simply use 2 spin states it's one step more complex than that, as I show in my own essay which explanation & experiment underpins Declan's code.
One state is 'curl' (max at poles) but that goes to zero at the equator and has inverse values (complementarity) with the LINEAR left/right (or up/down) over 180o momentum at the EQUATOR. So which is also then zero at poles. Both change by cos theta as my full explanation why.
I also show how just then adding 'c' in the electrons local centre of mass frame for re-emissions unifies the mechanism with Einsteins final ('52) explanation of SR!! I suspect we really may be on the verge of a revolution in physics!
Peter