Sigma.jl icon indicating copy to clipboard operation
Sigma.jl copied to clipboard

Buggy collision detection in Pool example

Open zenna opened this issue 11 years ago • 0 comments

Trajectories often bounce through obstacles. The angle of reflection seems correct if the normal were inverted, so perhaps the problem is somewhere there.

Example

obstacles = Array[[8.01 3.01; 1.02 9],
                  [0.5 3.08; 2.02 9.04],
                  [0.0 9.99; 3 5.04]]

nbounces = 2
start_pos = [3., 5.]
start_dir = [0.3,0.2]
points, positions = simulate(nbounces, start_pos, start_dir, obstacles)
a = make_compose_lines(obstacles)
b = [line([pair(points[:,i]),pair(points[:,i+1])]) for i = 1:(size(points,2)-1)]

draw_lines(a,b)

image

zenna avatar Oct 28 '14 21:10 zenna