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 TAU constant #5

Open
jhirth opened this issue Sep 11, 2016 · 9 comments
Open

Add TAU constant #5

jhirth opened this issue Sep 11, 2016 · 9 comments

Comments

@jhirth
Copy link

jhirth commented Sep 11, 2016

With a TAU constant, defined as 2 * PI, a lot of the PI-related math becomes simpler. Furthermore, existing APIs, which use radians, such as CanvasRenderingContext2D.arc(), become easier to use because you can now express things in terms of turns. E.g. half a turn (TAU * 0.5) is half a circle.

Canvas example (JSFiddle):

const TAU = Math.PI * 2;
let canvas = document.querySelector('canvas');
let ctx = canvas.getContext('2d');
ctx.beginPath();
ctx.arc(
  50, // x
  50, // y
  40, // radius
  // startAngle
  // from 3 o'clock, 1/4 counter-clockwise turn
  TAU * -0.25,
  // endAngle
  // from 3 o'clock, 1/4 clockwise turn
  TAU * 0.25
);
ctx.stroke();

As one would expect, the result is half a circle going from 12 o'clock to 6 o'clock.

http://tauday.com/tau-manifesto
https://en.wikipedia.org/wiki/Turn_(geometry)#Tau_proposal

Processing: https://processing.org/reference/TAU.html
Python recently added TAU: https://docs.python.org/3.6/library/math.html#math.tau

tl;dr: Vi Hart - Pi Is (still) Wrong.
https://www.youtube.com/watch?v=jG7vhMMXagQ

@rwaldron
Copy link
Owner

I tried to propose this a few years ago, but it was rejected :(

@rwaldron
Copy link
Owner

FWIW, I agree with you and the rationale

@jhirth
Copy link
Author

jhirth commented Sep 12, 2016

Well, Python got it now. Maybe that would convince some people.

Anyhow, I kinda agree that it's somewhat gimmicky, but on the other hand I always think it's silly that I have to define it myself. It's the math constant I use most frequently.

@rwaldron
Copy link
Owner

I made nearly the same argument. The "Python has it" point might be compelling

@rwaldron rwaldron reopened this Sep 12, 2016
@caub
Copy link

caub commented Sep 30, 2016

you could always const {PI, TAU=2*PI} = Math; in the files that need it, but I don't find it useful to add it in Math

@fuchsia
Copy link

fuchsia commented Oct 5, 2016

+1 for Tau. I'll call it that from now on instead of TWO_PI ;)

@micnic
Copy link

micnic commented Dec 11, 2016

+1 link for TAU

Tau replaces Pi - Numberphile:
https://www.youtube.com/watch?v=83ofi_L6eAo

@AlexanderZeilmann
Copy link

The last time Math.TAU was rejected because

"one letter shorter, not well known, not well taught. PI is known, taught and ubiquitous."

(See meeting notes https://esdiscuss.org/notes/2014-07-31)

I don't see how any of this has changed.
And as Brendan wrote:

Don't rehash. New insights (they had better be new and good) in new thread.

(See https://mail.mozilla.org/pipermail/es-discuss/2014-August/038635.html)

And as there are no new and good insight, I doubt, that this will be accepted.

Let us focus on more important additions to the Math object.

@Crissov
Copy link

Crissov commented May 10, 2019

FWIW, CSS has an angular unit turn that effectively is τ and the CSS folks are reluctant to add any other way to use π. w3c/csswg-drafts#309

This means, you should reconsider whether rad↔deg is really all that should be added, and whether the conversion functions make sense as proposed when considering more than two angular units.

Math.RAD_PER_TURN would be 2*Math.PI, i. e. τ.

Crissov added a commit to Crissov/proposal-math-extensions that referenced this issue Feb 10, 2020
implements rwaldron#5 τ
implements rwaldron#14 φ etc.
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

7 participants