The way this is done on phase (correlation) meters in audio equipment is rather simple:
Phase = arctan(L/R)
With phase of 45 or 225 = 1, and phase of 135 and 315 (-45) is -1.
Essentially, the Y Axis is the L, and the X axis is the R. The phase is simply the polar angle of the vector between the two.
This type of meters will show 1 if the signal is mono, and -1 if the left and right are perfectly phase inverted.
Notice however, that phase meters of this type also account for the magnitude in the polar coordinates. So:
Magnitude = (L^2 + R^2)^1/2
Thus the actual meter display is a normalised version of:
Correlation = Phase * Magnitude
I'm not sure that satisfies your requirements, but this answers the question in the subject.
The calculation described above is for a common meter found in many audio production products. It's prime purpose is to ensure that the programme material doesn't suffer for phase inversion between the left and right channels, which can cause issues when the material is cut to vinyl or transmitted over the FM radio medium (essentially, any system that uses MS by mechanical or transmission means.
Such is the vertical meter at the bottom of this screenshot:
From the manual:
A correlation of +1 (the far right position) means that the left and right channels correlate 100%—they are completely in phase.
A correlation of 0 (the center position) indicates the widest permissible left/right divergence, often audible as an extremely wide stereo effect.
Correlation values lower than 0 indicate that out-of-phase material is present, which can lead to phase cancellations if the stereo signal is combined into a monaural signal.
How it Works
It the content of the left and right channel is identical (so both sample values are X) the phase meter shows 1. If the content is perfectly out of phase (so L = X, R = -X), the phase meter shows -1.
Looking at the graph below, the green arrow represents perfect in-phase relationship between the left and right channels, and the red one perfect out-of-phase relationship between the two. In this type of meter, if one of the channels carries silence (but not the other) the meter goes to 0 (so 0, 90, 180, 270 degrees).