Files
geant4/source/geometry/volumes/include/G4AuxiliaryNavServices.icc
T
2016-06-08 16:10:37 +02:00

80 lines
3.3 KiB
Plaintext

//
// ********************************************************************
// * 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: G4AuxiliaryNavServices.icc,v 1.3.2.1 2001/06/28 19:09:37 gunter Exp $
// GEANT4 tag $Name: $
//
//
// class G4AuxiliaryNavServices Inline implementation
//
inline G4bool G4AuxiliaryNavServices::CheckPointOnSurface( const G4VSolid* sampleSolid,
const G4ThreeVector& localPoint,
const G4ThreeVector* globalDirection,
const G4AffineTransform& sampleTransform,
const G4bool locatedOnEdge)
{
G4ThreeVector localDirection, sampleNormal;
G4bool enter=false;
if (sampleSolid->Inside(localPoint)!=kOutside)
{
if(locatedOnEdge && (globalDirection!=0))
{
// We are probably located on an edge.
localDirection= sampleTransform.TransformAxis(*globalDirection);
// Check whether we enter the volume
//
sampleNormal= sampleSolid->SurfaceNormal(localPoint);
if ( sampleNormal.dot(localDirection) <= 0 )
{
if( sampleNormal.dot(localDirection) == 0 )
{
// We can't decide yet, let's make sure we're entering the solid
//
// If by a confusion we entered the next solid we find out now that
// whether to leave or to enter.
// This happens when we're no the surface or edge shared by two solids
//
G4double distanceToIn = sampleSolid->DistanceToIn( localPoint, localDirection );
if( distanceToIn != kInfinity )
{
enter = true;
}
}
else
{
enter= true;
}
}
}
else
{
enter= true;
}
}
return enter;
}