Calculating Angle Differences
Click the above-left picture of the Angle Difference Calculator applet to start the application.
Calculating the Difference Between Angles
The difference between two angles shouldn't be two difficult to understand: Math.abs(Angle1-Angle2), right? Unfortunately, you must take that point where the arc between the two angles crosses the line where the angle jumps from 359 to 0, or in the land of Actionscript, 180 to -180.
Seeing as I'd bumped my head against this more than once, I decided to make a post about it just so that I'd have an easy reference. As alway, if it helps anyone else, all the better.
Seeing as the swf pretty much sums it up, there isn't much to say here. Use the sliders to rotate the different angles. I'm interested in absolute differences of 90°, so if you have a different angle, adjust accordingly. The important concept is to identify the quadrant of the angles and adjust by 360° if that boundary is crossed. The code I used is visible in the swf.
The finsihed product appears below, but if you prefer, click the picture above to see it at a size that won't cause eyestrain.