Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sampleplotting #109

Merged
merged 8 commits into from
Nov 26, 2020
Merged

Sampleplotting #109

merged 8 commits into from
Nov 26, 2020

Conversation

hervasa2
Copy link
Collaborator

Added a scatter plot method for plotting detectors
This method is based on the sample function of each primitive
It supports negative geometries
Relatively fast for examples. However, will take too long if contacts are too thick in comparison to the world.
Scatter plotting code (SSD_style = :samplesurface) is written in the plot recipe of each primitive
Plot recipes now pass the detector and the contact to each other so that sampling can be done with respect to world size and negative geometries can be removed.
plot(simulation.detector, camera = (20,30))
OR
plot(simulation.detector, camera = (20,30), SSD_style = :wireframe)
seg_BEGe_wireframe
Note that there is a hexagonal negative geometry not shown by :wireframe. This can now be shown by :samplesurface
plot(simulation.detector, camera = (20,30), SSD_style = :samplesurface)
OR
plot(simulation.detector, camera = (20,30), SSD_style = :samplesurface, alpha_factor = 1)
seg_BEGe_samplesurface
alpha_factor can be any number >= 0. At some point the opacity will saturate. Each positive geometry has a different calculated alpha
plot(simulation.detector, camera = (20,30), SSD_style = :samplesurface, alpha_factor = 0.3
seg_BEGe_samplesurface2
)
More examples with default alpha_factor follow:
plot(simulation.detector, camera = (20,30), SSD_style = :samplesurface)
InvertedCoax
Bulletized
CoaxialTorus
Coax
Hexagon
SegBEGe_hex

plotobject = CylindricalPoint.(sample(hp, sampling_vector))
elseif coord_sys == :cartesian
sampling_vector = T.([width(grid.x.interval)/points, width(grid.y.interval)/points, width(grid.z.interval)/points])
plotobject = CartesianPoint{T}.(sample(hp, sampling_vector))
Copy link
Collaborator

Choose a reason for hiding this comment

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

CartesianPoint{T} is not needed.

@hervasa2
Copy link
Collaborator Author

hervasa2 commented Nov 25, 2020

Updates: Instead of detector being passed a world_size is passed. Instead of the contact being passed, an array of negative geometries is being passed.
Now plot recipes for individual contacts or positive geometries work for :sampleplotting method. Before they relied on a detector being passed to them. If no world_size is received by a plot recipe, it determines it for each positive geometry plotted. If no array of negative geometries is passed the plot recipe for a positive geometry will simply not check if any of its points are in a negative geometry.
PENDING: Add color array input

@hervasa2
Copy link
Collaborator Author

Color choosing is available via keyword palette. Examples:
palette = cgrad(:viridis, 5, categorical = true)
palette = :tab10
palette = [:red,:blue,:black]
If not enough colors are given for contacts, it will cycle

@schustermartin
Copy link
Collaborator

This looks very good! And I think it is ready. Great job

@schustermartin schustermartin merged commit 864b07d into JuliaPhysics:master Nov 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants