1
$\begingroup$

I am unsure how to even ask this.

I have a circle and I am at point 0. I add -90, which would bring me at 270. What would this look like as an equation? where -90 could be any negative number from -1 to - 359 and the result would be the positive point.

Sorry, I have not thought about this kind of math since middle school.

4 Answers 4

1

If you have some angle $X$ (assuming degrees), and you have to find its measure that is in interval $[0, 360)$, then the following might help:

If $X$ is any angle, and if we ignore multiple turns, then there is a corresponding angle that is in $[0,360)$. When we're talking about angles, then following holds $X = X + 360k, k\in \mathbb{Z}$, if we ignore the turns. In your case we have $-90 + 360k, k = 0$, choose $k=1$ and get $-90+360=270$.

More generally: Let $X$ be some angle in degrees. Then if we ignore multiple turns, its corresponding angle X' in $[0, 360)$ is determined by following formula: X' = X - \lfloor X/360 \rfloor \cdot 360

  • 0
    @Oh Danny Boy: You're welcome, and if you don't understand the notation feel free to ask.2011-03-29
0

You could say $0-90\equiv 270 (mod 360)$

  • 0
    @Oh,leif wants you to MAKE that function. I am definitely shocked that javascript does not handle mod's well. Maybe in that case, try what was suggested by leif, that ought to work. The reason it fails is because -90 is perfectly fine as a mod 360. So, perhaps another solution is if value=mod(0-x)<0, then value=360+x.2011-03-29
0

If you're working solely with negative inputs in the range -1 to -359, adding 360 will give you the positive degree measure of an equivalent rotation.

  • 0
    @Oh Danny Boy: In that case, and since it seems like you're programming it, my inclination would be to use a while loop: `while rotation < 0: rotation += 360`, followed by using the remainder operator to handle anything over 360: `rotation = rotation % 360`. That way, the code can handle any rotation magnitude, even above 360 and below -359.2011-03-29
0

Circle is 360 degrees. If you go negative just take 360 - 90