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

Add angular degrees #370

Closed
kammce opened this issue Jul 10, 2022 · 6 comments
Closed

Add angular degrees #370

kammce opened this issue Jul 10, 2022 · 6 comments

Comments

@kammce
Copy link

kammce commented Jul 10, 2022

Currently <units/generic/angle.h> contains radians, but doesn't have support for angular degrees. Are there plans to add this?

@kammce
Copy link
Author

kammce commented Jul 10, 2022

Also maybe adding the concept of rotations as well would be great.

@i-ky
Copy link
Contributor

i-ky commented Jul 11, 2022

There are plans, but there are technical difficulties (namely the transcendental conversion ratio between radians and degrees). See #99 and #195.

@kammce
Copy link
Author

kammce commented Jul 11, 2022

Gotcha! Thank you for the response.

I don't know where to put it in the discussion or issue but I'd like to throw my chip into the pi = 1 camp.

I do really like the idea of making pi = 1 or pi = 2. And by pi = 2, I really mean move away from radians as the basis for angles and use 1 revolution as the basis. So you can keep some integer factional of revolutions such as 0.5 rev = 180 deg = pi = 0.5 tau. Final conversion to a real radians number could be left up to the user or something like that.

@i-ky
Copy link
Contributor

i-ky commented Jul 12, 2022

Final conversion to a real radians number could be left up to the user

This will definitely become a source of errors, because people can't be trusted.

@kammce
Copy link
Author

kammce commented Jul 12, 2022

Final conversion to a real radians number could be left up to the user

This will definitely become a source of errors, because people can't be trusted.

Gotcha. Maybe only do the conversion to actual radians when the value is formatted to decimal?
Or better yet, format it to 12.455 x 2π. So completely side step the need to perform work with transandentals.
And if the user needs to get the real raw value like78.2571... in the output, then pi could be multiplied in using the representation type.

@chiphogg
Copy link
Collaborator

Your timing is impeccable! We are at the tail end of implementing #300, which will definitively resolve #195. All that remains is for the final PR, #368, to be reviewed and merged by @mpusz.

Once that is done, adding degrees should be trivial. (There may be more work needed to support other features, such as deciding how to print scale factors which contain irrational contributions, but the mechanics of working with a degree unit should already be supported.)

It should also be a lot more robust than "pi = 1", a concept which I frankly do not understand. pi is a dimensionless number; we cannot "set it equal to 1" by a choice of units in the same way that high-energy physicists do for c or h-bar (or, for that matter, the way that mathematicians and the SI do for the "Cotes angle" of 1 radian). Fortunately, we won't need to consider this route, as we already have something better.

Incidentally, with the new Magnitude representation, even though the "base unit" for angles will be the radian, we will still be able to perform exact integer conversions between, e.g., degrees and revolutions.

@mpusz mpusz closed this as completed in 8b534c8 Aug 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants