geom/src/NMTDS/NMTDS_BndSphere.lxx

109 lines
3.4 KiB
Plaintext
Raw Normal View History

2013-04-01 18:25:01 +06:00
// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
2012-08-09 13:58:02 +06:00
//
// 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.
//
// 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
//
2013-06-17 18:15:50 +06:00
// File: NMTDS_BndSphere.lxx
// Created:
// Author: Peter KURNEV
// <pkv@irinox>
2012-08-09 13:58:02 +06:00
//=======================================================================
//function : SetCenter
//purpose :
//=======================================================================
inline void NMTDS_BndSphere::SetCenter(const gp_Pnt& theP)
//
{
myCenter=theP;
}
//=======================================================================
//function : Center
//purpose :
//=======================================================================
inline const gp_Pnt& NMTDS_BndSphere::Center()const
{
return myCenter;
}
//=======================================================================
//function : SetRadius
//purpose :
//=======================================================================
inline void NMTDS_BndSphere::SetRadius(const Standard_Real theR)
{
myRadius=theR;
}
//=======================================================================
//function : Radius
//purpose :
//=======================================================================
inline Standard_Real NMTDS_BndSphere::Radius()const
{
return myRadius;
}
//=======================================================================
//function : SetGap
//purpose :
//=======================================================================
inline void NMTDS_BndSphere::SetGap(const Standard_Real theGap)
{
myGap=theGap;
}
//=======================================================================
//function : Gap
//purpose :
//=======================================================================
inline Standard_Real NMTDS_BndSphere::Gap()const
{
return myGap;
}
//=======================================================================
//function : Add
//purpose :
//=======================================================================
inline void NMTDS_BndSphere::Add(const NMTDS_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 NMTDS_BndSphere::SquareExtent()const
{
Standard_Real aD;
//
aD=myRadius+myGap;
aD=aD+aD;
aD=aD*aD;
//
return aD;
}