Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-11-13 11:00:30

0001 /// @file HalfSpaceStruct.h
0002 /// @brief Runtime data for the plane-bounded half-space primitive.
0003 
0004 #ifndef VECGEOM_VOLUMES_HALFSPACESTRUCT_H_
0005 #define VECGEOM_VOLUMES_HALFSPACESTRUCT_H_
0006 
0007 #include "VecGeom/base/Assert.h"
0008 #include "VecGeom/base/Global.h"
0009 #include "VecGeom/base/Vector3D.h"
0010 
0011 namespace vecgeom {
0012 
0013 inline namespace VECGEOM_IMPL_NAMESPACE {
0014 
0015 /// @brief Plane point and normalized outward normal defining a half-space.
0016 /// @details The material side satisfies `(p - fPoint).Dot(fNormal) <= 0`.
0017 template <typename T = double>
0018 struct HalfSpaceStruct {
0019   Vector3D<T> fPoint;  ///< Point on the limiting plane.
0020   Vector3D<T> fNormal; ///< Unit normal pointing outside the half-space.
0021 
0022   /// @brief Construct the default half-space `z <= 0`.
0023   VECCORE_ATT_HOST_DEVICE
0024   HalfSpaceStruct() : fPoint(0.), fNormal(0., 0., 1.) {}
0025 
0026   /// @brief Construct a half-space from one plane point and an outward normal.
0027   /// @param point Point lying on the limiting plane.
0028   /// @param normal Non-zero normal; it is normalized before storage.
0029   /// @details The normal points to the outside of the half-space, so material is
0030   /// on the side where `(p - point).Dot(normal) <= 0`.
0031   VECCORE_ATT_HOST_DEVICE
0032   HalfSpaceStruct(Vector3D<T> const &point, Vector3D<T> const &normal) : fPoint(point), fNormal(normal)
0033   {
0034     VECGEOM_VALIDATE(fNormal.Mag2() > T(0.), << "Half-space normal must be non-zero");
0035     fNormal.Normalize();
0036   }
0037 };
0038 
0039 } // namespace VECGEOM_IMPL_NAMESPACE
0040 } // namespace vecgeom
0041 
0042 #endif // VECGEOM_VOLUMES_HALFSPACESTRUCT_H_