mirror of
https://github.com/luau-lang/rfcs.git
synced 2025-05-04 10:43:48 +01:00
Add examples where tau is utilized
This commit is contained in:
parent
626cbf4a7b
commit
365551fd8d
1 changed files with 16 additions and 1 deletions
|
@ -8,7 +8,22 @@ Define a constant value `math.tau` to be the tau constant.
|
|||
|
||||
Currently the value of tau is used in trigonomic calculations through `math.pi * 2`.
|
||||
|
||||
The implementation of tau will simplify equations where otherwise math.pi * 2 may be used.
|
||||
The implementation of tau will simplify expressing angles in turns or equations where otherwise math.pi * 2 may be used such as:
|
||||
|
||||
```
|
||||
-- angular difference along a sphere
|
||||
local sphereAngleDiff_pi = (a - b + math.pi / 2) % (math.pi * 2)
|
||||
local sphereAngleDiff_tau = (a - b + math.pi / 2) % math.tau
|
||||
|
||||
-- angular frequency calculation
|
||||
local frequency_pi = math.pi * 2 * angularFrequency
|
||||
local frequency_tau = math.tau * angularFrequency
|
||||
|
||||
-- random gradient
|
||||
local r = math.random() * math.pi * 2
|
||||
local r_tau = math.random() * math.tau
|
||||
local gradient = vector(math.cos(r), math.sin(r), 0)
|
||||
```
|
||||
|
||||
## Design
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue