// // ******************************************************************** // * DISCLAIMER * // * * // * The following disclaimer summarizes all the specific disclaimers * // * of contributors to this software. The specific disclaimers,which * // * govern, are listed with their locations in: * // * http://cern.ch/geant4/license * // * * // * Neither the authors of this software system, nor their employing * // * institutes,nor the agencies providing financial support for this * // * work make any representation or warranty, express or implied, * // * regarding this software system or assume any liability for its * // * use. * // * * // * This code implementation is the intellectual property of the * // * GEANT4 collaboration. * // * By copying, distributing or modifying the Program (or any work * // * based on the Program) you indicate your acceptance of this * // * statement, and all its terms. * // ******************************************************************** // // // $Id: G4ParameterisedNavigation.icc,v 1.5 2005/06/14 16:09:43 japost Exp $ // GEANT4 tag $Name: geant4-08-00 $ // // // class G4ParameterisedNavigation Inline implementation // // -------------------------------------------------------------------- // ******************************************************************** // ParamVoxelLocate // ******************************************************************** // inline G4SmartVoxelNode* G4ParameterisedNavigation::ParamVoxelLocate( G4SmartVoxelHeader* pHead, const G4ThreeVector& localPoint ) { // If no parameterisation axis is specified, adopt default // location strategy as for placements // if ( pHead->GetParamAxis()==kUndefined ) { fVoxelNode = G4VoxelNavigation::VoxelLocate(pHead,localPoint); } else { G4double targetHeaderMin, targetHeaderNodeWidth; G4int targetHeaderNoSlices, targetNodeNo; EAxis targetHeaderAxis; targetHeaderAxis = pHead->GetAxis(); targetHeaderNoSlices = pHead->GetNoSlices(); targetHeaderMin = pHead->GetMinExtent(); targetHeaderNodeWidth = (pHead->GetMaxExtent()-targetHeaderMin) / targetHeaderNoSlices; targetNodeNo = G4int ( (localPoint(targetHeaderAxis)-targetHeaderMin) / targetHeaderNodeWidth ); // Rounding protection // if ( targetNodeNo<0 ) { targetNodeNo = 0; } else if ( targetNodeNo>=targetHeaderNoSlices ) { targetNodeNo = targetHeaderNoSlices-1; } fVoxelAxis = targetHeaderAxis; fVoxelNoSlices = targetHeaderNoSlices; fVoxelSliceWidth = targetHeaderNodeWidth; fVoxelNodeNo = targetNodeNo; fVoxelHeader = pHead; fVoxelNode = pHead->GetSlice(targetNodeNo)->GetNode(); } return fVoxelNode; }