1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Between -180 and 180 degrees (convert a larger angle)

  1. Mar 27, 2015 #1
    I need a formula to put an angle between -180 and 180 and recycle if not in the range.

    I can do it between 0 and 360:

    angle = deg - 360 * floor(deg / 360)

    just not between -180 and 180

    Oh and what is the name of this function?
     
  2. jcsd
  3. Mar 27, 2015 #2
    Take what you have and subtract 180.

    Unless I'm not understanding what you're asking.
     
  4. Mar 28, 2015 #3

    mathman

    User Avatar
    Science Advisor
    Gold Member

    Function is modulo (mod). What you are asking for is mod 360.
     
  5. Mar 28, 2015 #4

    WWGD

    User Avatar
    Science Advisor
    Gold Member

    EDIT Just add ## \pi ## to your formula and you will hit an angle in that interval. The interval [-180,180] is the translation of [0,360] by ##- \pi ##
     
    Last edited: Mar 28, 2015
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Between -180 and 180 degrees (convert a larger angle)
  1. Product between angles (Replies: 8)

Loading...