Complex - polar formula now working

I think I made the polar formula block correctly, but I'm not seeing the correct result. It should be close (rounding error), but it's not.

I also found this: https://www.wevideo.com/view/1494665628

Alas, you need the angle in radians ccw from East, and we give you degrees cw from North. It's not a difficult conversion, but you have to do it in your program.

Edit: Maybe I'm wrong about radians, since our trig functions work on degrees. But the direction is important.

I never before noticed that the Snap! trig functions used degrees. I got it working now.

@bh Now why is this not working?
image
I redefined the Scheme reporter to detect polar form and convert it to rectangular form. The polar to rectangular for uses the formula in the originally reported reporter. The argument for the polar reporter must be radians because it's converted to degrees to be used with the trig reporters [because they use degrees]. The Scheme block reports in radians, but 7 is not approx. 0.7168

OK, so, as long as the angle is less than π it works fine. As soon as the angle is > π, it starts reporting negative angles, which makes sense because it's thinking of the angle as measured through the fourth and third quadrant. In your example, 7 > 2π, so you've gone all the way around the circle plus a little, where "a little" is 0.7168+ radians.

I understand now; the Scheme angle reporter reports the smallest coterminal and 7 and 0.7168... are coterminal. I'll try again and make sure the angle is < pi. We can think of that as the mod operation (angle mod 2pi).

mod2pi