-// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// 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.
+// 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
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
-// File: GEOMAlgo_GetInPlace_1.cxx
-// Author: Peter KURNEV
+// File: GEOMAlgo_GetInPlace_1.cxx
+// Author: Peter KURNEV
#include <GEOMAlgo_GetInPlace.hxx>
#include <IntTools_Tools.hxx>
-#include <BOPTools_Tools3D.hxx>
-#include <BOPTools_Tools2D.hxx>
+#include <GEOMAlgo_AlgoTools.hxx>
static
Standard_Integer PntInEdge(const TopoDS_Edge& aF,
- gp_Pnt& aP);
+ gp_Pnt& aP);
static
Standard_Integer PntInEdge(const TopoDS_Edge& aF,
- gp_Pnt& aP,
- Standard_Real& aT);
+ gp_Pnt& aP,
+ Standard_Real& aT);
static
Standard_Integer PntInFace(const TopoDS_Face& aF,
- gp_Pnt& aP);
+ gp_Pnt& aP);
static
Standard_Integer PntInFace(const TopoDS_Face& aF,
- gp_Pnt& aP,
- gp_Pnt2d& theP2D);
+ gp_Pnt& aP,
+ gp_Pnt2d& theP2D);
static
Standard_Integer PntInSolid(const TopoDS_Solid& aZ,
- const Standard_Real aTol,
- gp_Pnt& aP);
+ const Standard_Real aTol,
+ gp_Pnt& aP);
//=======================================================================
//purpose :
//=======================================================================
Standard_Boolean GEOMAlgo_GetInPlace::CheckCoincidence(const TopoDS_Shape& aS1,
- const TopoDS_Shape& aS2)
+ const TopoDS_Shape& aS2)
{
Standard_Boolean bOk;
Standard_Integer iErr;
aDmin=aPPC.LowerDistance();
aT=aPPC.LowerDistanceParameter();
if (aDmin < myTolerance) {
- dT=1.e-12;
- BRep_Tool::Curve(aE1, aT1, aT2);
+ dT=1.e-12;
+ BRep_Tool::Curve(aE1, aT1, aT2);
if(aT > (aT1-dT) && aT < (aT2+dT)) {
- bOk=Standard_True;
- }
+ bOk=Standard_True;
+ }
}
}
//else {
//purpose :
//=======================================================================
Standard_Integer PntInEdge(const TopoDS_Edge& aE,
- gp_Pnt& aP)
+ gp_Pnt& aP)
{
Standard_Integer iErr;
//purpose :
//=======================================================================
Standard_Integer PntInEdge(const TopoDS_Edge& aE,
- gp_Pnt& aP,
- Standard_Real& aT)
+ gp_Pnt& aP,
+ Standard_Real& aT)
{
Standard_Integer iErr;
Standard_Real aT1, aT2;
//purpose :
//=======================================================================
Standard_Integer PntInSolid(const TopoDS_Solid& aZ,
- const Standard_Real aTol,
- gp_Pnt& aP)
+ const Standard_Real aTol,
+ gp_Pnt& aP)
{
Standard_Integer iErr;
Standard_Real aUx, aVx, aCoef;
gp_Pnt aPx;
gp_Pnt2d aP2Dx;
gp_Vec aDNx;
-
TopoDS_Face aF;
TopExp_Explorer aExp;
//
aCoef=10.;
//
aExp.Init (aZ, TopAbs_FACE);
- for (; aExp.More() ; aExp.Next()) {
+ if (aExp.More()) {
aF=*((TopoDS_Face*)&aExp.Current());
- break;
}
//
iErr=PntInFace(aF, aPx, aP2Dx);
}
//
aP2Dx.Coord(aUx, aVx);
- BOPTools_Tools2D::FaceNormal(aF, aUx, aVx, aDNx);
+ GEOMAlgo_AlgoTools::FaceNormal(aF, aUx, aVx, aDNx);
aDNx.Reverse();
//
aP.SetXYZ(aPx.XYZ()+aCoef*aTol*aDNx.XYZ());
//purpose :
//=======================================================================
Standard_Integer PntInFace(const TopoDS_Face& aF,
- gp_Pnt& aP)
+ gp_Pnt& aP)
{
Standard_Integer iErr;
//
//purpose :
//=======================================================================
Standard_Integer PntInFace(const TopoDS_Face& aF,
- gp_Pnt& theP,
- gp_Pnt2d& theP2D)
+ gp_Pnt& theP,
+ gp_Pnt2d& theP2D)
{
Standard_Boolean bIsDone, bHasFirstPoint, bHasSecondPoint;
Standard_Integer iErr, aIx, aNbDomains, i;
//
Geom2dHatch_Intersector aIntr(aTotArcIntr, aTolTangfIntr);
Geom2dHatch_Hatcher aHatcher(aIntr,
- aTolHatch2D, aTolHatch3D,
- Standard_True, Standard_False);
+ aTolHatch2D, aTolHatch3D,
+ Standard_True, Standard_False);
//
iErr=0;
aEpsT=1.e-12;
//
// 4.
aNbDomains=aHatcher.NbDomains(aIx);
- for (i=1; i<=aNbDomains; ++i) {
- const HatchGen_Domain& aDomain=aHatcher.Domain (aIx, i) ;
- bHasFirstPoint=aDomain.HasFirstPoint();
- if (!bHasFirstPoint) {
- iErr=5;
- return iErr;
- }
- //
- aV1=aDomain.FirstPoint().Parameter();
- //
- bHasSecondPoint=aDomain.HasSecondPoint();
- if (!bHasSecondPoint) {
- iErr=6;
- return iErr;
- }
- //
- aV2=aDomain.SecondPoint().Parameter();
- //
- aVx=IntTools_Tools::IntermediatePoint(aV1, aV2);
- //
- break;
+ if (!aNbDomains) {
+ iErr=5;
+ return iErr;
+ }
+ //
+ i=1;
+ const HatchGen_Domain& aDomain=aHatcher.Domain (aIx, i) ;
+ bHasFirstPoint=aDomain.HasFirstPoint();
+ if (!bHasFirstPoint) {
+ iErr=5;
+ return iErr;
+ }
+ //
+ aV1=aDomain.FirstPoint().Parameter();
+ //
+ bHasSecondPoint=aDomain.HasSecondPoint();
+ if (!bHasSecondPoint) {
+ iErr=6;
+ return iErr;
}
//
+ aV2=aDomain.SecondPoint().Parameter();
+ //
+ aVx=IntTools_Tools::IntermediatePoint(aV1, aV2);
+ //
aS->D0(aUx, aVx, aPx);
//
theP2D.SetCoord(aUx, aVx);