Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/geometry/management/src/G4VoxelLimits.cc

Version: [ ReleaseNotes ] [ 1.0 ] [ 1.1 ] [ 2.0 ] [ 3.0 ] [ 3.1 ] [ 3.2 ] [ 4.0 ] [ 4.0.p1 ] [ 4.0.p2 ] [ 4.1 ] [ 4.1.p1 ] [ 5.0 ] [ 5.0.p1 ] [ 5.1 ] [ 5.1.p1 ] [ 5.2 ] [ 5.2.p1 ] [ 5.2.p2 ] [ 6.0 ] [ 6.0.p1 ] [ 6.1 ] [ 6.2 ] [ 6.2.p1 ] [ 6.2.p2 ] [ 7.0 ] [ 7.0.p1 ] [ 7.1 ] [ 7.1.p1 ] [ 8.0 ] [ 8.0.p1 ] [ 8.1 ] [ 8.1.p1 ] [ 8.1.p2 ] [ 8.2 ] [ 8.2.p1 ] [ 8.3 ] [ 8.3.p1 ] [ 8.3.p2 ] [ 9.0 ] [ 9.0.p1 ] [ 9.0.p2 ] [ 9.1 ] [ 9.1.p1 ] [ 9.1.p2 ] [ 9.1.p3 ] [ 9.2 ] [ 9.2.p1 ] [ 9.2.p2 ] [ 9.2.p3 ] [ 9.2.p4 ] [ 9.3 ] [ 9.3.p1 ] [ 9.3.p2 ] [ 9.4 ] [ 9.4.p1 ] [ 9.4.p2 ] [ 9.4.p3 ] [ 9.4.p4 ] [ 9.5 ] [ 9.5.p1 ] [ 9.5.p2 ] [ 9.6 ] [ 9.6.p1 ] [ 9.6.p2 ] [ 9.6.p3 ] [ 9.6.p4 ] [ 10.0 ] [ 10.0.p1 ] [ 10.0.p2 ] [ 10.0.p3 ] [ 10.0.p4 ] [ 10.1 ] [ 10.1.p1 ] [ 10.1.p2 ] [ 10.1.p3 ] [ 10.2 ] [ 10.2.p1 ] [ 10.2.p2 ] [ 10.2.p3 ] [ 10.3 ] [ 10.3.p1 ] [ 10.3.p2 ] [ 10.3.p3 ] [ 10.4 ] [ 10.4.p1 ] [ 10.4.p2 ] [ 10.4.p3 ] [ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /geometry/management/src/G4VoxelLimits.cc (Version 11.3.0) and /geometry/management/src/G4VoxelLimits.cc (Version 10.3.p1)


  1 //                                                  1 //
  2 // *******************************************      2 // ********************************************************************
  3 // * License and Disclaimer                         3 // * License and Disclaimer                                           *
  4 // *                                                4 // *                                                                  *
  5 // * The  Geant4 software  is  copyright of th      5 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
  6 // * the Geant4 Collaboration.  It is provided      6 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
  7 // * conditions of the Geant4 Software License      7 // * conditions of the Geant4 Software License,  included in the file *
  8 // * LICENSE and available at  http://cern.ch/      8 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
  9 // * include a list of copyright holders.           9 // * include a list of copyright holders.                             *
 10 // *                                               10 // *                                                                  *
 11 // * Neither the authors of this software syst     11 // * Neither the authors of this software system, nor their employing *
 12 // * institutes,nor the agencies providing fin     12 // * institutes,nor the agencies providing financial support for this *
 13 // * work  make  any representation or  warran     13 // * work  make  any representation or  warranty, express or implied, *
 14 // * regarding  this  software system or assum     14 // * regarding  this  software system or assume any liability for its *
 15 // * use.  Please see the license in the file      15 // * use.  Please see the license in the file  LICENSE  and URL above *
 16 // * for the full disclaimer and the limitatio     16 // * for the full disclaimer and the limitation of liability.         *
 17 // *                                               17 // *                                                                  *
 18 // * This  code  implementation is the result      18 // * This  code  implementation is the result of  the  scientific and *
 19 // * technical work of the GEANT4 collaboratio     19 // * technical work of the GEANT4 collaboration.                      *
 20 // * By using,  copying,  modifying or  distri     20 // * By using,  copying,  modifying or  distributing the software (or *
 21 // * any work based  on the software)  you  ag     21 // * any work based  on the software)  you  agree  to acknowledge its *
 22 // * use  in  resulting  scientific  publicati     22 // * use  in  resulting  scientific  publications,  and indicate your *
 23 // * acceptance of all terms of the Geant4 Sof     23 // * acceptance of all terms of the Geant4 Software license.          *
 24 // *******************************************     24 // ********************************************************************
 25 //                                                 25 //
 26 // Class G4VoxelLimits implementation          << 
 27 //                                                 26 //
 28 // 13.07.95, P.Kent - Initial version          <<  27 // $Id: G4VoxelLimits.cc 91803 2015-08-06 12:17:01Z gcosmo $
                                                   >>  28 //
                                                   >>  29 // class G4VoxelLimits
                                                   >>  30 // 
                                                   >>  31 // Implementation
                                                   >>  32 //
                                                   >>  33 // History:
                                                   >>  34 //
                                                   >>  35 // 14.03.02 V. Grichine, cosmetics
                                                   >>  36 // 13.07.95 P.Kent Initial version
 29 // -------------------------------------------     37 // --------------------------------------------------------------------
 30                                                    38 
 31 #include "G4VoxelLimits.hh"                        39 #include "G4VoxelLimits.hh"
 32                                                    40 
 33 #include "G4ios.hh"                                41 #include "G4ios.hh"
 34                                                    42 
 35 //////////////////////////////////////////////     43 ///////////////////////////////////////////////////////////////////////////
 36 //                                                 44 //
                                                   >>  45 // Empty constructor and destructor
                                                   >>  46 //
                                                   >>  47 
                                                   >>  48 G4VoxelLimits::G4VoxelLimits()
                                                   >>  49  : fxAxisMin(-kInfinity),fxAxisMax(kInfinity),
                                                   >>  50    fyAxisMin(-kInfinity),fyAxisMax(kInfinity),
                                                   >>  51    fzAxisMin(-kInfinity),fzAxisMax(kInfinity)
                                                   >>  52 {
                                                   >>  53 }
                                                   >>  54 
                                                   >>  55 G4VoxelLimits::~G4VoxelLimits()
                                                   >>  56 {
                                                   >>  57 }
                                                   >>  58 
                                                   >>  59 ///////////////////////////////////////////////////////////////////////////
                                                   >>  60 //
 37 // Further restrict limits                         61 // Further restrict limits
 38 // No checks for illegal restrictions              62 // No checks for illegal restrictions
 39 //                                                 63 //
                                                   >>  64 
 40 void G4VoxelLimits::AddLimit( const EAxis pAxi     65 void G4VoxelLimits::AddLimit( const EAxis pAxis, 
 41                               const G4double p     66                               const G4double pMin,
 42                               const G4double p     67                               const G4double pMax )
 43 {                                                  68 {
 44   if ( pAxis == kXAxis )                           69   if ( pAxis == kXAxis )
 45   {                                                70   {
 46     if ( pMin > fxAxisMin ) fxAxisMin = pMin ;     71     if ( pMin > fxAxisMin ) fxAxisMin = pMin ;    
 47     if ( pMax < fxAxisMax ) fxAxisMax = pMax ;     72     if ( pMax < fxAxisMax ) fxAxisMax = pMax ;    
 48   }                                                73   }
 49   else if ( pAxis == kYAxis )                      74   else if ( pAxis == kYAxis )
 50   {                                                75   {
 51     if ( pMin > fyAxisMin ) fyAxisMin = pMin ;     76     if ( pMin > fyAxisMin ) fyAxisMin = pMin ;    
 52     if ( pMax < fyAxisMax ) fyAxisMax = pMax ;     77     if ( pMax < fyAxisMax ) fyAxisMax = pMax ;
 53   }                                                78   }
 54   else                                             79   else
 55   {                                                80   { 
 56     assert( pAxis == kZAxis ) ;                    81     assert( pAxis == kZAxis ) ;
 57                                                    82 
 58     if ( pMin > fzAxisMin ) fzAxisMin = pMin ;     83     if ( pMin > fzAxisMin ) fzAxisMin = pMin ;
 59     if ( pMax < fzAxisMax ) fzAxisMax = pMax ;     84     if ( pMax < fzAxisMax ) fzAxisMax = pMax ;
 60   }                                                85   }
 61 }                                                  86 }
 62                                                    87 
 63 //////////////////////////////////////////////     88 ///////////////////////////////////////////////////////////////////////////
 64 //                                                 89 //
 65 // ClipToLimits                                    90 // ClipToLimits
 66 //                                                 91 //
 67 // Clip the line segment pStart->pEnd to the v     92 // Clip the line segment pStart->pEnd to the volume described by the
 68 // current limits. Return true if the line rem     93 // current limits. Return true if the line remains after clipping,
 69 // else false, and leave the vectors in an und     94 // else false, and leave the vectors in an undefined state.
 70 //                                                 95 //
 71 // Process:                                        96 // Process:
 72 //                                                 97 //
 73 // Use Cohen-Sutherland clipping in 3D             98 // Use Cohen-Sutherland clipping in 3D
 74 // [Fundamentals of Interactive Computer Graph     99 // [Fundamentals of Interactive Computer Graphics,Foley & Van Dam]
 75 //                                                100 //
                                                   >> 101 
 76 G4bool G4VoxelLimits::ClipToLimits( G4ThreeVec    102 G4bool G4VoxelLimits::ClipToLimits( G4ThreeVector& pStart,
 77                                     G4ThreeVec    103                                     G4ThreeVector& pEnd      ) const
 78 {                                                 104 {
 79   G4int sCode, eCode ;                            105   G4int sCode, eCode ;
 80   G4bool remainsAfterClip ;                       106   G4bool remainsAfterClip ;
 81                                                   107     
 82   // Determine if line is trivially inside (bo    108   // Determine if line is trivially inside (both outcodes==0) or outside
 83   // (logical AND of outcodes !=0)                109   // (logical AND of outcodes !=0)
 84                                                   110 
 85   sCode = OutCode(pStart) ;                       111   sCode = OutCode(pStart) ;
 86   eCode = OutCode(pEnd)   ;                       112   eCode = OutCode(pEnd)   ;
 87                                                   113 
 88   if ( (sCode & eCode) != 0 )                  << 114   if ( sCode & eCode )
 89   {                                               115   {
 90     // Trivially outside, no intersection with    116     // Trivially outside, no intersection with region
 91                                                   117 
 92     remainsAfterClip = false;                     118     remainsAfterClip = false;
 93   }                                               119   }
 94   else if ( sCode == 0 && eCode == 0 )            120   else if ( sCode == 0 && eCode == 0 )
 95   {                                               121   {
 96     // Trivially inside, no intersections         122     // Trivially inside, no intersections
 97                                                   123 
 98     remainsAfterClip = true ;                     124     remainsAfterClip = true ;
 99   }                                               125   }
100   else                                            126   else
101   {                                               127   {
102     // Line segment *may* cut volume boundarie    128     // Line segment *may* cut volume boundaries
103     // At most, one end point is inside           129     // At most, one end point is inside
104                                                   130 
105     G4double x1, y1, z1, x2, y2, z2 ;             131     G4double x1, y1, z1, x2, y2, z2 ;
106                                                   132 
107     x1 = pStart.x() ;                             133     x1 = pStart.x() ;
108     y1 = pStart.y() ;                             134     y1 = pStart.y() ;
109     z1 = pStart.z() ;                             135     z1 = pStart.z() ;
110                                                   136 
111     x2 = pEnd.x() ;                               137     x2 = pEnd.x() ;
112     y2 = pEnd.y() ;                               138     y2 = pEnd.y() ;
113     z2 = pEnd.z() ;                               139     z2 = pEnd.z() ;
114                                                << 140     /*
                                                   >> 141     if( std::abs(x1-x2) < kCarTolerance*kCarTolerance)
                                                   >> 142     {
                                                   >> 143       G4cout<<"x1 = "<<x1<<"\t"<<"x2 = "<<x2<<G4endl; 
                                                   >> 144     }   
                                                   >> 145     if( std::abs(y1-y2) < kCarTolerance*kCarTolerance)
                                                   >> 146     {
                                                   >> 147       G4cout<<"y1 = "<<y1<<"\t"<<"y2 = "<<y2<<G4endl; 
                                                   >> 148     }   
                                                   >> 149     if( std::abs(z1-z2) < kCarTolerance*kCarTolerance)
                                                   >> 150     {
                                                   >> 151       G4cout<<"z1 = "<<z1<<"\t"<<"z2 = "<<z2<<G4endl; 
                                                   >> 152     } 
                                                   >> 153     */  
115     while ( sCode != eCode )  // Loop checking    154     while ( sCode != eCode )  // Loop checking, 06.08.2015, G.Cosmo
116     {                                             155     {
117       // Copy vectors to work variables x1-z1,    156       // Copy vectors to work variables x1-z1,x2-z2
118       // Ensure x1-z1 lies outside volume, swa    157       // Ensure x1-z1 lies outside volume, swapping vectors and outcodes
119       // if necessary                             158       // if necessary
120                                                   159 
121       if ( sCode != 0 )                        << 160       if ( sCode )
122       {                                           161       {
123         if ( (sCode & 0x01) != 0 )  // Clip ag << 162         if ( sCode & 0x01 )  // Clip against fxAxisMin
124         {                                         163         {
125           z1 += (fxAxisMin-x1)*(z2-z1)/(x2-x1)    164           z1 += (fxAxisMin-x1)*(z2-z1)/(x2-x1);
126           y1 += (fxAxisMin-x1)*(y2-y1)/(x2-x1)    165           y1 += (fxAxisMin-x1)*(y2-y1)/(x2-x1);
127           x1  = fxAxisMin;                        166           x1  = fxAxisMin;
128         }                                         167         }
129         else if ( (sCode & 0x02) != 0 ) // Cli << 168         else if ( sCode & 0x02 ) // Clip against fxAxisMax
130         {                                         169         {
131           z1 += (fxAxisMax-x1)*(z2-z1)/(x2-x1)    170           z1 += (fxAxisMax-x1)*(z2-z1)/(x2-x1);
132           y1 += (fxAxisMax-x1)*(y2-y1)/(x2-x1)    171           y1 += (fxAxisMax-x1)*(y2-y1)/(x2-x1);
133           x1  = fxAxisMax ;                       172           x1  = fxAxisMax ;
134         }                                         173         }
135         else if ( (sCode & 0x04) != 0 )  // Cl << 174         else if ( sCode & 0x04 )  // Clip against fyAxisMin
136         {                                         175         {
137           x1 += (fyAxisMin-y1)*(x2-x1)/(y2-y1)    176           x1 += (fyAxisMin-y1)*(x2-x1)/(y2-y1);
138           z1 += (fyAxisMin-y1)*(z2-z1)/(y2-y1)    177           z1 += (fyAxisMin-y1)*(z2-z1)/(y2-y1);
139           y1  = fyAxisMin;                        178           y1  = fyAxisMin;
140         }                                         179         }
141         else if ( (sCode & 0x08) != 0 )  // Cl << 180         else if ( sCode & 0x08 )  // Clip against fyAxisMax
142         {                                         181         {
143           x1 += (fyAxisMax-y1)*(x2-x1)/(y2-y1)    182           x1 += (fyAxisMax-y1)*(x2-x1)/(y2-y1);
144           z1 += (fyAxisMax-y1)*(z2-z1)/(y2-y1)    183           z1 += (fyAxisMax-y1)*(z2-z1)/(y2-y1);
145           y1  = fyAxisMax;                        184           y1  = fyAxisMax;
146         }                                         185         }
147         else if ( (sCode & 0x10) != 0 )  // Cl << 186         else if ( sCode & 0x10 )  // Clip against fzAxisMin
148         {                                         187         {
149           x1 += (fzAxisMin-z1)*(x2-x1)/(z2-z1)    188           x1 += (fzAxisMin-z1)*(x2-x1)/(z2-z1);
150           y1 += (fzAxisMin-z1)*(y2-y1)/(z2-z1)    189           y1 += (fzAxisMin-z1)*(y2-y1)/(z2-z1);
151           z1  = fzAxisMin;                        190           z1  = fzAxisMin;
152         }                                         191         }
153         else if ( (sCode & 0x20) != 0 )  // Cl << 192         else if ( sCode & 0x20 )  // Clip against fzAxisMax
154         {                                         193         {
155           x1 += (fzAxisMax-z1)*(x2-x1)/(z2-z1)    194           x1 += (fzAxisMax-z1)*(x2-x1)/(z2-z1);
156           y1 += (fzAxisMax-z1)*(y2-y1)/(z2-z1)    195           y1 += (fzAxisMax-z1)*(y2-y1)/(z2-z1);
157           z1  = fzAxisMax;                        196           z1  = fzAxisMax;
158         }                                         197         }
159       }                                           198       }
160       if ( eCode != 0 )  // Clip 2nd end: repe << 199       if ( eCode )  // Clip 2nd end: repeat of 1st, but 1<>2
161       {                                           200       {
162         if ( (eCode & 0x01) != 0 )  // Clip ag << 201         if ( eCode & 0x01 )  // Clip against fxAxisMin
163         {                                         202         {
164           z2 += (fxAxisMin-x2)*(z1-z2)/(x1-x2)    203           z2 += (fxAxisMin-x2)*(z1-z2)/(x1-x2);
165           y2 += (fxAxisMin-x2)*(y1-y2)/(x1-x2)    204           y2 += (fxAxisMin-x2)*(y1-y2)/(x1-x2);
166           x2  = fxAxisMin;                        205           x2  = fxAxisMin;
167         }                                         206         }
168         else if ( (eCode & 0x02) != 0 )  // Cl << 207         else if ( eCode & 0x02 )  // Clip against fxAxisMax
169         {                                         208         {
170           z2 += (fxAxisMax-x2)*(z1-z2)/(x1-x2)    209           z2 += (fxAxisMax-x2)*(z1-z2)/(x1-x2);
171           y2 += (fxAxisMax-x2)*(y1-y2)/(x1-x2)    210           y2 += (fxAxisMax-x2)*(y1-y2)/(x1-x2);
172           x2  = fxAxisMax;                        211           x2  = fxAxisMax;
173         }                                         212         }
174         else if ( (eCode & 0x04) != 0 )  // Cl << 213         else if ( eCode & 0x04 )  // Clip against fyAxisMin
175         {                                         214         {
176           x2 += (fyAxisMin-y2)*(x1-x2)/(y1-y2)    215           x2 += (fyAxisMin-y2)*(x1-x2)/(y1-y2);
177           z2 += (fyAxisMin-y2)*(z1-z2)/(y1-y2)    216           z2 += (fyAxisMin-y2)*(z1-z2)/(y1-y2);
178           y2  = fyAxisMin;                        217           y2  = fyAxisMin;
179         }                                         218         }
180         else if ((eCode&0x08) != 0)  // Clip a << 219         else if (eCode&0x08)  // Clip against fyAxisMax
181         {                                         220         {
182           x2 += (fyAxisMax-y2)*(x1-x2)/(y1-y2)    221           x2 += (fyAxisMax-y2)*(x1-x2)/(y1-y2);
183           z2 += (fyAxisMax-y2)*(z1-z2)/(y1-y2)    222           z2 += (fyAxisMax-y2)*(z1-z2)/(y1-y2);
184           y2  = fyAxisMax;                        223           y2  = fyAxisMax;
185         }                                         224         }
186         else if ( (eCode & 0x10) != 0 )  // Cl << 225         else if ( eCode & 0x10 )  // Clip against fzAxisMin
187         {                                         226         {
188           x2 += (fzAxisMin-z2)*(x1-x2)/(z1-z2)    227           x2 += (fzAxisMin-z2)*(x1-x2)/(z1-z2);
189           y2 += (fzAxisMin-z2)*(y1-y2)/(z1-z2)    228           y2 += (fzAxisMin-z2)*(y1-y2)/(z1-z2);
190           z2  = fzAxisMin;                        229           z2  = fzAxisMin;
191         }                                         230         }
192         else if ( (eCode & 0x20) != 0 )  // Cl << 231         else if ( eCode & 0x20 )  // Clip against fzAxisMax
193         {                                         232         {
194           x2 += (fzAxisMax-z2)*(x1-x2)/(z1-z2)    233           x2 += (fzAxisMax-z2)*(x1-x2)/(z1-z2);
195           y2 += (fzAxisMax-z2)*(y1-y2)/(z1-z2)    234           y2 += (fzAxisMax-z2)*(y1-y2)/(z1-z2);
196           z2  = fzAxisMax;                        235           z2  = fzAxisMax;
197         }                                         236         }
198       }                                           237       }
                                                   >> 238       //  G4endl; G4cout<<"x1 = "<<x1<<"\t"<<"x2 = "<<x2<<G4endl<<G4endl;
199       pStart = G4ThreeVector(x1,y1,z1);           239       pStart = G4ThreeVector(x1,y1,z1);
200       pEnd   = G4ThreeVector(x2,y2,z2);           240       pEnd   = G4ThreeVector(x2,y2,z2);
201       sCode  = OutCode(pStart);                   241       sCode  = OutCode(pStart);
202       eCode  = OutCode(pEnd);                     242       eCode  = OutCode(pEnd);
203     }                                             243     }
204     remainsAfterClip = sCode == 0 && eCode ==  << 244     if ( sCode == 0 && eCode == 0 ) remainsAfterClip = true;
                                                   >> 245     else                            remainsAfterClip = false;
205   }                                               246   }
206   return remainsAfterClip;                        247   return remainsAfterClip;
207 }                                                 248 }
208                                                   249 
209 //////////////////////////////////////////////    250 ////////////////////////////////////////////////////////////////////////////
210 //                                                251 //
211 // Calculate the `outcode' for the specified v    252 // Calculate the `outcode' for the specified vector:
212 // The following bits are set:                    253 // The following bits are set:
213 //   0      pVec.x()<fxAxisMin && IsXLimited()    254 //   0      pVec.x()<fxAxisMin && IsXLimited()
214 //   1      pVec.x()>fxAxisMax && IsXLimited()    255 //   1      pVec.x()>fxAxisMax && IsXLimited()
215 //   2      pVec.y()<fyAxisMin && IsYLimited()    256 //   2      pVec.y()<fyAxisMin && IsYLimited()
216 //   3      pVec.y()>fyAxisMax && IsYLimited()    257 //   3      pVec.y()>fyAxisMax && IsYLimited()
217 //   4      pVec.z()<fzAxisMin && IsZLimited()    258 //   4      pVec.z()<fzAxisMin && IsZLimited()
218 //   5      pVec.z()>fzAxisMax && IsZLimited()    259 //   5      pVec.z()>fzAxisMax && IsZLimited()
219 //                                                260 //
                                                   >> 261 
220 G4int G4VoxelLimits::OutCode( const G4ThreeVec    262 G4int G4VoxelLimits::OutCode( const G4ThreeVector& pVec ) const
221 {                                                 263 {
222   G4int code = 0 ;                // The outco    264   G4int code = 0 ;                // The outcode
223                                                   265 
224   if ( IsXLimited() )                             266   if ( IsXLimited() )
225   {                                               267   {
226     if ( pVec.x() < fxAxisMin ) code |= 0x01 ;    268     if ( pVec.x() < fxAxisMin ) code |= 0x01 ;
227     if ( pVec.x() > fxAxisMax ) code |= 0x02 ;    269     if ( pVec.x() > fxAxisMax ) code |= 0x02 ;
228   }                                               270   }
229   if ( IsYLimited() )                             271   if ( IsYLimited() )
230   {                                               272   {
231     if ( pVec.y() < fyAxisMin ) code |= 0x04 ;    273     if ( pVec.y() < fyAxisMin ) code |= 0x04 ;
232     if ( pVec.y() > fyAxisMax ) code |= 0x08 ;    274     if ( pVec.y() > fyAxisMax ) code |= 0x08 ;
233   }                                               275   }
234   if (IsZLimited())                               276   if (IsZLimited())
235   {                                               277   {
236     if ( pVec.z() < fzAxisMin ) code |= 0x10 ;    278     if ( pVec.z() < fzAxisMin ) code |= 0x10 ;
237     if ( pVec.z() > fzAxisMax ) code |= 0x20 ;    279     if ( pVec.z() > fzAxisMax ) code |= 0x20 ;
238   }                                               280   }
239   return code;                                    281   return code;
240 }                                                 282 }
241                                                   283 
242 //////////////////////////////////////////////    284 ///////////////////////////////////////////////////////////////////////////////
243                                                   285 
244 std::ostream& operator << (std::ostream& os, c    286 std::ostream& operator << (std::ostream& os, const G4VoxelLimits& pLim)
245 {                                                 287 {
246     os << "{";                                    288     os << "{";
247     if (pLim.IsXLimited())                        289     if (pLim.IsXLimited())
248         {                                         290         {
249             os << "(" << pLim.GetMinXExtent()     291             os << "(" << pLim.GetMinXExtent() 
250                << "," << pLim.GetMaxXExtent()     292                << "," << pLim.GetMaxXExtent() << ") ";
251         }                                         293         }
252     else                                          294     else
253         {                                         295         {
254             os << "(-,-) ";                       296             os << "(-,-) ";
255         }                                         297         }
256     if (pLim.IsYLimited())                        298     if (pLim.IsYLimited())
257         {                                         299         {
258             os << "(" << pLim.GetMinYExtent()     300             os << "(" << pLim.GetMinYExtent() 
259                << "," << pLim.GetMaxYExtent()     301                << "," << pLim.GetMaxYExtent() << ") ";
260         }                                         302         }
261     else                                          303     else
262         {                                         304         {
263             os << "(-,-) ";                       305             os << "(-,-) ";
264         }                                         306         }
265     if (pLim.IsZLimited())                        307     if (pLim.IsZLimited())
266         {                                         308         {
267             os << "(" << pLim.GetMinZExtent()     309             os << "(" << pLim.GetMinZExtent()
268                << "," << pLim.GetMaxZExtent()     310                << "," << pLim.GetMaxZExtent() << ")";
269         }                                         311         }
270     else                                          312     else
271         {                                         313         {
272             os << "(-,-)";                        314             os << "(-,-)";
273         }                                         315         }
274     os << "}";                                    316     os << "}";
275     return os;                                    317     return os;
276 }                                                 318 }
277                                                   319