Hello. I have found that this piece of code does not work adequately
using Dynamical Billiards
a = 1.0
b = 3.0
bt = billiard_polygon(6, b; setting = "periodic")
disc = Disk([0., 0.], a)
push!(bt, disc)
p = randominside(bt)
t = 5
ts, pos, vel = evolve!(p, bt, t)
And the reason is that when we create the normal vector as
normal = inr*normalize([-w[2], w[1]])
defined in the function billiard_polygon
(line 151 of StandardBilliards.jl), the periodicity!
function updates the position of the particle wrongly as w.normal
is normalized. What I have tried to fix the problem is to change that line by
normal = normalize([-w[2], w[1]])*sqrt(3)*r
As $sqrt(3) \times r$
is the distance between any two parallel sides of a hexagon. The new problem is that this just works for a triangular billiard (hexagonal unit cell). As the function billiard_polygon
works only for $4$ or $6$ sides (by mathematical reasons) and the square case works correctly, I propose to implement a specific function for the triangular lattice.
Additionally, a specific function for plotting this kind of unit cell needs to be implemented as the existing function does not translate correctly the scatterers when the periodicity is along non-coordinate vectors. I have made some code for the case discussed here but we could consider to open another issue after solving this one.