geom/src/GEOMAlgo/GEOMAlgo_BndSphere.lxx
2014-02-18 10:44:41 +04:00

109 lines
3.4 KiB
Plaintext
Executable File

// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File: GEOMAlgo_BndSphere.lxx
// Created:
// Author: Peter KURNEV
// <pkv@irinox>
//=======================================================================
//function : SetCenter
//purpose :
//=======================================================================
inline void GEOMAlgo_BndSphere::SetCenter(const gp_Pnt& theP)
//
{
myCenter=theP;
}
//=======================================================================
//function : Center
//purpose :
//=======================================================================
inline const gp_Pnt& GEOMAlgo_BndSphere::Center()const
{
return myCenter;
}
//=======================================================================
//function : SetRadius
//purpose :
//=======================================================================
inline void GEOMAlgo_BndSphere::SetRadius(const Standard_Real theR)
{
myRadius=theR;
}
//=======================================================================
//function : Radius
//purpose :
//=======================================================================
inline Standard_Real GEOMAlgo_BndSphere::Radius()const
{
return myRadius;
}
//=======================================================================
//function : SetGap
//purpose :
//=======================================================================
inline void GEOMAlgo_BndSphere::SetGap(const Standard_Real theGap)
{
myGap=theGap;
}
//=======================================================================
//function : Gap
//purpose :
//=======================================================================
inline Standard_Real GEOMAlgo_BndSphere::Gap()const
{
return myGap;
}
//=======================================================================
//function : Add
//purpose :
//=======================================================================
inline void GEOMAlgo_BndSphere::Add(const GEOMAlgo_BndSphere& theOther)
{
Standard_Real aTmax, aR, aT, aTOther;
gp_Pnt aPc;
//
aPc.SetXYZ(0.5*(myCenter.XYZ()+theOther.myCenter.XYZ()));
//
aR=aPc.Distance(myCenter);
//
aT=myRadius+myGap;
aTOther=theOther.myRadius+theOther.myGap;
aTmax=(aT>aTOther) ? aT: aTOther;
//
aR=aR+aTmax;
//
myCenter=aPc;
myRadius=aR;
}
//=======================================================================
//function : SquareExtent
//purpose :
//=======================================================================
inline Standard_Real GEOMAlgo_BndSphere::SquareExtent()const
{
Standard_Real aD;
//
aD=myRadius+myGap;
aD=aD+aD;
aD=aD*aD;
//
return aD;
}