Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RAD does not equal one radian #197

Open
no-lex opened this issue Jan 22, 2021 · 6 comments
Open

RAD does not equal one radian #197

no-lex opened this issue Jan 22, 2021 · 6 comments
Labels
good first issue This issue is easy to resolve for a novice inconsistency Issues that break convention rather than being faulty implementations

Comments

@no-lex
Copy link
Member

no-lex commented Jan 22, 2021

The radian is a ratio equal to 180/π degrees or 1/(2π) revolutions. Because (of course) tools.h has to do everything its way, the macro RAD is defined as π/180 which is, of course, totally wrong.

The reason that RAD is inverted is for performance (division is slow and multiplication is fast), but this does not excuse the poor naming of the macro.

@no-lex no-lex added the inconsistency Issues that break convention rather than being faulty implementations label Jan 22, 2021
@no-lex no-lex added the good first issue This issue is easy to resolve for a novice label Jan 24, 2021
@b-sharman
Copy link
Member

b-sharman commented Feb 17, 2021

Does this mean that the value of RAD should be changed, or that the macro name RAD should be changed?

@no-lex
Copy link
Member Author

no-lex commented Feb 18, 2021

Yes

@no-lex
Copy link
Member Author

no-lex commented Feb 18, 2021

(actually, it's probably better to change the name, on the outside case that the division vs multiplication speed matters)

@no-lex
Copy link
Member Author

no-lex commented Feb 23, 2021

On further inspection, there are /RAD events where the RAD constant is the divisor, making it not only counterproductive but also confusing to use the inverse radian for RAD.

no-lex added a commit that referenced this issue Jun 8, 2022
use new reciprocal RAD for #197
@Duskhorn
Copy link
Contributor

I've taken a look at this and the codebase has both angle*RAD and angle/RAD as @no-lex said

Is the division vs multiplication thing really that impactful? If so, whould we make an INV_RAD = 180/π constant and change the codebase accordingly?

If not, the value of RAD should be π/180 imho
I could start working on this once I have a clearer way of doing this

@Duskhorn
Copy link
Contributor

@no-lex Actually why isn't this issue closed? lol

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue This issue is easy to resolve for a novice inconsistency Issues that break convention rather than being faulty implementations
Projects
None yet
Development

No branches or pull requests

3 participants