MCPcopy
hub / github.com/tum-pbs/PhiFlow / sample_trajectory

Function sample_trajectory

tests/commit/test_throw.py:18–24  ·  view source on GitHub ↗
(pos, height, vel, angle, gravity=1.)

Source from the content-addressed store, hash-verified

16
17
18def sample_trajectory(pos, height, vel, angle, gravity=1.):
19 hit, hit_time, height, vel_x, vel_y = simulate_hit(pos, height, vel, angle, gravity)
20 def y(x):
21 t = (x.vector[0] - pos) / vel_x
22 y_ = height + vel_y * t - gravity / 2 * t ** 2
23 return math.where((y_ > 0) & (t > 0), y_, math.NAN)
24 return CenteredGrid(y, x=2000, bounds=Box(x=(min(pos.min, hit.min), max(pos.max, hit.max))))
25
26
27BACKENDS = phi.detect_backends()

Callers 1

Calls 3

CenteredGridFunction · 0.90
BoxClass · 0.90
simulate_hitFunction · 0.85

Tested by

no test coverage detected