Celeritas  0.5.0-56+6b053cd
Classes | Public Member Functions | Static Public Member Functions | List of all members
celeritas::orangeinp::GenPrism Class Referencefinal

A generalized polygon with parallel flat faces along the z axis. More...

#include <IntersectRegion.hh>

Inheritance diagram for celeritas::orangeinp::GenPrism:
Inheritance graph
[legend]

Classes

struct  TrapFace
 Regular trapezoidal top/bottom face. More...
 

Public Types

Type aliases
using VecReal2 = std::vector< Real2 >
 

Public Member Functions

 GenPrism (real_type halfz, VecReal2 const &lo, VecReal2 const &hi)
 Construct from half Z height and 1-4 vertices for top and bottom planes.
 
void build (IntersectSurfaceBuilder &) const final
 Build surfaces. More...
 
void output (JsonPimpl *) const final
 Write output to the given JSON object.
 
real_type halfheight () const
 Half-height along Z.
 
VecReal2 const & lower () const
 Polygon on -z face.
 
VecReal2 const & upper () const
 Polygon on +z face.
 
size_type num_sides () const
 Number of sides (points on the Z face)
 
real_type calc_twist_cosine (size_type size_idx) const
 Calculate the cosine of the twist angle for a given side. More...
 

Static Public Member Functions

static GenPrism from_trd (real_type halfz, Real2 const &lo, Real2 const &hi)
 Construct from two simple, centered trapezoids.
 
static GenPrism from_trap (real_type hz, Turn theta, Turn phi, TrapFace const &lo, TrapFace const &hi)
 Construct from skewed trapezoids. More...
 

Additional Inherited Members

- Protected Member Functions inherited from celeritas::orangeinp::IntersectRegionInterface
 IntersectRegionInterface ()=default
 
virtual ~IntersectRegionInterface ()=default
 
 CELER_DEFAULT_COPY_MOVE (IntersectRegionInterface)
 

Detailed Description

A generalized polygon with parallel flat faces along the z axis.

A GenPrism, like VecGeom's GenTrap, ROOT's Arb8, and Geant4's G4GenericTrap, represents a generalized volume with polyhedral faces on two parallel planes perpendicular to the Z axis. Unlike those other codes, the number of faces can be arbitrary in number.

The faces have an orientation and ordering so that twisted faces can be constructed by joining corresponding points using straight-line "vertical" edges, directly matching the G4GenericTrap definition, but using a generic quadric expression for each twisted face.

Trapezoids constructed from the helper functions will have sides that are same ordering as a prism: the rightward face is first (normal is along the +x axis), then the others follow counterclockwise.

Member Function Documentation

◆ build()

void celeritas::orangeinp::GenPrism::build ( IntersectSurfaceBuilder insert_surface) const
finalvirtual

Build surfaces.

Todo:
Use plane normal equality from SoftSurfaceEqual, or maybe soft equivalence on twist angle cosine?

Implements celeritas::orangeinp::IntersectRegionInterface.

◆ calc_twist_cosine()

real_type celeritas::orangeinp::GenPrism::calc_twist_cosine ( size_type  i) const

Calculate the cosine of the twist angle for a given side.

The index i is the lower left point on the face when looking from the outside. The result is the dot product between the rightward direction vector of the lower and upper edges. If one edge is degenerate, the twist angle is zero (cosine of 1).

◆ from_trap()

GenPrism celeritas::orangeinp::GenPrism::from_trap ( real_type  hz,
Turn  theta,
Turn  phi,
TrapFace const &  lo,
TrapFace const &  hi 
)
static

Construct from skewed trapezoids.

For details on construction, see: https://geant4-userdoc.web.cern.ch/UsersGuides/ForApplicationDeveloper/html/Detector/Geometry/geomSolids.html#constructed-solid-geometry-csg-solids

  • hz Half the distance between the faces
  • theta Polar angle of line between center of bases
  • phi Azimuthal angle of line between center of bases
  • lo Trapezoidal face at -hz
  • hi Trapezoidal face at +hz

The documentation for this class was generated from the following files: