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

Redefine Cone and Torus: φ::Tuple{T,T} => φ::T #240

Merged
merged 10 commits into from
Nov 3, 2021

Conversation

fhagemann
Copy link
Collaborator

This PR changes the definition of the polar angle φ for both Cone and Torus as requested in #215 and #236.
φ is can now only be full 2π (Nothing) or a number (T), where φ = 50° describes the range from to 50°.
This is explicitly required in the source code by demanding φ::TP where {TP <: Union{Nothing,T}}.

I also added tests for Cone and Torus which should cover most (if not all) of the cases that we describe and increase the code coverage. I also spotted some bugs while running the tests that are fixed with this PR.

I tried out some combinations of rotations and translations, and the implementation seems to be right
(basically, we set φ to be the width of the former φ interval and add a rotation around the Z axis by φ[1]).

Full 2π Cone

cone:
  r:
    bottom:
      from: 1.0
      to: 2.0
    top:
      from: 1.0
      to: 2.0
  h: 2.0
  rotation:
    X: 45.0°
  origin: [0,1,0]

Partial Cone

cone:
  r:
    bottom:
      from: 1.0
      to: 2.0
    top:
      from: 1.0
      to: 2.0
  phi:
    from: 80.0°
    to: 140.0°
  h: 2.0
  rotation:
    X: 45.0°
  origin: [0,1,0]

PartialCone

The tricky part is when intervals need to be converted to the new φ syntax, e.g. when determining the EllipticalSurfaces that describe φ cross-sections of a Torus.
TorusEllipticalSurfaces

Then θ::Tuple{T,T} is converted to the "new" φ::T through φ = abs(-(θ...)) and a rotation around θ[1]:

Another nice thing is that the bulletized point contacts from SigGen configuration files now look quite decent, as they are not constructed using CSGDifference anymore:

sim = Simulation(SSD_examples[:SigGen])
plot(
    plot(sim.detector, st = :mesh3d)
    plot(sim.detector.contacts[1], st = :mesh3d)
)

bulletizedPC

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.

2 participants