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

Add egs_circle_perpendicular shape #592

Merged
merged 3 commits into from
Mar 25, 2021
Merged

Conversation

rtownson
Copy link
Collaborator

@rtownson rtownson commented Apr 16, 2020

Adds a new circle shape where the angle of the surface of the circle depends on the position of the source particle directed toward it.

This shape is specified via

:start shape:
    library = egs_circle_perpendicular
    radius = the circle radius
    midpoint = Ox, Oy (optional)
    inner radius = the inner radius (optional)
:stop shape:

and delivers points uniformly distributed within a circle. The surface of this circle is always perpendicular to a ray based on the source particle position, when this shape is used as the target in a source that calls the getPointSourceDirection() function. For example, in a collimated source when a source shape and target shape are defined, the special properties of this circle only apply when it is used as the target shape. Otherwise, it behaves like an egs_circle.

For each source particle, when getPointSourceDirection() is called, the circle shape is rotated so that the circle surface is perpendicular to the vector between the source location, and the origin of the circle. In effect this means that the source particles see a sphere instead of a circle, except that for a given particle, the possible target locations are on the surface of a circle rather than within a sphere.

Thanks to Nathan Murtha for both requesting and helping to debug this feature!

@rtownson rtownson added this to the Release 2021 milestone Apr 16, 2020
@rtownson rtownson self-assigned this Apr 16, 2020
Add a circle shape that, when used as a target shape in a source,
acts as a circle that is always perpendicular to the incident source
particle.
@ftessier
Copy link
Member

Rebased on develop.

Fix the particle weights when egs_circle_perpendicular is used as
a target. Previously the weighting was based on the viewing angle
of the circle along the z axis, because the circle was always in the
xy plane in egs_circle. Now, since the circle face changes direction
the weighting is constant with viewing angle.
@ftessier
Copy link
Member

Removed EOL whitespace introduced in second commit.

Fix special cases where u.z is parallel or antiparallel with the
z axis, resulting incorrectly in a zero vector.
@ftessier
Copy link
Member

ftessier commented Mar 25, 2021

Ran astyle on header file.

@ftessier ftessier merged commit 9af0cd4 into develop Mar 25, 2021
@ftessier ftessier deleted the add-circle-perpendicular branch March 25, 2021 04:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants