@@ -2714,8 +2714,7 @@ HeadRule::trackSurfIntersect(const Geometry::Vec3D& Org,
2714
2714
ELog::RegMethod RegA (" HeadRule" ," trackSurfIntersect" );
2715
2715
2716
2716
std::vector<Geometry::interPoint> IPTvec;
2717
- calcSurfIntersection (Org,Unit,IPTvec)
2718
- MonteCarlo::LineIntersectVisit LI (Org,Unit);
2717
+ calcSurfIntersection (Org,Unit,IPTvec);
2719
2718
for (const Geometry::interPoint& inter : IPTvec)
2720
2719
if (inter.D >Geometry::zeroTol)
2721
2720
return inter;
@@ -2725,44 +2724,57 @@ HeadRule::trackSurfIntersect(const Geometry::Vec3D& Org,
2725
2724
2726
2725
}
2727
2726
2728
- std::pair< int , double >
2729
- HeadRule::trackSurfDistance (const Geometry::Vec3D& Org,
2730
- const Geometry::Vec3D& Unit) const
2731
-
2727
+ Geometry::interPoint
2728
+ HeadRule::trackSurfIntersect (const Geometry::Vec3D& Org,
2729
+ const Geometry::Vec3D& Unit,
2730
+ const std::set< int >& sActive ) const
2732
2731
/* !
2733
2732
Calculate a track of a line to a change in state surface
2734
2733
\param Org :: Origin of line
2735
2734
\param Unit :: Direction of line
2736
- \return exit surface [signed??]
2735
+ \param sActive :: surface to ignore
2736
+ \return Signed Surf : SurfacePtr : Point : Distance
2737
2737
*/
2738
2738
{
2739
- ELog::RegMethod RegA (" HeadRule" ," trackSurfDistance" );
2740
- const std::tuple<int ,const Geometry::Surface*,Geometry::Vec3D,double >
2741
- result=trackSurfIntersect (Org,Unit);
2739
+ ELog::RegMethod RegA (" HeadRule" ," trackSurfIntersect" );
2742
2740
2743
- return std::pair<int ,double >(std::get<0 >(result),std::get<3 >(result));
2744
- }
2741
+ std::vector<Geometry::interPoint> IPTvec;
2742
+ calcSurfIntersection (Org,Unit,IPTvec);
2743
+ for (const Geometry::interPoint& inter : IPTvec)
2744
+ if (inter.D >Geometry::zeroTol &&
2745
+ sActive .find (inter.SNum )==sActive .end ())
2746
+ return inter;
2745
2747
2746
- std::pair<int ,double >
2747
- HeadRule::trackSurfDistance (const Geometry::Vec3D& Org,
2748
- const Geometry::Vec3D& Unit,
2749
- const std::set<int >& ) const
2748
+ // ok all failed:
2749
+ return Geometry::interPoint ();
2750
+ }
2750
2751
2752
+ Geometry::interPoint
2753
+ HeadRule::trackSurfIntersect (const Geometry::Vec3D& Org,
2754
+ const Geometry::Vec3D& Unit,
2755
+ const int sActive ) const
2751
2756
/* !
2752
2757
Calculate a track of a line to a change in state surface
2753
2758
\param Org :: Origin of line
2754
2759
\param Unit :: Direction of line
2755
- \return exit surface [signed??] / distance
2760
+ \param sActive :: surface to ignore
2761
+ \return Signed Surf : SurfacePtr : Point : Distance
2756
2762
*/
2757
2763
{
2758
- ELog::RegMethod RegA (" HeadRule" ," trackSurfDistance" );
2759
-
2760
- const std::tuple<int ,const Geometry::Surface*,Geometry::Vec3D,double >
2761
- result=trackSurfIntersect (Org,Unit);
2764
+ ELog::RegMethod RegA (" HeadRule" ," trackSurfIntersect" );
2765
+
2766
+ std::vector<Geometry::interPoint> IPTvec;
2767
+ calcSurfIntersection (Org,Unit,IPTvec);
2768
+ for (const Geometry::interPoint& inter : IPTvec)
2769
+ if (inter.D >Geometry::zeroTol &&
2770
+ inter.SNum !=sActive )
2771
+ return inter;
2762
2772
2763
- return std::pair<int ,double >(std::get<0 >(result),std::get<3 >(result));
2773
+ // ok all failed:
2774
+ return Geometry::interPoint ();
2764
2775
}
2765
2776
2777
+
2766
2778
int
2767
2779
HeadRule::trackSurf (const Geometry::Vec3D& Org,
2768
2780
const Geometry::Vec3D& Unit) const
@@ -2779,10 +2791,10 @@ HeadRule::trackSurf(const Geometry::Vec3D& Org,
2779
2791
ELog::RegMethod RegA (" HeadRule" ," trackSurf(O,U)" );
2780
2792
2781
2793
// surface/surfPtr/point/distance
2782
- const std::tuple< int , const Geometry::Surface*,Geometry::Vec3D, double >
2794
+ const Geometry::interPoint
2783
2795
result=trackSurfIntersect (Org,Unit);
2784
2796
2785
- return std::get< 0 >( result) ;
2797
+ return result. SNum ;
2786
2798
}
2787
2799
2788
2800
int
@@ -2804,13 +2816,10 @@ HeadRule::trackSurf(const Geometry::Vec3D& Org,
2804
2816
2805
2817
Geometry::Vec3D Pt (Org);
2806
2818
2807
- auto [SN,DD]=trackSurfDistance (Pt,Unit);
2808
- while (SN && activeSurf.find (SN)!=activeSurf.end ())
2809
- {
2810
- Pt+=Unit*DD;
2811
- std::tie (SN,DD)=trackSurfDistance (Pt,Unit);
2812
- }
2813
- return SN;
2819
+ const Geometry::interPoint
2820
+ result=trackSurfIntersect (Org,Unit,activeSurf);
2821
+
2822
+ return result.SNum ;
2814
2823
}
2815
2824
2816
2825
size_t
@@ -2885,11 +2894,11 @@ HeadRule::calcSurfIntersection(const Geometry::Vec3D& Org,
2885
2894
const int pAB=isValid (inter.Pt ,inter.SNum );
2886
2895
const int mAB =isValid (inter.Pt ,-inter.SNum );
2887
2896
2888
- const Geometry::Surface* surfPtr=surfIndex[i];
2889
- // Is point possible closer
2890
- const int NS=surfPtr->getName (); // NOT SIGNED
2891
- const int pAB=isValid (IPts[i],NS);
2892
- const int mAB =isValid (IPts[i],-NS);
2897
+ // const Geometry::Surface* surfPtr=surfIndex[i];
2898
+ // // Is point possible closer
2899
+ // const int NS=surfPtr->getName(); // NOT SIGNED
2900
+ // const int pAB=isValid(IPts[i],NS);
2901
+ // const int mAB=isValid(IPts[i],-NS);
2893
2902
2894
2903
if (pAB!=mAB ) // exiting/entering surface
2895
2904
{
0 commit comments