Skip to content

Commit

Permalink
correparticlebeam
Browse files Browse the repository at this point in the history
  • Loading branch information
Datseris committed Apr 19, 2020
1 parent ab6edc6 commit ad7df20
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/billiards/particles.jl
Original file line number Diff line number Diff line change
Expand Up @@ -141,15 +141,17 @@ end
## Aux
####################################################
"""
particlebeam(x0, y0, φ, N, dx, ω = nothing) → ps
particlebeam(x0, y0, φ, N, dx, ω = nothing, T = eltype(x0)) → ps
Make `N` particles, all with direction `φ`, starting at `x0, y0`. The particles
don't all have the same position, but are instead spread by up to `dx` in the
direction normal to `φ`.
The particle element type is `T`.
"""
function particlebeam(x0, y0, φ, N, dx, ω = nothing, T = Float64)
n = sincos(φ)
function particlebeam(x0, y0, φ, N, dx, ω = nothing, T = eltype(x0))
n = cossin(φ)
xyφs = [
T.((x0 + i*dx*n[1]/N, y0 + i*dx*n[2]/N, φ)) for i in range(-N/2, N/2; length = N)
T.((x0 - i*dx*n[2]/N, y0 + i*dx*n[1]/N, φ)) for i in range(-N/2, N/2; length = N)
]
if isnothing(ω)
ps = [Particle(z...) for z in xyφs]
Expand Down

2 comments on commit ad7df20

@Datseris
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator register()

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/13282

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v3.11.0 -m "<description of version>" ad7df20050f6e9d2e3f212d7043f32ea142c8606
git push origin v3.11.0

Please sign in to comment.