Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 588717
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T15:20:51+00:00 2026-05-13T15:20:51+00:00

There are two views: viewA and viewB . Both are rotated. The coordinate system

  • 0

There are two views:

viewA and viewB. Both are rotated.

The coordinate system for rotation is weird: It goes from 0 to 179,999999 or -179,99999 degrees. So essentially 179,99999 and -179,99999 are very close together!

I want to calculate how much degrees or radians are between these rotations.

For example:

viewA is rotated at 20 degrees

viewB is rotated at 30 degrees

I could just do: rotationB – rotationA = 10.

But the problem with this formula:

viewA is rotated at 179 degrees
viewB is rotated at -179 degrees

that would go wrong: rotationB – rotationA = -179 – 179 = -358

358 is plain wrong, because they are very close together in reality. So one thing I could do maybe is to check if the absolute result value is bigger than 180, and if so, calculate it the other way around to get the short true delta. But I feel this is plain wrong and bad, because of possible floating point errors and unprecision. So if two views are rotated essentially equally at 179,99999999999 degrees I might get a weird 180 or a 0 if I am lucky.

Maybe there’s a genius-style math formular with PI, sine or other useful stuff to get around this problem?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T15:20:52+00:00Added an answer on May 13, 2026 at 3:20 pm

    EDIT: Original answer (with Mod) was wrong. would have given 180 – right answer in certain circumstances (angles 30 and -20 for example would give answer of 130, not correct answer of 50):

    Two correct answers for all scenarios:

    If A1 and A2 are two angles (between -179.99999 and 179.99999,
    and Abs means take the Absolute Value,
    The angular distance between them, is expressed by:

    Angle between = 180 - Abs(Abs(A1 - A2) - 180)

    Or, using C-style ternary operator:

    Angle between = A1 < 180 + A2? A1 - A2: 360 + A1 - A2
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

There are two weird operators in C#: the true operator the false operator If
Suppose there are two scripts Requester.php and Provider.php, and Requester requires processing from Provider
They both inherit ViewAnimator . I know that ViewSwitcher allows only two views, while
My application has two views, a live mode and a preview mode. Both of
I have two questions, both related to the same view: so there is view
There are two popular closure styles in javascript. The first I call anonymous constructor
There are two popular naming conventions: vc90/win64/debug/foo.dll foo-vc90-win64-debug.dll Please discuss the problems/benefits associated with
There are two scenarios I need to clarify: An executable compiled with .NET 3.5
There are two databases in SQL Server 2005: One called A and another one
There are two schools of thought on how to best extend, enhance, and reuse

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.