-// Copyright (C) 2018-20xx CEA/DEN, EDF R&D
+// Copyright (C) 2018-2023 CEA, EDF
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
//
// 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
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.salome-platform.org/ or
-// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include <GeomAPI_Cylinder.h>
{
return Precision::IsInfinite(myHeight);
}
+
+//=================================================================================================
+bool GeomAPI_Cylinder::isCoincident(const GeomCylinderPtr theCylinder, const double theTolerance)
+{
+ if (!theCylinder)
+ return false;
+
+ gp_Cylinder* anOther = theCylinder->implPtr<gp_Cylinder>();
+ if (fabs(MY_CYL->Radius() - anOther->Radius()) < theTolerance) {
+ gp_Dir aDir1 = MY_CYL->Position().Direction();
+ gp_Dir aDir2 = anOther->Position().Direction();
+ if (aDir1.IsParallel(aDir2, Precision::Angular())) {
+ gp_Pnt aLoc1 = MY_CYL->Location();
+ gp_Pnt aLoc2 = anOther->Location();
+ gp_Vec aVec12(aLoc1, aLoc2);
+ if (aVec12.SquareMagnitude() < theTolerance * theTolerance ||
+ aVec12.IsParallel(aDir1, Precision::Angular())) {
+ return true;
+ }
+ }
+ }
+ return false;
+}