]> permondes.de Git - Analog_Engine.git/blob - scripts/Bullet.LACE
LACE: document re-structured, consistent syntax; Aplaca60
[Analog_Engine.git] / scripts / Bullet.LACE
1 # Bullet shot vertically up
2 #
3 # z'' = -g -af = -g -k*v^2
4 # with k = 1/m * 1/2 * A * c.w * rho
5
6 coefficient.1(-1) -> -g # gravity
7 coefficient.2 -> k # coefficient of friction
8 coefficient.3(+1) -> v0 # initial vertical speed
9
10 iintegrate (-g, 10*: friction) -> -v
11 IC: v0
12 iintegrate (-v) -> z
13
14 invert -v -> v
15
16 multiply (-v, -v) -> v^2
17 cmultiply (k, v^2) -> kv^2
18
19 # make sure friction acts against the direction of propagation
20 invert kv^2 -> -kv^2
21 compare v -> friction
22 GT0: -kv^2 # v > 0 => moving upwards
23 LT0: kv^2 # v < 0 => moving downwards
24
25 output (v) -> out.x
26 Output (friction) -> out.y
27 output (z) -> out.z