Nowadays there is a strong case for TAU.
Mathematicians and teachers are organically adopting it. _(any khan academics here?)_
I just coded (discovering for the first time with immense delight this beautiful software that is godot) a simple script to rotate like a trackball a Spatial
node from mouse inputs, and the code is easier to understand with whole rotations (TAU) as baseline instead of half-rotations (PI).
Here's the excerpt :
var TAU = 2*PI
var t = node.get_transform()
var up = t.xform_inv(cameraUp)
t = t.rotated(up, tangent.x * TAU)
I'd suggest going as far as to add a deprecation notice to PI
, suggesting TAU
, but maybe it's too soon.
This is a very opinionated feature request, with a hint of a pedagogic stance, so I'm not sure you all will accept this. It's a breaking change, too, for people who defined TAU already.
But it is future-oriented and rationally justified ; waiting for the world to change is alwayss easy, rarely usseful.
_(I just half-quoted Professor Quirrel, so I'm not going to quote Gandhi afterwards, but you get the idea)_
Let's see them thumbs ! What do you think ?
There might not be so much harm in adding a TAU
constant. But it's too much to even hint the deprecation of PI
. Even if it is the case that everyone is changing, most of the material you can find today will be based on Pi (and likely won't even mention Tau). When that table turns, I could reconsider. Math is already a difficult topic, there's no reason for a game engine to make it even more inaccessible.
Also, the "strong case for Tau" is debatable, and I'm not sure if there's really a transition going on. In any case, it's not Godot's role to enforce mathematical changes, the engine should just follow the enforced standards (which is using Pi for now).
Or maybe we can get a compromise and use the PAU
constant.
I honestly thought OP was joking/trolling...
There might not be so much harm in adding a TAU constant.
Yay ! Can I try to, then ? _(unless someone else wants to)_
But it's too much to even hint the deprecation of PI.
:trollface:
the "strong case for Tau" is debatable
It is a debate, but look closely at it ! (tau, pi) – (TL;DR) It hangs on whether you want to define the constant as the _circumference_ or the _area_ of the unit circle. I submit this : τ is the circle constant, and π is the disc constant.
The disc being the integration of the circle over the radius, one could consider the circle being a more basic axiom of mathematics.
Pi still has uses as the disc constant, that's what most of the pi manifesto is about.
I'm not sure if there's really a transition going on
I've talked with teachers and scientists (from work, by chance) that started to use and teach Tau. They say the transition is going to take decades, generations. They're confident it will happen because once you start using Tau, you realize most of the times you use circles, not discs, and Tau makes that simpler. Okay, there's a lot of discs in games ; still, it makes trigonometry easier in practice, and we do a lot of that as well.
I really hope you won't reject this outright but give it some thought. I will add it for myself anyway, but I'd rather not maintain a fork, and I really think this would be an appropriate addition to Godot, because, well, it is _that_ kind of amazing.
Here's another example of a need for TAU
, in Godot's primitives plugin :
const TWO_PI = PI * 2
I added the TAU
constant to Godot, and I found PI
's documentation to be confusing :
Constant that represents how many times the diameter of a circumference fits around its perimeter.
Would you be open to rewriting this definition into something clearer, along the way ?
Wikipedia says :
Originally defined as the ratio of a circle's circumference to its diameter
So, something like :
Constant that represents the ratio of a circle's circumference to its diameter.
The disc constant, the area of the unit circle.
because it goes well along TAU
's definition :
The circle constant, the circumference of the unit circle.
There's also this, to keep as close as possible to the initial wording and current understanding of PI
:
Constant that represents how many times the diameter of a circle fits around its perimeter.
To be honest nobody cares about the documentation of PI in Godot's API, so just use whatever seems appropriate.
People just need to know it exists and that its name is PI
, the documentation could be "The PI constant you learned about in math at school." that it wouldn't make much difference. Users are not learning math via Godot, they're just using it and need to know what constants and functions are available.
Most helpful comment
There might not be so much harm in adding a
TAU
constant. But it's too much to even hint the deprecation ofPI
. Even if it is the case that everyone is changing, most of the material you can find today will be based on Pi (and likely won't even mention Tau). When that table turns, I could reconsider. Math is already a difficult topic, there's no reason for a game engine to make it even more inaccessible.Also, the "strong case for Tau" is debatable, and I'm not sure if there's really a transition going on. In any case, it's not Godot's role to enforce mathematical changes, the engine should just follow the enforced standards (which is using Pi for now).
Or maybe we can get a compromise and use the
PAU
constant.