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 7029971
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T00:36:31+00:00 2026-05-28T00:36:31+00:00

I am working on a game and I am writing an Entity base class.

  • 0

I am working on a game and I am writing an Entity base class. Since many of the entities will behave like particles(2D) I want to use a normal instead of a rotation in degrees. However since I am using OpenGL I need to have the degree of the normal to rotate. What is the fastest way to convert from the normal to degrees and vice versa. I know that I can use trigonometric functions such as atan2 sin cos etc, but I am pretty sure there is a faster method. Any help or direction would be appreciated.

enter image description here

  • 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-28T00:36:32+00:00Added an answer on May 28, 2026 at 12:36 am

    If you’re constrained to two dimensions and you’re trying to convert a directional vector (x, y) to degrees from the x-axis, then atan2(y, x) is almost definitely going to be your fastest method, unless you’re constraining the possible values of x and y to some pretty trivial cases. To get the degrees from the y-axis, just use atan2(x, y), of course. This angle will be in radians. Multiply by 180/pi to convert to degrees. This should require a trivial amount of time.

    The figure you’re drawing suggests that atan2(x, y) * 180 / Math.PI will give you the results you desire.

    Don’t be concerned with speed unless you’ve profiled your code and have determined that there is a bottleneck in this calculation (which is unlikely).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on writing a Pong game and I've run across a problem. I'm
Alright so here is my issue. I'm working a game engine that will eventually
I'm working on a game (C#) that uses a Robocode-like programming model: participants inherit
I'm working on a game engine in C++ and I have methods like setColour
I'm working a game. The game requires entities to analyse an image and head
I'm practicing writing MVC applications. I have a Mastermind game, that I would like
I am writing a small shooting game using cocos2d. It's working good in simulator.
I'm working on developing a fairly robust 2D game engine as a base that
I'm working on a game engine in C#. The class I'm working on is
I'm currently working on a game whereby I will have a player traversing a

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.