|
||||
File indexing completed on 2025-01-18 10:05:55
0001 //----------------------------------*-C++-*----------------------------------// 0002 // Copyright 2024 UT-Battelle, LLC, and other Celeritas developers. 0003 // See the top-level COPYRIGHT file for details. 0004 // SPDX-License-Identifier: (Apache-2.0 OR MIT) 0005 //---------------------------------------------------------------------------// 0006 //! \file orange/orangeinp/detail/NegatedSurfaceClipper.hh 0007 //---------------------------------------------------------------------------// 0008 #pragma once 0009 0010 #include "BoundingZone.hh" 0011 0012 namespace celeritas 0013 { 0014 namespace orangeinp 0015 { 0016 namespace detail 0017 { 0018 //---------------------------------------------------------------------------// 0019 /*! 0020 * Truncate a bounding zone from a negated plane. 0021 * 0022 * A negated plane is one when "inside" the CSG node has an outward-facing 0023 * normal. 0024 * 0025 * \verbatim 0026 |--> PlaneAligned<T> outward normal 0027 exterior | 0028 <----+----> axis 0029 | 0030 | interior 0031 * \endverbatim 0032 */ 0033 class NegatedSurfaceClipper 0034 { 0035 public: 0036 // Construct with the bounding zone to clip 0037 explicit inline NegatedSurfaceClipper(BoundingZone* bz); 0038 0039 //! Clip axis-aligned planes. 0040 template<Axis T> 0041 CELER_FORCEINLINE void operator()(PlaneAligned<T> const& s) 0042 { 0043 return this->clip_impl(T, s.position()); 0044 } 0045 0046 //! All other operations invalidate the "interior" box 0047 template<class S> 0048 CELER_FORCEINLINE void operator()(S const&) 0049 { 0050 return this->invalidate(); 0051 } 0052 0053 private: 0054 BoundingZone* bzone_; 0055 0056 // Clip based on the given orthogonal plane 0057 inline void clip_impl(Axis ax, real_type pos); 0058 0059 // Invalidate the interior zone due to non-convex surface 0060 inline void invalidate(); 0061 }; 0062 0063 //---------------------------------------------------------------------------// 0064 /*! 0065 * Construct with the bounding zone to clip. 0066 */ 0067 NegatedSurfaceClipper::NegatedSurfaceClipper(BoundingZone* bz) : bzone_{bz} 0068 { 0069 CELER_EXPECT(bzone_); 0070 } 0071 0072 //---------------------------------------------------------------------------// 0073 /*! 0074 * Clip based on the given orthogonal plane. 0075 */ 0076 void NegatedSurfaceClipper::clip_impl(Axis ax, real_type pos) 0077 { 0078 bzone_->interior.shrink(Bound::lo, ax, pos); 0079 bzone_->exterior.shrink(Bound::lo, ax, pos); 0080 } 0081 0082 //---------------------------------------------------------------------------// 0083 /*! 0084 * Invalidate the interior zone due to non-convex surface. 0085 */ 0086 void NegatedSurfaceClipper::invalidate() 0087 { 0088 bzone_->interior = {}; 0089 } 0090 0091 //---------------------------------------------------------------------------// 0092 } // namespace detail 0093 } // namespace orangeinp 0094 } // namespace celeritas
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |