// 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: G4VoxelLimits.icc,v 1.1 2000/04/20 16:49:48 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
// 
// G4VoxelLimits Inline implementation
//

inline
G4double G4VoxelLimits::GetMaxXExtent() const
{
  return fxAxisMax;
}

inline
G4double G4VoxelLimits::GetMaxYExtent() const
{
  return fyAxisMax;
}

inline
G4double G4VoxelLimits::GetMaxZExtent() const
{
  return fzAxisMax;
}

inline
G4double G4VoxelLimits::GetMinXExtent() const
{
  return fxAxisMin;
}

inline
G4double G4VoxelLimits::GetMinYExtent() const
{
  return fyAxisMin;
}

inline
G4double G4VoxelLimits::GetMinZExtent() const
{
  return fzAxisMin;
}

inline
G4double G4VoxelLimits::GetMaxExtent(const EAxis pAxis) const
{
  if (pAxis==kXAxis)
  {
    return GetMaxXExtent();
  }
  else if (pAxis==kYAxis)
  {
    return GetMaxYExtent();
  }
  else 
  {
    assert(pAxis==kZAxis);
    return GetMaxZExtent();
  }
}

inline
G4double G4VoxelLimits::GetMinExtent(const EAxis pAxis) const
{
  if (pAxis==kXAxis)
  {
    return GetMinXExtent();
  }
  else if (pAxis==kYAxis)
  {
    return GetMinYExtent();
  }
  else 
  {
    assert(pAxis==kZAxis);
    return GetMinZExtent();
  }
}

inline
G4bool G4VoxelLimits::IsXLimited() const
{
  return (fxAxisMin==-kInfinity&&fxAxisMax==kInfinity) ? false : true;
}

inline
G4bool G4VoxelLimits::IsYLimited() const
{
  return (fyAxisMin==-kInfinity&&fyAxisMax==kInfinity) ? false : true;
}

inline
G4bool G4VoxelLimits::IsZLimited() const
{
  return (fzAxisMin==-kInfinity&&fzAxisMax==kInfinity) ? false : true;
}

inline
G4bool G4VoxelLimits::IsLimited() const
{
  return (IsXLimited()||IsYLimited()||IsZLimited());
}

inline
G4bool G4VoxelLimits::IsLimited(const EAxis pAxis) const
{
  if (pAxis==kXAxis)
  {
    return IsXLimited();
  }
  else if (pAxis==kYAxis)
  {
    return IsYLimited();
  }
  else 
  {
    assert(pAxis==kZAxis);
    return IsZLimited();
  }
}

inline
G4bool G4VoxelLimits::Inside(const G4ThreeVector& pVec) const
{
  return ((GetMinXExtent()<=pVec.x()) &&
	  (GetMaxXExtent()>=pVec.x()) &&
	  (GetMinYExtent()<=pVec.y()) &&
	  (GetMaxYExtent()>=pVec.y()) &&
	  (GetMinZExtent()<=pVec.z()) &&
	  (GetMaxZExtent()>=pVec.z()) ) ? true : false;
}
