Skip to content

Commit

Permalink
Merge pull request #396 from bene73/geant4
Browse files Browse the repository at this point in the history
Plot recipe for `AbstractParticleSource`
  • Loading branch information
fhagemann authored Aug 7, 2024
2 parents 068a1eb + 1190d84 commit 30584dc
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions src/PlotRecipes/ChargeCloudModels.jl
Original file line number Diff line number Diff line change
Expand Up @@ -287,4 +287,32 @@ end
end
end
end
end


@recipe function f(s::AbstractParticleSource)
if isa(s.direction, CartesianVector)
length_direction = norm(s.direction)
new_vector = s.direction/length_direction * 0.025
linewidth --> 3
linecolor --> :green
linealpha --> 0.5

@series begin
[s.position.x, s.position.x + new_vector.x],[s.position.y, s.position.y + new_vector.y],[s.position.z, s.position.z + new_vector.z]
end
end
markersize --> 10
markerstrokewidth --> 0

alpha := 1.0
if isa(s.direction, CartesianVector)
color := :blue
else
color := :green
end

@series begin
s.position
end
end

0 comments on commit 30584dc

Please sign in to comment.