Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
15
Task/Animate-a-pendulum/PicoLisp/animate-a-pendulum-1.l
Normal file
15
Task/Animate-a-pendulum/PicoLisp/animate-a-pendulum-1.l
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
(load "@lib/math.l")
|
||||
|
||||
(de pendulum (X Y Len)
|
||||
(let (Angle pi/2 V 0)
|
||||
(call 'clear)
|
||||
(call 'tput "cup" Y X)
|
||||
(prin '+)
|
||||
(call 'tput "cup" 1 (+ X Len))
|
||||
(until (key 25) # 25 ms
|
||||
(let A (*/ (sin Angle) -9.81 1.0)
|
||||
(inc 'V (*/ A 40)) # DT = 25 ms = 1/40 sec
|
||||
(inc 'Angle (*/ V 40)) )
|
||||
(call 'tput "cup"
|
||||
(+ Y (*/ Len (cos Angle) 2.2)) # Compensate for aspect ratio
|
||||
(+ X (*/ Len (sin Angle) 1.0)) ) ) ) )
|
||||
1
Task/Animate-a-pendulum/PicoLisp/animate-a-pendulum-2.l
Normal file
1
Task/Animate-a-pendulum/PicoLisp/animate-a-pendulum-2.l
Normal file
|
|
@ -0,0 +1 @@
|
|||
(pendulum 40 1 36)
|
||||
Loading…
Add table
Add a link
Reference in a new issue