Commit 62f94386 authored by bp's avatar bp

Replaced 2pi with tau, the proposed 'new' circle constant

git-svn-id: https://forth-ev.de/repos/bigforth@2502 3b8d8251-53f3-0310-8f3b-fd1cb8370982
parent ce9af1a7
......@@ -169,8 +169,8 @@ IS dummy-canvas
[THEN]
1e f>fs Constant #1.
pi f2* FConstant 2pi
2pi 1/f FConstant 1/2pi
pi f2* FConstant tau
tau 1/f FConstant 1/tau
\ : .matrix ( addr -- )
\ &12 sfloats bounds
......@@ -488,7 +488,7 @@ class;
: phi>xy ( f -- f1 f2 )
rot-mode sf@ f* fsincos 1e f- 1e f+ ;
: degrees ( f -- ) 1/2pi f* rot-mode ! ;
: degrees ( f -- ) 1/tau f* rot-mode ! ;
: left ( f -- ) phi>xy trans-2,0 trans-3,0 do-turn ;
: down ( f -- ) phi>xy trans-1,0 trans-3,0 do-turn ;
......@@ -695,10 +695,10 @@ class;
: >texture ( addr f -- )
IS do-texture y-text sf! 0e z-off sf! ;
: xy-texture ['] do-xy-text 1e >texture ;
: zphi-texture ['] do-zphi-text 1/2pi >texture ;
: zphi2-texture ['] do-zphi2-text 1/2pi >texture ;
: zphi-texture ['] do-zphi-text 1/tau >texture ;
: zphi2-texture ['] do-zphi2-text 1/tau >texture ;
: zp-texture ['] do-zp-text 1e >texture ;
: rphi-texture ['] do-rphi-text 1/2pi >texture ;
: rphi-texture ['] do-rphi-text 1/tau >texture ;
: no-texture ['] noop 1e >texture ;
\ texture loading (ppm) 31jan99py
......@@ -1117,7 +1117,7 @@ class;
LOOP f2* forward
drop end-path ;
: cylinder ( r1 r2 d n -- ) { f: r1 f: r2 f: d }
2pi dup fm/ set-dphi
tau dup fm/ set-dphi
dup start-path
r1 .01e f* 0e dup segment \ ugly workaround
r1 0e dup segment
......
......@@ -30,10 +30,10 @@ Create .sky .3e sf, .6e sf, .8e sf, 1e sf,
IF .text ELSE drop THEN ;
Variable tail-time
: time' ( -- 0..2pi )
: time' ( -- 0..tau )
tail-time @ [ #24 #60 #30 * * ] Literal um* drop
0 d>f [ !$2'-8 pi f* ] FLiteral f* ;
: time-pos ( -- 0..2pi )
: time-pos ( -- 0..tau )
tail-time @ [ #24 #60 #5 * * ] Literal um* drop
0 d>f [ !$2'-8 pi f* ] FLiteral f* ;
: tail-wag ( n -- f )
......@@ -46,7 +46,7 @@ Variable tail-time
ro set-r
ri .1e set-rp dphi sf@ phi sf@ f+ phi sf!
1 DO ri set-r LOOP
2pi phi sf! ro set-r
tau phi sf! ro set-r
0e phi sf! } ;
F : tail-compensate ( n -- f ) 0e
0 DO I 2+ tail-wag f+ [ 1.1e 1/f ] Fliteral f* LOOP
......
......@@ -30,7 +30,7 @@ Create .sky .3e sf, .6e sf, .8e sf, 1e sf,
IF .text ELSE drop THEN ;
Variable tail-time
: time' ( -- 0..2pi )
: time' ( -- 0..tau )
tail-time @ [ #24 #60 #30 * * ] Literal um* drop
0 d>f [ !$2'-8 pi f* ] FLiteral f* ;
: tail-wag ( n -- f )
......@@ -43,7 +43,7 @@ Variable tail-time
ro set-r
ri .1e set-rp dphi sf@ phi sf@ f+ phi sf!
1 DO ri set-r LOOP
2pi phi sf! ro set-r
tau phi sf! ro set-r
0e phi sf! } ;
F : tail-compensate ( n -- f ) 0e
0 DO I 2+ tail-wag f+ [ 1.1e 1/f ] Fliteral f* LOOP
......
......@@ -39,9 +39,9 @@ base @ hex
base !
$6487F Constant 2pi
2pi 1 + 4 / Constant pi/2
2pi 3 + 8 / Constant pi/4
$6487F Constant tau
tau 1 + 4 / Constant pi/2
tau 3 + 8 / Constant pi/4
$B505 Constant sqrt.5
| : (sini ( n -- sin[n] ) 2* sintab + w@ ;
......
......@@ -23,7 +23,7 @@ Create .green .5e sf, .8e sf, .4e sf, 1e sf,
dup .03e fm* dup .1e fm* 6 segment
over 1 ?DO
#1000 random rd-val <
IF 2pi I I' fm*/ { f: di |
IF tau I I' fm*/ { f: di |
>turtle
di roll-left pi 5 fm/ right di roll-right
2dup 1- (tree
......
......@@ -100,7 +100,7 @@ forward tree-branch
[ pi 0.2e f* ] Fliteral roll-left
dup 1 2e color-cylinder
over 0 ?DO
2pi I I' fm*/ to di
tau I I' fm*/ to di
>turtle
di roll-left pi 3 fm/ right
pi f2/ roll-right
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment