Coding - Apply more flags from Clang-tidy (#977)

- Refactor boolean expressions and improve code readability across multiple files
- Simplified boolean expressions by removing unnecessary comparisons to true/false.
- Replaced explicit boolean checks with direct variable usage 

Used flags:
readability-static-accessed-through-instance
readability-simplify-boolean-expr
performance-for-range-copy
performance-move-const-arg
misc-unused-parameters
misc-redundant-expression
This commit is contained in:
Pasukhin Dmitry
2026-01-03 12:18:59 +00:00
committed by GitHub
parent 825b0bd782
commit 6c24544fe1
582 changed files with 1535 additions and 3246 deletions
@@ -164,7 +164,7 @@ void BOPAlgo_ArgumentAnalyzer::Perform(const Message_ProgressRange& theRange)
// 4. Test small edges
if (mySmallEdgeMode)
{
if (!(!myResult.IsEmpty() && myStopOnFirst))
if (myResult.IsEmpty() || !myStopOnFirst)
TestSmallEdge();
if (UserBreak(aPS))
{
@@ -175,7 +175,7 @@ void BOPAlgo_ArgumentAnalyzer::Perform(const Message_ProgressRange& theRange)
// 5. Test possibility to rebuild faces
if (myRebuildFaceMode)
{
if (!(!myResult.IsEmpty() && myStopOnFirst))
if (myResult.IsEmpty() || !myStopOnFirst)
TestRebuildFace();
if (UserBreak(aPS))
{
@@ -186,7 +186,7 @@ void BOPAlgo_ArgumentAnalyzer::Perform(const Message_ProgressRange& theRange)
// 6. Test tangent
if (myTangentMode)
{
if (!(!myResult.IsEmpty() && myStopOnFirst))
if (myResult.IsEmpty() || !myStopOnFirst)
{
TestTangent();
if (UserBreak(aPS))
@@ -199,7 +199,7 @@ void BOPAlgo_ArgumentAnalyzer::Perform(const Message_ProgressRange& theRange)
// 7. Test merge vertices
if (myMergeVertexMode)
{
if (!(!myResult.IsEmpty() && myStopOnFirst))
if (myResult.IsEmpty() || !myStopOnFirst)
TestMergeVertex();
if (UserBreak(aPS))
{
@@ -210,7 +210,7 @@ void BOPAlgo_ArgumentAnalyzer::Perform(const Message_ProgressRange& theRange)
// 8. Test merge edges
if (myMergeEdgeMode)
{
if (!(!myResult.IsEmpty() && myStopOnFirst))
if (myResult.IsEmpty() || !myStopOnFirst)
TestMergeEdge();
if (UserBreak(aPS))
{
@@ -221,7 +221,7 @@ void BOPAlgo_ArgumentAnalyzer::Perform(const Message_ProgressRange& theRange)
// 9. Test shapes continuity
if (myContinuityMode)
{
if (!(!myResult.IsEmpty() && myStopOnFirst))
if (myResult.IsEmpty() || !myStopOnFirst)
TestContinuity();
if (UserBreak(aPS))
{
@@ -232,7 +232,7 @@ void BOPAlgo_ArgumentAnalyzer::Perform(const Message_ProgressRange& theRange)
// 10. Test validity of the curves on the surfaces
if (myCurveOnSurfaceMode)
{
if (!(!myResult.IsEmpty() && myStopOnFirst))
if (myResult.IsEmpty() || !myStopOnFirst)
TestCurveOnSurface();
}
}
@@ -108,8 +108,8 @@ void BOPAlgo_BOP::CheckData()
bool bFuse;
NCollection_List<TopoDS_Shape>::Iterator aItLS;
//
if (!(myOperation == BOPAlgo_COMMON || myOperation == BOPAlgo_FUSE || myOperation == BOPAlgo_CUT
|| myOperation == BOPAlgo_CUT21))
if (myOperation != BOPAlgo_COMMON && myOperation != BOPAlgo_FUSE && myOperation != BOPAlgo_CUT
&& myOperation != BOPAlgo_CUT21)
{
// non-licit operation
AddError(new BOPAlgo_AlertBOPNotSet);
@@ -768,7 +768,7 @@ void BOPAlgo_PaveFiller::AnalyzeShrunkData(const occ::handle<BOPDS_PaveBlock>& t
double aEFirst, aELast, aPBFirst, aPBLast;
BRep_Tool::Range(theSR.Edge(), aEFirst, aELast);
thePB->Range(aPBFirst, aPBLast);
bWholeEdge = !(aPBFirst > aEFirst || aPBLast < aELast);
bWholeEdge = aPBFirst <= aEFirst && aPBLast >= aELast;
if (bWholeEdge && thePB->OriginalEdge() >= 0)
{
aWarnShape = theSR.Edge();
@@ -589,11 +589,7 @@ bool BOPAlgo_PaveFiller::CheckFacePaves(const int nVx,
const NCollection_Map<int>& aMIFOn,
const NCollection_Map<int>& aMIFIn)
{
if (aMIFOn.Contains(nVx) || aMIFIn.Contains(nVx))
{
return true;
}
return false;
return aMIFOn.Contains(nVx) || aMIFIn.Contains(nVx);
}
//=================================================================================================
@@ -2611,7 +2611,7 @@ void BOPAlgo_PaveFiller::PutEFPavesOnCurve(const NCollection_Vector<BOPDS_Curve>
const IntTools_Curve& aIC = aNC.Curve();
GeomAbs_CurveType aTypeC;
aTypeC = aIC.Type();
if (!(aTypeC == GeomAbs_BezierCurve || aTypeC == GeomAbs_BSplineCurve))
if (aTypeC != GeomAbs_BezierCurve && aTypeC != GeomAbs_BSplineCurve)
{
return;
}
@@ -202,7 +202,7 @@ void BOPAlgo_ShellSplitter::SplitBlock(BOPTools_ConnexityBlock& aCB)
for (i = 1; i <= aNbE; ++i)
{
const TopoDS_Edge& aE = TopoDS::Edge(aEFMap.FindKey(i));
if (!(BRep_Tool::Degenerated(aE) || aE.Orientation() == TopAbs_INTERNAL))
if (!BRep_Tool::Degenerated(aE) && aE.Orientation() != TopAbs_INTERNAL)
{
const NCollection_List<TopoDS_Shape>& aLF = aEFMap(i);
if (aLF.Extent() == 1)
@@ -1500,7 +1500,7 @@ bool BOPTools_AlgoTools::IsHole(const TopoDS_Shape& aW, const TopoDS_Shape& aFac
{
const TopoDS_Edge& aE = (*(TopoDS_Edge*)(&aItW.Value()));
aOr = aE.Orientation();
if (!(aOr == TopAbs_FORWARD || aOr == TopAbs_REVERSED))
if (aOr != TopAbs_FORWARD && aOr != TopAbs_REVERSED)
{
continue;
}
@@ -43,7 +43,7 @@ public:
{
OSD_Environment env("CSF_DEBUG_BOP");
TCollection_AsciiString pathdump = env.Value();
myIsDump = (!pathdump.IsEmpty() ? true : false);
myIsDump = (!pathdump.IsEmpty());
myPath = pathdump.ToCString();
};
@@ -826,14 +826,7 @@ void IntTools_BeanFaceIntersector::ComputeLinePlane()
if (std::abs(Direc) < Tolang)
{
parallel = true;
if (std::abs(Dis) < myCriteria)
{
inplane = true;
}
else
{
inplane = false;
}
inplane = std::abs(Dis) < myCriteria;
}
else
{
@@ -604,11 +604,7 @@ TopAbs_State IntTools_Context::StatePointFace(const TopoDS_Face& aF, const gp_Pn
bool IntTools_Context::IsPointInFace(const TopoDS_Face& aF, const gp_Pnt2d& aP2d)
{
TopAbs_State aState = StatePointFace(aF, aP2d);
if (aState == TopAbs_OUT || aState == TopAbs_ON)
{
return false;
}
return true;
return aState != TopAbs_OUT && aState != TopAbs_ON;
}
//=================================================================================================
@@ -643,11 +639,7 @@ bool IntTools_Context::IsPointInFace(const gp_Pnt& aP, const TopoDS_Face& aF, co
bool IntTools_Context::IsPointInOnFace(const TopoDS_Face& aF, const gp_Pnt2d& aP2d)
{
TopAbs_State aState = StatePointFace(aF, aP2d);
if (aState == TopAbs_OUT)
{
return false;
}
return true;
return aState != TopAbs_OUT;
}
//=================================================================================================
@@ -70,7 +70,7 @@ bool IntTools_Curve::Bounds(double& theFirst,
bool IntTools_Curve::D0(const double& thePar, gp_Pnt& thePnt) const
{
bool bInside = !(thePar < my3dCurve->FirstParameter() && thePar > my3dCurve->LastParameter());
bool bInside = thePar >= my3dCurve->FirstParameter() || thePar <= my3dCurve->LastParameter();
if (bInside)
{
my3dCurve->D0(thePar, thePnt);
@@ -149,7 +149,7 @@ void IntTools_FClass2d::Init(const TopoDS_Face& aFace, const double TolUV)
NbEdges--;
edge = aWExp.Current();
Or = edge.Orientation();
if (!(Or == TopAbs_FORWARD || Or == TopAbs_REVERSED))
if (Or != TopAbs_FORWARD && Or != TopAbs_REVERSED)
{
continue;
}
@@ -295,7 +295,7 @@ void IntTools_FClass2d::Init(const TopoDS_Face& aFace, const double TolUV)
Vmax = P2d.Y();
//
aDstX = RealLast();
if (degenerated == false)
if (!degenerated)
{
P3d = C3d.Value(u);
if (!SeqPnt2d.IsEmpty())
@@ -326,7 +326,7 @@ void IntTools_FClass2d::Init(const TopoDS_Face& aFace, const double TolUV)
//
if (IsRealCurve3d)
{
if (degenerated == false)
if (!degenerated)
{
Ancienpnt3d = P3d;
Ancienpnt3dinitialise = true;
@@ -1495,7 +1495,7 @@ reapprox:;
NCollection_Array1<gp_Pnt2d> tpoles2d(1, nbpoles);
NCollection_Array1<gp_Pnt> tpoles(1, nbpoles);
mbspc.Curve((myApprox1 == true) ? 2 : 1, tpoles2d);
mbspc.Curve((myApprox1) ? 2 : 1, tpoles2d);
const gp_Pln& Pln = myHS2->Plane();
//
int ik;
@@ -1673,7 +1673,7 @@ reapprox:;
{
occ::handle<Geom2d_BSplineCurve> BS2;
NCollection_Array1<gp_Pnt2d> tpoles2d(1, nbpoles);
mbspc.Curve((myApprox1 == true) ? 3 : 2, tpoles2d);
mbspc.Curve((myApprox1) ? 3 : 2, tpoles2d);
BS2 = new Geom2d_BSplineCurve(tpoles2d,
mbspc.Knots(),
mbspc.Multiplicities(),
@@ -301,11 +301,7 @@ bool IntTools_Tools::IsVertex(const IntTools_CommonPrt& aCmnPrt)
const IntTools_Range& aR2 = aRs2(1);
aParam = 0.5 * (aR2.First() + aR2.Last());
anIsVertex = IntTools_Tools::IsVertex(aE2, aParam);
if (anIsVertex)
{
return true;
}
return false;
return anIsVertex;
}
//=================================================================================================
@@ -322,11 +318,7 @@ bool IntTools_Tools::IsVertex(const TopoDS_Edge& aE, const TopoDS_Vertex& aV, co
aTolV2 = aTolV * aTolV;
aPv = BRep_Tool::Pnt(aV);
d2 = aPv.SquareDistance(aPt);
if (d2 < aTolV2)
{
return true;
}
return false;
return d2 < aTolV2;
}
//=================================================================================================
@@ -104,7 +104,7 @@ TopoDS_Wire BRepAlgo::ConvertWire(const TopoDS_Wire& theWire,
for (int iCrv = aResultApprox.Length(); iCrv > 0; iCrv--)
{
const occ::handle<Geom2d_Curve>& aCrv = aResultApprox(iCrv);
if (aCrv.IsNull() == false)
if (!aCrv.IsNull())
{
OrientedCurve& anOCurve = vecCurve.Append(OrientedCurve());
anOCurve.Curve = occ::down_cast<Geom2d_TrimmedCurve>(aCrv);
@@ -117,7 +117,7 @@ TopoDS_Wire BRepAlgo::ConvertWire(const TopoDS_Wire& theWire,
for (int iCrv = 1; iCrv <= aResultApprox.Length(); iCrv++)
{
const occ::handle<Geom2d_Curve>& aCrv = aResultApprox(iCrv);
if (aCrv.IsNull() == false)
if (!aCrv.IsNull())
{
OrientedCurve& anOCurve = vecCurve.Append(OrientedCurve());
anOCurve.Curve = occ::down_cast<Geom2d_TrimmedCurve>(aCrv);
@@ -222,7 +222,7 @@ void BRepAlgo_AsDes::Replace(const TopoDS_Shape& OldS, const TopoDS_Shape& NewS)
continue;
}
//
bool InUp = !i ? false : true;
bool InUp = i != 0;
BackReplace(OldS, NewS, *pLSOld, InUp);
//
NCollection_List<TopoDS_Shape>* pLSNew = aMap.ChangeSeek(NewS);
@@ -312,7 +312,7 @@ void BRepAlgo_NormalProjection::Build()
else
HPCur = HProjector;
if ((myWith3d == false || Elementary) && (HProjector->MaxDistance(k) <= myTol3d))
if ((!myWith3d || Elementary) && (HProjector->MaxDistance(k) <= myTol3d))
Only2d = true;
if (Only2d && Only3d)
@@ -1643,7 +1643,7 @@ void ProcessVertex(const TopoDS_Vertex& aV,
}
//
anOrV = aVx.Orientation();
if (!(anOrV == TopAbs_FORWARD || anOrV == TopAbs_REVERSED))
if (anOrV != TopAbs_FORWARD && anOrV != TopAbs_REVERSED)
{
continue;
}
@@ -2430,7 +2430,7 @@ void BRepFill_CompatibleWires::SearchOrigin()
};
gp_Vec VDebFin0(P1o, P2o), VDebFin(P1, P2);
double AStraight = VDebFin0.Angle(VDebFin);
parcours = (AStraight < M_PI / 2.0 ? true : false);
parcours = (AStraight < M_PI / 2.0);
}
// reconstruction of the wire
@@ -2945,10 +2945,7 @@ bool DoubleOrNotInFace(const NCollection_Sequence<TopoDS_Shape>& EC, const TopoD
Vu = true;
}
}
if (Vu)
return false;
else
return true;
return !Vu;
}
//=================================================================================================
@@ -1063,12 +1063,12 @@ void BRepFill_Generator::Perform()
TopoDS_Wire aWire;
B.MakeWire(aWire);
if (!(degen1 && IType == 4))
if (!degen1 || IType != 4)
{
B.Add(aWire, Edge1);
}
B.Add(aWire, Edge4);
if (!(degen2 && IType == 4))
if (!degen2 || IType != 4)
{
B.Add(aWire, Edge2.Reversed());
}
@@ -1078,7 +1078,7 @@ void BRepFill_Generator::Perform()
B.Add(myShell, Face);
// complete myMap for edge1
if (!(degen1 && IType == 4))
if (!degen1 || IType != 4)
{
TopoDS_Edge aREd = anOrEdge1;
if (degen1)
@@ -440,7 +440,7 @@ void BRepFill_LocationLaw::CurvilinearBounds(const int Index, double& First, dou
for (ii = 1, Length = 0.; ii <= NbE; ii++)
{
myLaws->Value(ii)->GetDomain(f, l);
Length += AbsC.Length(*myLaws->Value(ii)->GetCurve(), myTol);
Length += GCPnts_AbscissaPoint::Length(*myLaws->Value(ii)->GetCurve(), myTol);
myLength->SetValue(ii + 1, Length);
}
@@ -670,9 +670,9 @@ double BRepFill_LocationLaw::Abscissa(const int Index, const double Param)
CurvilinearBounds(Index, bid, Length);
}
Length += AbsC.Length(*myLaws->Value(Index)->GetCurve(),
myLaws->Value(Index)->GetCurve()->FirstParameter(),
Param,
myTol);
Length += GCPnts_AbscissaPoint::Length(*myLaws->Value(Index)->GetCurve(),
myLaws->Value(Index)->GetCurve()->FirstParameter(),
Param,
myTol);
return Length;
}
@@ -63,10 +63,7 @@ static bool isIsoU(const TopoDS_Face& Face, const TopoDS_Edge& Edge)
gp_Dir2d D = C->DN(f, 1);
if (std::abs(D.Dot(gp::DX2d())) < std::abs(D.Dot(gp::DY2d())))
return true;
else
return false;
return std::abs(D.Dot(gp::DX2d())) < std::abs(D.Dot(gp::DY2d()));
}
//=================================================================================================
@@ -2455,10 +2455,7 @@ bool DoubleOrNotInside(const NCollection_List<TopoDS_Shape>& LV, const TopoDS_Ve
Vu = true;
}
}
if (Vu)
return false;
else
return true;
return !Vu;
}
bool IsSmallClosedEdge(const TopoDS_Edge& anEdge, const TopoDS_Vertex& aVertex)
@@ -2485,10 +2482,7 @@ bool IsSmallClosedEdge(const TopoDS_Edge& anEdge, const TopoDS_Vertex& aVertex)
double dist2 = Plast.Distance(PV2d);
double dist3 = Pmid.Distance(PV2d);
if (dist1 <= theTol && dist2 <= theTol && dist3 <= theTol)
return true;
return false;
return dist1 <= theTol && dist2 <= theTol && dist3 <= theTol;
}
static void CheckBadEdges(const TopoDS_Face& Spine,
@@ -636,7 +636,7 @@ TopoDS_Shape BRepFill_Pipe::MakeShape(const TopoDS_Shape& S,
occ::handle<NCollection_HArray2<TopoDS_Shape>> aSections = MkSw.Sections();
if (aSections.IsNull() == false)
if (!aSections.IsNull())
{
const int aVLast = aSections->UpperCol();
@@ -199,9 +199,7 @@ static bool IsSameOriented(const TopoDS_Shape& aFace, const TopoDS_Shape& aShell
}
TopAbs_Orientation Or2 = theEdge.Orientation();
if (Or1 == Or2)
return false;
return true;
return Or1 != Or2;
}
//=================================================================================================
@@ -1748,7 +1748,7 @@ static bool IsDegen(const occ::handle<Geom_Surface>& S, const double Tol)
t = Umin + ii * dt;
Iso = S->UIso(t);
GeomAdaptor_Curve AC(Iso);
l = GC.Length(AC, Tol / 4);
l = GCPnts_AbscissaPoint::Length(AC, Tol / 4);
B = (l <= Tol);
}
@@ -1767,7 +1767,7 @@ static bool IsDegen(const occ::handle<Geom_Surface>& S, const double Tol)
t = Vmin + ii * dt;
Iso = S->VIso(t);
GeomAdaptor_Curve AC(Iso);
l = GC.Length(AC, Tol / 4);
l = GCPnts_AbscissaPoint::Length(AC, Tol / 4);
B = (l <= Tol);
}
@@ -202,10 +202,10 @@ static void EvalParameters(const TopoDS_Edge& Edge,
// extra solutions those would cause *Exception*: incoherent intersection
GeomAbs_CurveType CType = AC.GetType(), BisType = ABis.GetType();
bool canElongateC = !(CType == GeomAbs_BezierCurve || CType == GeomAbs_BSplineCurve
|| CType == GeomAbs_OffsetCurve || CType == GeomAbs_OtherCurve);
bool canElongateBis = !(BisType == GeomAbs_BezierCurve || BisType == GeomAbs_BSplineCurve
|| BisType == GeomAbs_OffsetCurve || BisType == GeomAbs_OtherCurve);
bool canElongateC = CType != GeomAbs_BezierCurve && CType != GeomAbs_BSplineCurve
&& CType != GeomAbs_OffsetCurve && CType != GeomAbs_OtherCurve;
bool canElongateBis = BisType != GeomAbs_BezierCurve && BisType != GeomAbs_BSplineCurve
&& BisType != GeomAbs_OffsetCurve && BisType != GeomAbs_OtherCurve;
occ::handle<Geom2d_TrimmedCurve> TBis = occ::down_cast<Geom2d_TrimmedCurve>(Bis);
occ::handle<Geom2d_TrimmedCurve> TC2d = occ::down_cast<Geom2d_TrimmedCurve>(C2d);
@@ -271,15 +271,8 @@ bool BREP_UnfillSameDomain(const TopoDS_Shape& F1,
int samdom = 1;
st1 = SC.StateShapeShape(F1, F2, samdom);
st2 = SC.StateShapeShape(F2, F1, samdom);
if (((st1 == TopAbs_OUT) && (st2 == TopAbs_OUT))
|| ((st1 == TopAbs_UNKNOWN) && (st2 == TopAbs_UNKNOWN)))
{
unfill = true; // NYI IN IN aussi
}
else
{
unfill = false;
}
unfill = ((st1 == TopAbs_OUT) && (st2 == TopAbs_OUT))
|| ((st1 == TopAbs_UNKNOWN) && (st2 == TopAbs_UNKNOWN));
if (unfill)
{
TopOpeBRepDS_DataStructure& BDS = HDS->ChangeDS();
@@ -891,15 +884,8 @@ void TopOpeBRep_DSFiller::InsertIntersection2d(const TopoDS_Shape&
int samdom = 1;
st1 = myPShapeClassifier->StateShapeShape(lFF1, lFF2, samdom);
st2 = myPShapeClassifier->StateShapeShape(lFF2, lFF1, samdom);
if (((st1 == TopAbs_OUT) && (st2 == TopAbs_OUT))
|| ((st1 == TopAbs_UNKNOWN) && (st2 == TopAbs_UNKNOWN)))
{
unfill = true; // NYI IN IN aussi
}
else
{
unfill = false;
}
unfill = ((st1 == TopAbs_OUT) && (st2 == TopAbs_OUT))
|| ((st1 == TopAbs_UNKNOWN) && (st2 == TopAbs_UNKNOWN));
if (unfill)
{
TopOpeBRepDS_DataStructure& BDS2 = HDS->ChangeDS();
@@ -1015,9 +1001,7 @@ bool TopOpeBRep_DSFiller::IsContext1d(const TopoDS_Shape& aS) const
if (is1d)
std::cout << "TopOpeBRep_DSFiller : 1d" << std::endl;
#endif
if (!is1d)
return false;
return true;
return is1d;
}
//=================================================================================================
@@ -1071,14 +1055,7 @@ void TopOpeBRep_DSFiller::Insert1d(const TopoDS_Shape&
bool TopOpeBRep_DSFiller::CheckInsert(const TopoDS_Shape& aS1, const TopoDS_Shape& aS2) const
{
if (aS1.IsEqual(aS2))
{
#ifdef OCCT_DEBUG
std::cout << "TopOpeBRep_DSFiller : CheckInsert : S1 == S2" << std::endl;
#endif
return false;
}
return true;
return !aS1.IsEqual(aS2);
}
//=================================================================================================
@@ -565,7 +565,7 @@ void TopOpeBRep_EdgesIntersector::Perform(const TopoDS_Shape& E1,
}
// Modified by Sergey KHROMOV - Fri Jan 11 10:31:39 2002 End
}
} while (fin == false);
} while (!fin);
}
//-- End filter
@@ -61,10 +61,7 @@ extern bool GLOBAL_bvpr;
extern void debvprmess(int f1, int f2, int il, int vp, int si);
extern bool TopOpeBRep_GetcontextNOPUNK();
static void FUN_traceRLine(const TopOpeBRep_LineInter&)
{
//
}
static void FUN_traceRLine(const TopOpeBRep_LineInter&) {}
static void FUN_traceGLine(const TopOpeBRep_LineInter&) {}
#endif
@@ -190,9 +187,7 @@ static bool FUN_supponF(const TopOpeBRepDS_PDataStructure
lIsupponF.Append(I);
}
}
if (losupp.Extent() < 1)
return false;
return true;
return losupp.Extent() >= 1;
}
static bool FUN_IoflSsuppS(const TopOpeBRepDS_PDataStructure pDS,
@@ -230,14 +230,7 @@ bool TopOpeBRep_FacesFiller::KeepRLine(const TopOpeBRep_LineInter& L, const bool
else
bfl = bf && bl;
if (bfl)
{
out = false;
}
else
{
out = true;
}
out = !bfl;
}
else
{
@@ -1363,7 +1363,7 @@ void TopOpeBRep_FacesFiller::ProcessVPonR(const TopOpeBRep_VPointInter& VP,
TopOpeBRepTool_makeTransition MKT;
bool ok = MKT.Initialize(OOedge, OOpar1, OOpar2, OOparedge, Face, OOuv, factor);
if (ok && !(interf2d && !MKT.IsT2d()))
if (ok && (!interf2d || MKT.IsT2d()))
{
MKT.SetRest(edge, paredge);
TopAbs_State stb, sta;
@@ -204,7 +204,7 @@ bool TopOpeBRepBuild_BlockBuilder::ElementIsValid(const TopOpeBRepBuild_BlockIte
int Sindex = BI.Value();
int isb = myOrientedShapeMapIsValid.Find(Sindex);
bool isvalid = (isb == 1) ? true : false;
bool isvalid = isb == 1;
return isvalid;
}
@@ -216,7 +216,7 @@ bool TopOpeBRepBuild_BlockBuilder::ElementIsValid(const int Sindex) const
return false;
int isb = myOrientedShapeMapIsValid.Find(Sindex);
bool isvalid = (isb == 1) ? true : false;
bool isvalid = isb == 1;
return isvalid;
}
@@ -219,7 +219,7 @@ void TopOpeBRepBuild_Builder1::GFillSolidSFS(const TopoDS_Shape&
{
// shell SH is not in DS : Get its state (to the LS02) from map and define to keep or not
TopAbs_State shSt = myDataStructure->DS().GetShapeWithState(SH).State();
bool keep = (shSt == TB1) ? true : false;
bool keep = shSt == TB1;
if (keep)
{
TopAbs_Orientation oriSH = SH.Orientation();
@@ -267,7 +267,7 @@ void TopOpeBRepBuild_Builder1::GFillShellSFS(const TopoDS_Shape&
{
// DS doesn't contain FACE , get its state and define to keep or not
TopAbs_State shSt = myDataStructure->DS().GetShapeWithState(FOR).State();
bool keep = (shSt == TB1) ? true : false;
bool keep = shSt == TB1;
if (keep)
{
TopAbs_Orientation oriF = FOR.Orientation();
@@ -390,7 +390,7 @@ void TopOpeBRepBuild_Builder1::GFillFaceNotSameDomWES(const TopoDS_Shape&
{
// wire W is not in DS : get its state and define to keep or not
TopAbs_State shSt = myDataStructure->DS().GetShapeWithState(W).State();
bool keep = (shSt == TB1) ? true : false;
bool keep = shSt == TB1;
if (keep || (myProcessON && shSt == TopAbs_ON))
{
TopAbs_Orientation oriW = W.Orientation();
@@ -434,7 +434,7 @@ void TopOpeBRepBuild_Builder1::GFillWireNotSameDomWES(const TopoDS_Shape&
{
// edge EOR is not in DS : get its state and define to keep or not
TopAbs_State shSt = myDataStructure->DS().GetShapeWithState(EOR).State();
bool keep = (shSt == TB1) ? true : false;
bool keep = shSt == TB1;
if (keep || (myProcessON && shSt == TopAbs_ON))
{
TopAbs_Orientation oriE = EOR.Orientation();
@@ -554,7 +554,7 @@ void TopOpeBRepBuild_Builder1::GFillFaceSameDomSFS(const TopoDS_Shape&
NCollection_List<TopoDS_Shape>& LOFS = ChangeSplit(FF, TB1);
// orientate new faces by the right way
bool OrigRev = (FOR.Orientation() == TopAbs_FORWARD ? false : true);
bool OrigRev = (FOR.Orientation() != TopAbs_FORWARD);
NCollection_List<TopoDS_Shape>::Iterator LOFit(LOF);
for (; LOFit.More(); LOFit.Next())
{
@@ -658,7 +658,7 @@ void TopOpeBRepBuild_Builder1::GFillFaceSameDomWES(
if (!hasshape && (shSt != TopAbs_ON))
{
// wire W is not in DS : get its state and define to keep or not
bool keep = (shSt == TB) ? true : false;
bool keep = shSt == TB;
if (keep)
{
TopAbs_Orientation oriW = W.Orientation();
@@ -750,7 +750,7 @@ void TopOpeBRepBuild_Builder1::GFillWireSameDomWES(const TopoDS_Shape&
{
// edge EOR is not in DS : get its state and define to keep or not
TopAbs_State shSt = myDataStructure->DS().GetShapeWithState(EOR).State();
bool keep = (shSt == TB) ? true : false;
bool keep = shSt == TB;
if (keep)
{
TopAbs_Orientation oriE = EOR.Orientation();
@@ -1034,7 +1034,7 @@ void TopOpeBRepBuild_Builder1::GFillEdgeSameDomWES(const TopoDS_Shape&
TopAbs_State aPartState = (scalarPr > 0) ? TopAbs_IN : TopAbs_OUT;
keep = (aPartState == TB) ? true : false;
keep = aPartState == TB;
}
else
{ // if aAdjFace.IsNull() - it must not happen
@@ -1185,7 +1185,7 @@ void TopOpeBRepBuild_Builder1::PerformONParts(
TopAbs_State aState = TopAbs_UNKNOWN;
aState = ClassifyEdgeToFaceByOnePoint(TopoDS::Edge(newE), TopoDS::Face(FOR1));
if (!(aState == TopAbs_IN || aState == TopAbs_ON))
if (aState != TopAbs_IN && aState != TopAbs_ON)
continue;
bool keep = false;
@@ -1244,7 +1244,7 @@ void TopOpeBRepBuild_Builder1::PerformONParts(
continue;
}
TopAbs_State aPartState = (scalarPr > 0) ? TopAbs_IN : TopAbs_OUT;
keep = (aPartState == ETB) ? true : false;
keep = aPartState == ETB;
if (keep)
break;
}
@@ -1408,7 +1408,7 @@ void TopOpeBRepBuild_Builder1::PerformPieceIn2D(const TopoDS_Edge& Edg
}
TopAbs_State aPartState = (scalarPr > 0) ? TopAbs_IN : TopAbs_OUT;
keep = (aPartState == TB) ? true : false;
keep = aPartState == TB;
if (keep)
break;
}
@@ -2063,7 +2063,7 @@ int TopOpeBRepBuild_Builder1::IsSame2d(const NCollection_Sequence<TopoDS_Shape>&
gp_Vec2d aOVec(aOFuv, aOLuv);
if (anEObj.Orientation() == TopAbs_REVERSED)
aOVec.Reverse();
IsTrFirst = (aTrVec * aOVec > 0) ? false : true;
IsTrFirst = aTrVec * aOVec <= 0;
BRep_Builder BB;
double tolE = BRep_Tool::Tolerance(aPTool);
@@ -233,10 +233,7 @@ bool TopOpeBRepBuild_BuilderON::GFillONCheckI(const occ::handle<TopOpeBRepDS_Int
#endif
int rankFS = myPB->GShapeRank(FS);
int rankFOR = myPB->GShapeRank(myFace);
if (rankFS == 0 || rankFOR == 0)
return false;
return true;
return rankFS != 0 && rankFOR != 0;
} // GFillONCheckI
//=================================================================================================
@@ -1737,8 +1734,8 @@ void TopOpeBRepBuild_BuilderON::GFillONPartsWES2(const occ::handle<TopOpeBRepDS_
if (FCXisref && !EGBoundFOR)
{
FUN_tool_orientEinFFORWARD(EG, FCX, neworiE);
bool rev = myPB->Reverse(staFCX, staFOR);
neworiE = myPB->Orient(neworiE, rev);
bool rev = TopOpeBRepBuild_Builder::Reverse(staFCX, staFOR);
neworiE = TopOpeBRepBuild_Builder::Orient(neworiE, rev);
}
// xpu280798 : never occurs as yap1 -> !EGBoundFOR
// else if (FORisref && EGBoundFOR) {
@@ -1753,8 +1750,8 @@ void TopOpeBRepBuild_BuilderON::GFillONPartsWES2(const occ::handle<TopOpeBRepDS_
bool reverse = (M_FORWARD(neworiE) || M_REVERSED(neworiE)) && (!eONsoEsd);
if (reverse)
neworiE = TopAbs::Complement(neworiE);
bool rev = myPB->Reverse(staFOR, staFCX);
neworiE = myPB->Orient(neworiE, rev);
bool rev = TopOpeBRepBuild_Builder::Reverse(staFOR, staFCX);
neworiE = TopOpeBRepBuild_Builder::Orient(neworiE, rev);
}
else if (!EGBoundFOR)
{ // xpu210898
@@ -1769,8 +1766,8 @@ void TopOpeBRepBuild_BuilderON::GFillONPartsWES2(const occ::handle<TopOpeBRepDS_
if (reverse)
neworiE = TopAbs::Complement(neworiE);
}
bool rev = myPB->Reverse(staFOR, staFCX);
neworiE = myPB->Orient(neworiE, rev);
bool rev = TopOpeBRepBuild_Builder::Reverse(staFOR, staFCX);
neworiE = TopOpeBRepBuild_Builder::Orient(neworiE, rev);
}
TopoDS_Shape newE = EspON;
@@ -2296,8 +2293,8 @@ void TopOpeBRepBuild_BuilderON::GFillONPartsWES2(const occ::handle<TopOpeBRepDS_
if (FCXisref && !EGBoundFOR)
{
FUN_tool_orientEinFFORWARD(EG, FCX, neworiE);
bool rev = myPB->Reverse(staFCX, staFOR);
neworiE = myPB->Orient(neworiE, rev);
bool rev = TopOpeBRepBuild_Builder::Reverse(staFCX, staFOR);
neworiE = TopOpeBRepBuild_Builder::Orient(neworiE, rev);
}
else if (FORisref && !EGBoundFOR)
{
@@ -2308,8 +2305,8 @@ void TopOpeBRepBuild_BuilderON::GFillONPartsWES2(const occ::handle<TopOpeBRepDS_
bool reverse = (M_FORWARD(neworiE) || M_REVERSED(neworiE)) && (!eONsoEsd);
if (reverse)
neworiE = TopAbs::Complement(neworiE);
bool rev = myPB->Reverse(staFOR, staFCX);
neworiE = myPB->Orient(neworiE, rev);
bool rev = TopOpeBRepBuild_Builder::Reverse(staFOR, staFCX);
neworiE = TopOpeBRepBuild_Builder::Orient(neworiE, rev);
}
else if (!EGBoundFOR)
{
@@ -2325,8 +2322,8 @@ void TopOpeBRepBuild_BuilderON::GFillONPartsWES2(const occ::handle<TopOpeBRepDS_
if (reverse)
neworiE = TopAbs::Complement(neworiE);
}
bool rev = myPB->Reverse(staFOR, staFCX);
neworiE = myPB->Orient(neworiE, rev);
bool rev = TopOpeBRepBuild_Builder::Reverse(staFOR, staFCX);
neworiE = TopOpeBRepBuild_Builder::Orient(neworiE, rev);
}
TopoDS_Shape newE = EspON;
@@ -464,19 +464,19 @@ int TopOpeBRepBuild_CorrectFace2d::ConnectWire(
bool UP = BAS.IsUPeriodic();
bool VP = BAS.IsVPeriodic();
bool nonPU = (fabs(U) < 1e-7) ? true : false;
bool nonPV = (fabs(V) < 1e-7) ? true : false;
bool nonPU = fabs(U) < 1e-7;
bool nonPV = fabs(V) < 1e-7;
if (!nonPU && UP)
{
double dU = fmod(fabs(U), 2 * M_PI);
nonPU = (dU > 1e-7 && (2 * M_PI - dU > 1e-7)) ? true : false;
nonPU = dU > 1e-7 && (2 * M_PI - dU > 1e-7);
}
if (!nonPV && VP)
{
double dV = fmod(fabs(V), 2 * M_PI);
nonPV = (dV > 1e-7 && (2 * M_PI - dV > 1e-7)) ? true : false;
nonPV = dV > 1e-7 && (2 * M_PI - dV > 1e-7);
}
// printf("(fmod(fabs(U), 2*M_PI) =%lf\n", (fmod(fabs(U), 2*M_PI)));
@@ -1249,38 +1249,24 @@ bool SameSupport(const TopoDS_Edge& E1, const TopoDS_Edge& E2)
gp_Lin li1(occ::down_cast<Geom_Line>(C1)->Lin());
gp_Lin li2(occ::down_cast<Geom_Line>(C2)->Lin());
if (std::abs(li1.Angle(li2)) <= tolang
&& li1.Location().SquareDistance(li2.Location()) <= tollin * tollin)
{
return true;
}
return false;
return std::abs(li1.Angle(li2)) <= tolang
&& li1.Location().SquareDistance(li2.Location()) <= tollin * tollin;
}
else if (typC1 == STANDARD_TYPE(Geom_Circle))
{
gp_Circ ci1 = occ::down_cast<Geom_Circle>(C1)->Circ();
gp_Circ ci2 = occ::down_cast<Geom_Circle>(C2)->Circ();
if (std::abs(ci1.Radius() - ci2.Radius()) <= tollin
&& ci1.Location().SquareDistance(ci2.Location()) <= tollin * tollin)
{
// Point debut, calage dans periode, et detection meme sens
return true;
}
return false;
return std::abs(ci1.Radius() - ci2.Radius()) <= tollin
&& ci1.Location().SquareDistance(ci2.Location()) <= tollin * tollin;
}
else if (typC1 == STANDARD_TYPE(Geom_Ellipse))
{
gp_Elips ci1 = occ::down_cast<Geom_Ellipse>(C1)->Elips();
gp_Elips ci2 = occ::down_cast<Geom_Ellipse>(C2)->Elips();
if (std::abs(ci1.MajorRadius() - ci2.MajorRadius()) <= tollin
&& std::abs(ci1.MinorRadius() - ci2.MinorRadius()) <= tollin
&& ci1.Location().SquareDistance(ci2.Location()) <= tollin * tollin)
{
// Point debut, calage dans periode, et detection meme sens
return true;
}
return false;
return std::abs(ci1.MajorRadius() - ci2.MajorRadius()) <= tollin
&& std::abs(ci1.MinorRadius() - ci2.MinorRadius()) <= tollin
&& ci1.Location().SquareDistance(ci2.Location()) <= tollin * tollin;
}
else if (typC1 == STANDARD_TYPE(Geom_BSplineCurve))
{
@@ -748,14 +748,14 @@ Standard_EXPORT void FUNBUILD_ORIENTLOFS(TopOpeBRepBuild_Builder& B,
bool of1, of2;
FUNBUILD_ANCESTORRANKGET(B, f, of1, of2);
TopAbs_Orientation orif = f.Orientation();
bool r12 = B.Reverse(TB1, TB2);
bool r21 = B.Reverse(TB2, TB1);
bool r12 = TopOpeBRepBuild_Builder::Reverse(TB1, TB2);
bool r21 = TopOpeBRepBuild_Builder::Reverse(TB2, TB1);
bool rf = false;
if (of1 && !of2)
rf = r12;
else if (of2 && !of1)
rf = r21;
TopAbs_Orientation neworif = B.Orient(orif, rf);
TopAbs_Orientation neworif = TopOpeBRepBuild_Builder::Orient(orif, rf);
f.Orientation(neworif);
}
}
@@ -2124,9 +2124,7 @@ bool TopOpeBRepBuild_Builder::KPiskoleFF(const TopoDS_Shape& F1,
if (!st2ok)
return false;
bool stok = (St1 != St2);
if (!stok)
return false;
return true;
return stok;
}
//=======================================================================
@@ -131,7 +131,7 @@ static bool FUN_islook(const TopoDS_Edge& e)
gp_Pnt p1 = BRep_Tool::Pnt(v1);
gp_Pnt p2 = BRep_Tool::Pnt(v2);
double dp1p2 = p1.Distance(p2);
bool islook = (std::abs(dp1p2) > 1.e-8) ? true : false;
bool islook = std::abs(dp1p2) > 1.e-8;
return islook;
}
@@ -249,7 +249,7 @@ void TopOpeBRepBuild_PaveSet::Prepare()
}
// ofv:
// addVE = false;
addVE = (!add) ? false : true;
addVE = add;
break;
}
}
@@ -206,10 +206,7 @@ static bool FUN_EstaEE(const TopoDS_Edge& E, const TopAbs_State sta, const TopoD
if (BRep_Tool::Degenerated(E))
{
if (sta == TopAbs_IN)
return false;
else
return true;
return sta != TopAbs_IN;
}
// modified by NIZNHY-PKV Wed Nov 3 11:40:19 1999 to
@@ -346,14 +346,7 @@ bool TopOpeBRepBuild_ShapeSet::CheckShape(const TopoDS_Shape& S, const bool chec
BRepCheck_Analyzer ana(S, checkgeom);
bool val = ana.IsValid();
if (val)
{
return true;
}
else
{
return false;
}
return val;
}
//=================================================================================================
@@ -752,7 +752,7 @@ void TopOpeBRepBuild_Tools::UpdateEdgeOnPeriodicalFace(const TopoDS_Edge& aEdgeT
gp_Vec2d aux(gp_Pnt2d(0., 0.), gp_Pnt2d(1., 1.));
double scalar = aux * aTrV;
bool dir = (scalar >= 0.) ? true : false;
bool dir = scalar >= 0.;
// compute right order of pcurves
gp_Vec2d aYVec(gp_Pnt2d(0., 0.), gp_Pnt2d(0., 1.));
@@ -767,10 +767,10 @@ void TopOpeBRepBuild_Tools::UpdateEdgeOnPeriodicalFace(const TopoDS_Edge& aEdgeT
{ // compute along X axe
gp_Vec2d aXVec(gp_Pnt2d(0., 0.), gp_Pnt2d(1., 0.));
scalar = aXVec * C2DVec;
firstOrder = (scalar >= 0.) ? true : false;
firstOrder = scalar >= 0.;
}
else
firstOrder = (scalar > 0.) ? false : true;
firstOrder = scalar <= 0.;
occ::handle<Geom2d_Curve> aTrC = occ::down_cast<Geom2d_Curve>(C2D->Copy());
aTrC->Translate(aTrV);
@@ -802,10 +802,7 @@ bool TopOpeBRepBuild_Tools::IsDegEdgesTheSame(const TopoDS_Shape& anE1, const To
if (!aVMap1.Extent() || !aVMap2.Extent())
return false;
if (aVMap1(1).IsSame(aVMap2(1)))
return true;
else
return false;
return aVMap1(1).IsSame(aVMap2(1));
}
//=======================================================================
@@ -421,10 +421,7 @@ bool TopOpeBRepBuild_WireEdgeSet::IsClosed(const TopoDS_Shape& E) const
const TopoDS_Edge& EE = TopoDS::Edge(E);
bool closed = BRep_Tool::IsClosed(EE, myFace);
if (closed)
return true;
return false;
return closed;
}
//=================================================================================================
@@ -645,9 +645,9 @@ void TopOpeBRepDS_BuildTool::ComputePCurves(const TopOpeBRepDS_Curve& C,
double tolreached2d1 = Precision::Confusion(), tolreached2d2 = Precision::Confusion(),
tol = Precision::Confusion();
if (comppc1)
PC1new = myCurveTool.MakePCurveOnFace(F1, C3D, tolreached2d1);
PC1new = TopOpeBRepTool_CurveTool::MakePCurveOnFace(F1, C3D, tolreached2d1);
if (comppc2)
PC2new = myCurveTool.MakePCurveOnFace(F2, C3D, tolreached2d2);
PC2new = TopOpeBRepTool_CurveTool::MakePCurveOnFace(F2, C3D, tolreached2d2);
double r1 = TopOpeBRepTool_ShapeTool::Resolution3d(F1, tolreached2d1);
double r2 = TopOpeBRepTool_ShapeTool::Resolution3d(F2, tolreached2d2);
@@ -692,9 +692,9 @@ void TopOpeBRepDS_BuildTool::ComputePCurves(const TopOpeBRepDS_Curve& C,
double tolreached2d2 = C.Tolerance();
if (comppc1)
PC1new = myCurveTool.MakePCurveOnFace(F1, C3Dnew, tolreached2d1);
PC1new = TopOpeBRepTool_CurveTool::MakePCurveOnFace(F1, C3Dnew, tolreached2d1);
if (comppc2)
PC2new = myCurveTool.MakePCurveOnFace(F2, C3Dnew, tolreached2d2);
PC2new = TopOpeBRepTool_CurveTool::MakePCurveOnFace(F2, C3Dnew, tolreached2d2);
double newtol, newparmin, newparmax;
UpdateEdgeCurveTol(F1,
@@ -349,9 +349,7 @@ Standard_EXPORT bool FDS_EdgeIsConnexToSameDomainFaces(
if (samdom)
break;
}
if (samdom)
return true;
return false;
return samdom;
} // not used
// T si ShapeIndex SI est la GeometrieIndex d'une Interference
@@ -129,9 +129,7 @@ static bool FUN_keepIonF(const gp_Vec& tgref,
if (!ok)
return false;
prod = std::abs((tgref ^ tgE).Dot(ngF));
if (std::abs(1 - prod) < tola)
return false;
return true;
return std::abs(1 - prod) >= tola;
}
// ----------------------------------------------------------------------
@@ -36,7 +36,7 @@ void TopOpeBRepDS_Marker::Reset()
void TopOpeBRepDS_Marker::Set(const int ie, const bool b)
{
Allocate(ie);
if (!(ie >= 1 && ie <= myne))
if (ie < 1 || ie > myne)
return;
myhe->SetValue(ie, b);
}
@@ -57,7 +57,7 @@ bool TopOpeBRepDS_Marker::GetI(const int ie) const
{
if (myhe.IsNull())
return false;
if (!(ie >= 1 && ie <= myne))
if (ie < 1 || ie > myne)
return false;
return myhe->Value(ie);
}
@@ -71,9 +71,9 @@ static bool FUN_keepEinterference
const TopOpeBRepDS_Transition& T = I->Transition();
TopAbs_ShapeEnum shab = T.ShapeBefore(), shaa = T.ShapeAfter();
TopAbs_State stab = T.Before(), staa = T.After();
bool k2 = !(((shab == TopAbs_EDGE) && (stab == TopAbs_ON))
|| ((shaa == TopAbs_EDGE) && (staa == TopAbs_ON)));
res = res && k2;
bool k2 = ((shab != TopAbs_EDGE) || (stab != TopAbs_ON))
&& ((shaa != TopAbs_EDGE) || (staa != TopAbs_ON));
res = res && k2;
const TopoDS_Shape& VG = DS.Shape(I->Geometry());
@@ -325,10 +325,7 @@ Standard_EXPORT bool FUN_interfhassupport
bool h = true;
const int index = I->Support();
const TopoDS_Shape& SofI = DS.Shape(index);
if (SofI.IsSame(S))
h = true;
else
h = false;
h = SofI.IsSame(S);
return h;
}
@@ -39,12 +39,8 @@ TopOpeBRepDS_Surface::TopOpeBRepDS_Surface(const occ::handle<Geom_Surface>& theS
//=================================================================================================
TopOpeBRepDS_Surface::TopOpeBRepDS_Surface(const TopOpeBRepDS_Surface& theOther)
: mySurface(theOther.mySurface),
myTolerance(theOther.myTolerance),
myKeep(theOther.myKeep)
{
//
}
= default;
//=================================================================================================
@@ -1038,8 +1038,8 @@ occ::handle<Geom2d_Curve> TopOpeBRepTool_CurveTool::MakePCurveOnFace(
if (BAHS->IsUPeriodic())
{
// modified by NIZHNY-MZV Thu Mar 30 10:03:15 2000
bool mincond = (UMin - u2 > 1e-7) ? true : false;
bool maxcond = (u2 - UMax > 1e-7) ? true : false;
bool mincond = UMin - u2 > 1e-7;
bool maxcond = u2 - UMax > 1e-7;
bool decalu = mincond || maxcond;
if (decalu)
du = (mincond) ? BAHS->UPeriod() : -BAHS->UPeriod();
@@ -1050,8 +1050,8 @@ occ::handle<Geom2d_Curve> TopOpeBRepTool_CurveTool::MakePCurveOnFace(
if (BAHS->IsVPeriodic())
{
// modified by NIZHNY-MZV Thu Mar 30 10:06:24 2000
bool mincond = (VMin - v2 > 1e-7) ? true : false;
bool maxcond = (v2 - VMax > 1e-7) ? true : false;
bool mincond = VMin - v2 > 1e-7;
bool maxcond = v2 - VMax > 1e-7;
bool decalv = mincond || maxcond;
if (decalv)
dv = (mincond) ? BAHS->VPeriod() : -BAHS->VPeriod();
@@ -697,10 +697,7 @@ bool TopOpeBRepTool_FuseEdges::SameSupport(const TopoDS_Edge& E1, const TopoDS_E
gp_Pnt pl1 = BRep_Tool::Pnt(TopExp::LastVertex(E1, true));
gp_Pnt pf2 = BRep_Tool::Pnt(TopExp::FirstVertex(E2, true));
gp_Pnt pl2 = BRep_Tool::Pnt(TopExp::LastVertex(E2, true));
if (pl1.Distance(pf2) < tollin && pl2.Distance(pf1) < tollin)
return false;
else
return true;
return pl1.Distance(pf2) >= tollin || pl2.Distance(pf1) >= tollin;
}
return false;
}
@@ -708,29 +705,19 @@ bool TopOpeBRepTool_FuseEdges::SameSupport(const TopoDS_Edge& E1, const TopoDS_E
{
gp_Circ ci1 = occ::down_cast<Geom_Circle>(C1)->Circ();
gp_Circ ci2 = occ::down_cast<Geom_Circle>(C2)->Circ();
if (std::abs(ci1.Radius() - ci2.Radius()) <= tollin
&& ci1.Location().SquareDistance(ci2.Location()) <= tollin * tollin
&& ci1.Axis().IsParallel(ci2.Axis(), tolang))
{
// Point debut, calage dans periode, et detection meme sens
return true;
}
return false;
return std::abs(ci1.Radius() - ci2.Radius()) <= tollin
&& ci1.Location().SquareDistance(ci2.Location()) <= tollin * tollin
&& ci1.Axis().IsParallel(ci2.Axis(), tolang);
}
else if (typC1 == STANDARD_TYPE(Geom_Ellipse))
{
gp_Elips ci1 = occ::down_cast<Geom_Ellipse>(C1)->Elips();
gp_Elips ci2 = occ::down_cast<Geom_Ellipse>(C2)->Elips();
if (std::abs(ci1.MajorRadius() - ci2.MajorRadius()) <= tollin
&& std::abs(ci1.MinorRadius() - ci2.MinorRadius()) <= tollin
&& ci1.Location().SquareDistance(ci2.Location()) <= tollin * tollin
&& ci1.Axis().IsParallel(ci2.Axis(), tolang))
{
// Point debut, calage dans periode, et detection meme sens
return true;
}
return false;
return std::abs(ci1.MajorRadius() - ci2.MajorRadius()) <= tollin
&& std::abs(ci1.MinorRadius() - ci2.MinorRadius()) <= tollin
&& ci1.Location().SquareDistance(ci2.Location()) <= tollin * tollin
&& ci1.Axis().IsParallel(ci2.Axis(), tolang);
}
else if (typC1 == STANDARD_TYPE(Geom_BSplineCurve))
{
@@ -251,10 +251,7 @@ Standard_EXPORT bool FUN_tool_line(const occ::handle<Geom2d_Curve>& pc)
Geom2dAdaptor_Curve GC2d(pcb);
GeomAbs_CurveType typ = GC2d.GetType();
if (typ == GeomAbs_Line)
return true;
return false;
return typ == GeomAbs_Line;
}
// ----------------------------------------------------------------------
@@ -285,7 +285,7 @@ bool TopOpeBRepTool::PurgeClosingEdges(
bool vclosed = CORRISO.Refclosed(2, vperiod);
if (!uclosed && !vclosed)
return false;
bool inU = uclosed ? true : false;
bool inU = uclosed;
double xmin = inU ? (CORRISO.GASref().FirstUParameter()) : (CORRISO.GASref().FirstVParameter());
double xper = inU ? uperiod : vperiod;
double tolx = inU ? (CORRISO.Tol(1, tolF)) : (CORRISO.Tol(2, tolF));
@@ -725,7 +725,7 @@ bool TopOpeBRepTool::CorrectONUVISO(const TopoDS_Face& Fin, TopoDS_Face& Fsp)
int i;
for (i = 1; i <= 2; i++)
{
bool onU = (i == 1) ? true : false;
bool onU = i == 1;
const NCollection_List<TopoDS_Shape>& Tocheck = CORRISO.Eds();
NCollection_DataMap<TopoDS_Shape, int> fyEds;
ok = ::FUN_connexX(onU, CORRISO, Tocheck, fyEds);
@@ -738,9 +738,7 @@ bool TopOpeBRepTool::CorrectONUVISO(const TopoDS_Face& Fin, TopoDS_Face& Fsp)
if (!ok)
continue;
ok = CORRISO.GetnewS(Fsp);
if (!ok)
return false; // NYIRAISE
return true;
return ok;
}
// 2. x-2drep(edges) are in [xfirst,xfirst+xperiod]
@@ -764,9 +762,7 @@ bool TopOpeBRepTool::CorrectONUVISO(const TopoDS_Face& Fin, TopoDS_Face& Fsp)
if (!ok)
continue;
ok = CORRISO.GetnewS(Fsp);
if (!ok)
return false; // NYIRAISE
return true;
return ok;
}
return false;
@@ -252,15 +252,7 @@ bool TopOpeBRepTool_REGUS::WireToFace(const TopoDS_Face& Fanc
}
bool facesbuilt = TopOpeBRepTool_TOOL::WireToFace(Fanc, mapWlow, nFs);
if (!facesbuilt)
{
#ifdef OCCT_DEBUG
if (trc)
std::cout << "** facesbuilt fails" << std::endl;
#endif
return false;
}
return true;
return facesbuilt;
}
//=================================================================================================
@@ -827,9 +819,7 @@ static bool FUN_vectors(const TopoDS_Face& f,
nt.Reverse();
// <xx> :
bool ok = FUN_tool_getxx(f, e, pare, xx);
if (!ok)
return false;
return true;
return ok;
}
//=================================================================================================
@@ -1179,26 +1179,7 @@ bool TopOpeBRepTool_REGUW::RemoveOldConnexity(const TopoDS_Vertex& v,
TopOpeBRepTool_connexity& co = mymapvEds.ChangeFromKey(v);
ok = co.RemoveItem(OriKey, e);
if (!ok)
return false;
#ifdef OCCT_DEBUG
bool trc = TopOpeBRepTool_GettraceREGUFA();
if (trc)
{
std::cout << "** removing old connexity : v" << FUN_adds(v) << " for e" << FUN_adds(e);
FUN_tool_tori(e.Orientation());
TopoDS_Vertex vclo;
bool cloE = TopOpeBRepTool_TOOL::ClosedE(e, vclo);
if (cloE)
std::cout << " closed";
bool dgE = BRep_Tool::Degenerated(e);
if (dgE)
std::cout << " degenerated";
std::cout << std::endl;
}
#endif
return true;
return ok;
}
//=================================================================================================
@@ -660,9 +660,7 @@ Standard_EXPORT bool FUN_tool_ClassifW(
{
const NCollection_List<TopoDS_Shape>& low = itm.Value();
bool ok = CLASSI.Classilist(low, mapWlow);
if (!ok)
return false;
return true;
return ok;
}
// noldW > 1
@@ -855,7 +853,5 @@ bool TopOpeBRepTool::RegularizeFace(
// <aListOfFaces>
// -------------
bool facesbuilt = TopOpeBRepTool_TOOL::WireToFace(theFace, mapWlow, newFaces);
if (!facesbuilt)
return false;
return true;
return facesbuilt;
}
@@ -243,10 +243,7 @@ bool TopOpeBRepTool_ShapeTool::Closed(const TopoDS_Shape& S1, const TopoDS_Shape
for (TopExp_Explorer x(F, TopAbs_EDGE); x.More(); x.Next())
if (x.Current().IsSame(E))
n++;
if (n < 2)
return false;
else
return true;
return n >= 2;
}
return false;
}
@@ -849,9 +849,7 @@ bool TopOpeBRepTool_TOOL::CurvE(const TopoDS_Edge& E,
{
gp_Dir dir = BAC.Line().Direction();
double dot = dir.Dot(tg0);
if (std::abs(1 - dot) < tola)
return false;
return true;
return std::abs(1 - dot) >= tola;
}
BRepLProp_CLProps clprops(BAC, par, 2, Precision::Confusion());
@@ -616,9 +616,7 @@ bool TopOpeBRepTool_makeTransition::MkT3dproj(TopAbs_State& Stb, TopAbs_State& S
if (!okb)
return false;
bool oka = FUN_staproj(myE, mypb, mypa, mypE, myfactor, AFTER, myFS, Sta);
if (!oka)
return false;
return true;
return oka;
}
//=======================================================================
@@ -58,25 +58,11 @@ Standard_EXPORT void FTOL_FaceTolerances(const Bnd_Box& B1,
double x0, y0, z0, x1, y1, z1, dx, dy, dz;
bool Box1OK, Box2OK;
if (!B1.IsOpenXmin() && !B1.IsOpenXmax() && !B1.IsOpenYmin() && !B1.IsOpenYmax()
&& !B1.IsOpenZmin() && !B1.IsOpenZmax() && !B1.IsVoid())
{
Box1OK = true;
}
else
{
Box1OK = false;
}
Box1OK = !B1.IsOpenXmin() && !B1.IsOpenXmax() && !B1.IsOpenYmin() && !B1.IsOpenYmax()
&& !B1.IsOpenZmin() && !B1.IsOpenZmax() && !B1.IsVoid();
if (!B2.IsOpenXmin() && !B2.IsOpenXmax() && !B2.IsOpenYmin() && !B2.IsOpenYmax()
&& !B2.IsOpenZmin() && !B2.IsOpenZmax() && !B2.IsVoid())
{
Box2OK = true;
}
else
{
Box2OK = false;
}
Box2OK = !B2.IsOpenXmin() && !B2.IsOpenXmax() && !B2.IsOpenYmin() && !B2.IsOpenYmax()
&& !B2.IsOpenZmin() && !B2.IsOpenZmax() && !B2.IsVoid();
if (Box1OK)
{
@@ -67,11 +67,7 @@ bool Expr_ArcCosine::IsIdentical(const occ::handle<Expr_GeneralExpression>& Othe
bool Expr_ArcCosine::IsLinear() const
{
if (ContainsUnknowns())
{
return false;
}
return true;
return !ContainsUnknowns();
}
occ::handle<Expr_GeneralExpression> Expr_ArcCosine::Derivative(
@@ -65,11 +65,7 @@ bool Expr_ArcSine::IsIdentical(const occ::handle<Expr_GeneralExpression>& Other)
bool Expr_ArcSine::IsLinear() const
{
if (ContainsUnknowns())
{
return false;
}
return true;
return !ContainsUnknowns();
}
occ::handle<Expr_GeneralExpression> Expr_ArcSine::Derivative(
@@ -65,11 +65,7 @@ bool Expr_ArcTangent::IsIdentical(const occ::handle<Expr_GeneralExpression>& Oth
bool Expr_ArcTangent::IsLinear() const
{
if (ContainsUnknowns())
{
return false;
}
return true;
return !ContainsUnknowns();
}
occ::handle<Expr_GeneralExpression> Expr_ArcTangent::Derivative(
@@ -65,11 +65,7 @@ bool Expr_ArgCosh::IsIdentical(const occ::handle<Expr_GeneralExpression>& Other)
bool Expr_ArgCosh::IsLinear() const
{
if (ContainsUnknowns())
{
return false;
}
return true;
return !ContainsUnknowns();
}
occ::handle<Expr_GeneralExpression> Expr_ArgCosh::Derivative(
@@ -66,11 +66,7 @@ bool Expr_ArgSinh::IsIdentical(const occ::handle<Expr_GeneralExpression>& Other)
bool Expr_ArgSinh::IsLinear() const
{
if (ContainsUnknowns())
{
return false;
}
return true;
return !ContainsUnknowns();
}
occ::handle<Expr_GeneralExpression> Expr_ArgSinh::Derivative(
@@ -64,11 +64,7 @@ bool Expr_ArgTanh::IsIdentical(const occ::handle<Expr_GeneralExpression>& Other)
bool Expr_ArgTanh::IsLinear() const
{
if (ContainsUnknowns())
{
return false;
}
return true;
return !ContainsUnknowns();
}
occ::handle<Expr_GeneralExpression> Expr_ArgTanh::Derivative(
@@ -111,11 +111,7 @@ bool Expr_NamedFunction::IsIdentical(const occ::handle<Expr_GeneralFunction>& fu
return false;
}
}
if (!Expression()->IsIdentical(occ::down_cast<Expr_NamedFunction>(func)->Expression()))
{
return false;
}
return true;
return Expression()->IsIdentical(occ::down_cast<Expr_NamedFunction>(func)->Expression());
}
bool Expr_NamedFunction::IsLinearOnVariable(const int) const
@@ -212,7 +212,7 @@ void BRepFeat_Form::GlobalPerform()
if (!scur(jj)->IsPeriodic())
{
int ku, kf;
if (!(mu > Mf || mf > Mu))
if (mu <= Mf && mf <= Mu)
{ // overlapping intervals
sens = 1;
kf = 1;
@@ -778,7 +778,7 @@ void BRepFeat_Form::GlobalPerform()
//
//--- generation of "just feature" for assembly = Parts of tool
bool bFlag = (myPerfSelection == BRepFeat_NoSelection) ? false : true;
bool bFlag = myPerfSelection != BRepFeat_NoSelection;
BRepFeat_Builder theBuilder;
theBuilder.Init(mySbase, theGShape);
theBuilder.SetOperation(myFuse, bFlag);
@@ -1116,7 +1116,7 @@ void BRepFeat_Form::GlobalPerform()
{
BRepFeat::ParametricMinMax(it.Value(), C, prmin1, prmax1, prbmin1, prbmax1, flag2);
}
if (flag2 == false || flag1 == false)
if (!flag2 || !flag1)
{
pmin = pbmin;
pmax = pbmax;
@@ -1130,7 +1130,7 @@ void BRepFeat_Form::GlobalPerform()
min = prmin1;
max = prmax1;
}
if (!((min > pmax - delta) || (max < pmin + delta)))
if ((min <= pmax - delta) && (max >= pmin + delta))
{
KeepParts = true;
const TopoDS_Shape& S = it.Value();
@@ -1161,7 +1161,7 @@ void BRepFeat_Form::GlobalPerform()
for (it.Initialize(lshape); it.More(); it.Next())
{
BRepFeat::ParametricMinMax(it.Value(), C, prmin1, prmax1, prbmin1, prbmax1, flag2);
if (flag2 == false || flag1 == false)
if (!flag2 || !flag1)
{
pmin = pbmin;
pmax = pbmax;
@@ -461,7 +461,7 @@ void BRepFeat_MakeCylindricalHole::Perform(const double Radius,
{
Baryc(its.Value(), Barycentre);
parbar = ElCLib::LineParameter(myAxis, Barycentre);
if (!(parbar < PntInfoFirst.Parameter() || parbar > PntInfoLast.Parameter()))
if (parbar >= PntInfoFirst.Parameter() && parbar <= PntInfoLast.Parameter())
{
KeepPart(its.Value());
}
@@ -123,10 +123,7 @@ void BRepFeat_MakeLinearForm::Init(const TopoDS_Shape& Sbase,
myDir1 = Direc1;
myPln = Plane;
if (Mode == 0)
myFuse = false;
else // if(Mode == 1)
myFuse = true;
myFuse = Mode != 0;
#ifdef OCCT_DEBUG
if (trc)
{
@@ -311,16 +308,9 @@ void BRepFeat_MakeLinearForm::Init(const TopoDS_Shape& Sbase,
gp_Pnt p2(myLastPnt.X() + myDir.X(), myLastPnt.Y() + myDir.Y(), myLastPnt.Z() + myDir.Z());
BRepLib_MakeEdge ee2(myLastPnt, p2);
BRepExtrema_ExtCF ext2(ee2, LastFace); // ExtCF : curves and surfaces
if (ext2.NbExt() == 1
&& ext2.SquareDistance(1)
<= BRep_Tool::Tolerance(LastFace) * BRep_Tool::Tolerance(LastFace))
{
Sliding = true;
}
else
{
Sliding = false;
}
Sliding = ext2.NbExt() == 1
&& ext2.SquareDistance(1)
<= BRep_Tool::Tolerance(LastFace) * BRep_Tool::Tolerance(LastFace);
}
else
{
@@ -346,16 +336,9 @@ void BRepFeat_MakeLinearForm::Init(const TopoDS_Shape& Sbase,
myLastPnt.Z() + myDir1.Z());
BRepLib_MakeEdge ee2(myLastPnt, p2);
BRepExtrema_ExtCF ext2(ee2, LastFace);
if (ext2.NbExt() == 1
&& ext2.SquareDistance(1)
<= BRep_Tool::Tolerance(LastFace) * BRep_Tool::Tolerance(LastFace))
{
Sliding = true;
}
else
{
Sliding = false;
}
Sliding = ext2.NbExt() == 1
&& ext2.SquareDistance(1)
<= BRep_Tool::Tolerance(LastFace) * BRep_Tool::Tolerance(LastFace);
}
else
{
@@ -411,7 +394,7 @@ void BRepFeat_MakeLinearForm::Init(const TopoDS_Shape& Sbase,
bool falseside = true;
Sliding = Propagate(SliList, Prof, myFirstPnt, myLastPnt, falseside);
// Control if there is everything required to have the material at the proper side
if (falseside == false)
if (!falseside)
{
#ifdef OCCT_DEBUG
std::cout << "Verify plane and wire orientation" << std::endl;
@@ -810,7 +793,7 @@ void BRepFeat_MakeLinearForm::Init(const TopoDS_Shape& Sbase,
bool falseside = true;
Propagate(SliList, Prof, myFirstPnt, myLastPnt, falseside);
// Control if there is everything required to have the material at the proper side
if (falseside == false)
if (!falseside)
{
#ifdef OCCT_DEBUG
std::cout << "Verify plane and wire orientation" << std::endl;
@@ -196,10 +196,7 @@ void BRepFeat_MakeRevolutionForm::Init(const TopoDS_Shape& Sbase,
mySkface.Nullify();
myPbase.Nullify();
if (Mode == 0)
myFuse = false;
else // if(Mode == 1)
myFuse = true;
myFuse = Mode != 0;
#ifdef OCCT_DEBUG
if (trc)
{
@@ -531,7 +528,7 @@ void BRepFeat_MakeRevolutionForm::Init(const TopoDS_Shape& Sbase,
bool falseside = true;
Sliding = Propagate(SliList, Prof, myFirstPnt, myLastPnt, falseside);
// Control if there is everything required to have the material at the proper side
if (falseside == false)
if (!falseside)
{
#ifdef OCCT_DEBUG
std::cout << " Verify plane and wire orientation" << std::endl;
@@ -1033,7 +1030,7 @@ void BRepFeat_MakeRevolutionForm::Init(const TopoDS_Shape& Sbase,
bool falseside = true;
Propagate(SliList, Prof, myFirstPnt, myLastPnt, falseside);
// Control if there is everything required to have the material at the proper side
if (falseside == false)
if (!falseside)
{
#ifdef OCCT_DEBUG
std::cout << " Verify plane and wire orientation" << std::endl;
@@ -218,7 +218,7 @@ void BRepFeat_RibSlot::LFPerform()
bool bFlag;
NCollection_List<TopoDS_Shape>::Iterator aIt;
bFlag = (myPerfSelection == BRepFeat_NoSelection) ? false : true;
bFlag = myPerfSelection != BRepFeat_NoSelection;
//
theBuilder.Init(mySbase, myGShape);
theBuilder.SetOperation(myFuse, bFlag);
@@ -239,7 +239,7 @@ void BRepFeat_RibSlot::LFPerform()
TopAbs_State sp1 = oussa.State();
oussa.Perform(myLastPnt, toler);
TopAbs_State sp2 = oussa.State();
if (!(sp1 == TopAbs_OUT || sp2 == TopAbs_OUT))
if (sp1 != TopAbs_OUT && sp2 != TopAbs_OUT)
{
const TopoDS_Shape& S = aIt.Value();
theBuilder.KeepPart(S);
@@ -1025,36 +1025,15 @@ bool BRepFeat_RibSlot::ExtremeFaces(const bool RevolRib,
if (!OnFirstFace)
{
if (p1.Distance(firstpoint) <= Precision::Confusion())
OnFirstFace = true;
else
OnFirstFace = false;
OnFirstFace = p1.Distance(firstpoint) <= Precision::Confusion();
}
if (!OnLastFace)
{
if (p2.Distance(lastpoint) <= Precision::Confusion())
OnLastFace = true;
else
OnLastFace = false;
OnLastFace = p2.Distance(lastpoint) <= Precision::Confusion();
}
if (FirstFace.IsNull() || LastFace.IsNull())
{
#ifdef OCCT_DEBUG
if (trc)
std::cout << " First or Last Faces still null" << std::endl;
#endif
Data = false;
}
else
{
#ifdef OCCT_DEBUG
if (trc)
std::cout << " FirstFace and LastFace OK" << std::endl;
#endif
Data = true;
}
Data = !(FirstFace.IsNull() || LastFace.IsNull());
return Data;
}
@@ -1330,11 +1330,7 @@ bool LocOpe_SplitShape::Rebuild(const TopoDS_Shape& S)
NCollection_List<TopoDS_Shape>::Iterator itr(myMap(S));
if (itr.More())
{
if (itr.Value().IsSame(S))
{
return false;
}
return true;
return !itr.Value().IsSame(S);
}
bool rebuild = false;
TopoDS_Iterator it;
@@ -126,9 +126,5 @@ bool BRepBlend_CurvPointRadInv::IsSolution(const math_Vector& Sol, const double
{
math_Vector valsol(1, 2);
Value(Sol, valsol);
if (std::abs(valsol(1)) <= Tol && std::abs(valsol(2)) <= Tol)
{
return true;
}
return false;
return std::abs(valsol(1)) <= Tol && std::abs(valsol(2)) <= Tol;
}
@@ -38,38 +38,26 @@ inline const occ::handle<BRepBlend_Line>& BRepBlend_RstRstLineBuilder::Line() co
inline bool BRepBlend_RstRstLineBuilder::Decroch1Start() const
{
if (decrochdeb == Blend_DecrochRst1 || decrochdeb == Blend_DecrochBoth)
return true;
return false;
return decrochdeb == Blend_DecrochRst1 || decrochdeb == Blend_DecrochBoth;
}
//=================================================================================================
inline bool BRepBlend_RstRstLineBuilder::Decroch1End() const
{
if (decrochfin == Blend_DecrochRst1 || decrochfin == Blend_DecrochBoth)
return true;
return false;
return decrochfin == Blend_DecrochRst1 || decrochfin == Blend_DecrochBoth;
}
//=================================================================================================
inline bool BRepBlend_RstRstLineBuilder::Decroch2Start() const
{
if (decrochdeb == Blend_DecrochRst2 || decrochdeb == Blend_DecrochBoth)
return true;
return false;
return decrochdeb == Blend_DecrochRst2 || decrochdeb == Blend_DecrochBoth;
}
//=================================================================================================
inline bool BRepBlend_RstRstLineBuilder::Decroch2End() const
{
if (decrochfin == Blend_DecrochRst2 || decrochfin == Blend_DecrochBoth)
return true;
return false;
return decrochfin == Blend_DecrochRst2 || decrochfin == Blend_DecrochBoth;
}
@@ -279,10 +279,6 @@ bool BRepBlend_SurfCurvConstRadInv::IsSolution(const math_Vector& Sol, const dou
{
math_Vector valsol(1, 3);
Value(Sol, valsol);
if (std::abs(valsol(1)) <= Tol && std::abs(valsol(2)) <= Tol
&& std::abs(valsol(3)) <= 2 * Tol * std::abs(ray))
{
return true;
}
return false;
return std::abs(valsol(1)) <= Tol && std::abs(valsol(2)) <= Tol
&& std::abs(valsol(3)) <= 2 * Tol * std::abs(ray);
}
@@ -298,10 +298,6 @@ bool BRepBlend_SurfCurvEvolRadInv::IsSolution(const math_Vector& Sol, const doub
{
math_Vector valsol(1, 3);
Value(Sol, valsol);
if (std::abs(valsol(1)) <= Tol && std::abs(valsol(2)) <= Tol
&& std::abs(valsol(3)) <= 2 * Tol * std::abs(ray))
{
return true;
}
return false;
return std::abs(valsol(1)) <= Tol && std::abs(valsol(2)) <= Tol
&& std::abs(valsol(3)) <= 2 * Tol * std::abs(ray);
}
@@ -271,10 +271,6 @@ bool BRepBlend_SurfPointConstRadInv::IsSolution(const math_Vector& Sol, const do
{
math_Vector valsol(1, 3);
Value(Sol, valsol);
if (std::abs(valsol(1)) <= Tol && std::abs(valsol(2)) <= Tol
&& std::abs(valsol(3)) <= 2 * Tol * std::abs(ray))
{
return true;
}
return false;
return std::abs(valsol(1)) <= Tol && std::abs(valsol(2)) <= Tol
&& std::abs(valsol(3)) <= 2 * Tol * std::abs(ray);
}
@@ -264,10 +264,6 @@ bool BRepBlend_SurfPointEvolRadInv::IsSolution(const math_Vector& Sol, const dou
{
math_Vector valsol(1, 3);
Value(Sol, valsol);
if (std::abs(valsol(1)) <= Tol && std::abs(valsol(2)) <= Tol
&& std::abs(valsol(3)) <= 2 * Tol * std::abs(ray))
{
return true;
}
return false;
return std::abs(valsol(1)) <= Tol && std::abs(valsol(2)) <= Tol
&& std::abs(valsol(3)) <= 2 * Tol * std::abs(ray);
}
@@ -336,11 +336,9 @@ const NCollection_List<TopoDS_Shape>& BRepFilletAPI_MakeChamfer::Modified(const
bool BRepFilletAPI_MakeChamfer::IsDeleted(const TopoDS_Shape& F)
{
if (myMap.Contains(F) || myBuilder.Builder()->IsSplit(F, TopAbs_OUT)
|| myBuilder.Builder()->IsSplit(F, TopAbs_IN) || myBuilder.Builder()->IsSplit(F, TopAbs_ON))
return false;
return true;
return !(myMap.Contains(F) || myBuilder.Builder()->IsSplit(F, TopAbs_OUT)
|| myBuilder.Builder()->IsSplit(F, TopAbs_IN)
|| myBuilder.Builder()->IsSplit(F, TopAbs_ON));
}
//=================================================================================================
@@ -461,11 +461,9 @@ const NCollection_List<TopoDS_Shape>& BRepFilletAPI_MakeFillet::Modified(const T
bool BRepFilletAPI_MakeFillet::IsDeleted(const TopoDS_Shape& F)
{
if (myMap.Contains(F) || myBuilder.Builder()->IsSplit(F, TopAbs_OUT)
|| myBuilder.Builder()->IsSplit(F, TopAbs_IN) || myBuilder.Builder()->IsSplit(F, TopAbs_ON))
return false;
return true;
return !(myMap.Contains(F) || myBuilder.Builder()->IsSplit(F, TopAbs_OUT)
|| myBuilder.Builder()->IsSplit(F, TopAbs_IN)
|| myBuilder.Builder()->IsSplit(F, TopAbs_ON));
}
//=================================================================================================
@@ -166,15 +166,9 @@ bool BlendFunc_ChAsymInv::IsSolution(const math_Vector& Sol, const double Tol)
Value(Sol, valsol);
if (std::abs(valsol(1)) < Tol && std::abs(valsol(2)) < Tol
&& std::abs(valsol(3)) < 2. * dist1 * Tol
&& std::abs(valsol(4)) < Tol * (1. + tgang) * std::abs(PScaInv) * temp)
{
return true;
}
return false;
return std::abs(valsol(1)) < Tol && std::abs(valsol(2)) < Tol
&& std::abs(valsol(3)) < 2. * dist1 * Tol
&& std::abs(valsol(4)) < Tol * (1. + tgang) * std::abs(PScaInv) * temp;
}
//=================================================================================================
@@ -148,12 +148,8 @@ bool BlendFunc_ConstRadInv::IsSolution(const math_Vector& Sol, const double Tol)
{
math_Vector valsol(1, 4);
Value(Sol, valsol);
if (std::abs(valsol(1)) <= Tol
&& valsol(2) * valsol(2) + valsol(3) * valsol(3) + valsol(4) * valsol(4) <= Tol * Tol)
{
return true;
}
return false;
return std::abs(valsol(1)) <= Tol
&& valsol(2) * valsol(2) + valsol(3) * valsol(3) + valsol(4) * valsol(4) <= Tol * Tol;
}
bool BlendFunc_ConstRadInv::Value(const math_Vector& X, math_Vector& F)
@@ -80,11 +80,8 @@ bool BlendFunc_ConstThroatInv::IsSolution(const math_Vector& Sol, const double T
math_Vector valsol(1, 4);
Value(Sol, valsol);
if (std::abs(valsol(1)) <= Tol && std::abs(valsol(2)) <= Tol && std::abs(valsol(3)) <= Tol * Tol
&& std::abs(valsol(4)) <= Tol * Tol)
return true;
return false;
return std::abs(valsol(1)) <= Tol && std::abs(valsol(2)) <= Tol
&& std::abs(valsol(3)) <= Tol * Tol && std::abs(valsol(4)) <= Tol * Tol;
}
//=================================================================================================
@@ -34,11 +34,8 @@ bool BlendFunc_ConstThroatWithPenetrationInv::IsSolution(const math_Vector& Sol,
math_Vector valsol(1, 4);
Value(Sol, valsol);
if (std::abs(valsol(1)) <= Tol && std::abs(valsol(2)) <= Tol && std::abs(valsol(3)) <= Tol * Tol
&& std::abs(valsol(4)) <= Tol)
return true;
return false;
return std::abs(valsol(1)) <= Tol && std::abs(valsol(2)) <= Tol
&& std::abs(valsol(3)) <= Tol * Tol && std::abs(valsol(4)) <= Tol;
}
//=================================================================================================
@@ -147,11 +147,8 @@ bool BlendFunc_EvolRadInv::IsSolution(const math_Vector& Sol, const double Tol)
{
math_Vector valsol(1, 4);
Value(Sol, valsol);
if (std::abs(valsol(1)) <= Tol
&& (valsol(2) * valsol(2) + valsol(3) * valsol(3) + valsol(4) * valsol(4)) <= Tol * Tol)
return true;
return false;
return std::abs(valsol(1)) <= Tol
&& (valsol(2) * valsol(2) + valsol(3) * valsol(3) + valsol(4) * valsol(4)) <= Tol * Tol;
}
bool BlendFunc_EvolRadInv::Value(const math_Vector& X, math_Vector& F)
@@ -107,11 +107,8 @@ bool BlendFunc_RuledInv::IsSolution(const math_Vector& Sol, const double Tol)
{
math_Vector valsol(1, 4);
Value(Sol, valsol);
if (std::abs(valsol(1)) <= Tol && std::abs(valsol(2)) <= Tol && std::abs(valsol(3)) <= Tol
&& std::abs(valsol(4)) <= Tol)
return true;
return false;
return std::abs(valsol(1)) <= Tol && std::abs(valsol(2)) <= Tol && std::abs(valsol(3)) <= Tol
&& std::abs(valsol(4)) <= Tol;
}
bool BlendFunc_RuledInv::Value(const math_Vector& X, math_Vector& F)
@@ -60,7 +60,7 @@ static bool isCW(const BRepAdaptor_Curve& AC)
while (enda < 0.0)
enda += 2.0 * M_PI;
bool is_cw = middlea > enda ? true : false;
bool is_cw = middlea > enda;
return is_cw;
}
@@ -319,7 +319,7 @@ bool ChFi2d_AnaFilletAlgo::Perform(const double radius)
{
const TopoDS_Face& F = mkFace.Face();
ShapeAnalysis_Wire analyzer(W, F, Precision::Confusion());
if (analyzer.CheckSelfIntersection() == true)
if (analyzer.CheckSelfIntersection())
{
// Cut the edges at the point of intersection.
isCut = true;
@@ -355,7 +355,7 @@ bool ChFi2d_AnaFilletAlgo::Perform(const double radius)
return false;
// Invert the fillet for left-handed plane.
if (plane.Position().Direct() == false)
if (!plane.Position().Direct())
cw = !cw;
// Construct a fillet.
@@ -395,7 +395,7 @@ bool ChFi2d_AnaFilletAlgo::Perform(const double radius)
if (bRet)
{
// Invert the fillet for left-handed planes.
if (plane.Position().Direct() == false)
if (!plane.Position().Direct())
cw = !cw;
// Make the circle again.
@@ -850,7 +850,7 @@ TopoDS_Edge ChFi2d_Builder::BuildFilletEdge(const TopoDS_Vertex& V,
{
if (param3 > param4)
{
if (Sens1 == true)
if (Sens1)
{
Qual1 = GccEnt_enclosed;
}
@@ -861,7 +861,7 @@ TopoDS_Edge ChFi2d_Builder::BuildFilletEdge(const TopoDS_Vertex& V,
}
else
{
if (Sens1 == true)
if (Sens1)
{
Qual1 = GccEnt_outside;
}
@@ -872,14 +872,14 @@ TopoDS_Edge ChFi2d_Builder::BuildFilletEdge(const TopoDS_Vertex& V,
}
if (param1 > param2)
{
if (Sens2 == true)
if (Sens2)
Qual2 = GccEnt_outside;
else
Qual2 = GccEnt_enclosed;
}
else
{
if (Sens2 == true)
if (Sens2)
Qual2 = GccEnt_enclosed;
else
Qual2 = GccEnt_outside;
@@ -889,28 +889,28 @@ TopoDS_Edge ChFi2d_Builder::BuildFilletEdge(const TopoDS_Vertex& V,
{
if (param3 > param4)
{
if (Sens1 == true)
if (Sens1)
Qual1 = GccEnt_outside;
else
Qual1 = GccEnt_enclosed;
}
else
{
if (Sens1 == true)
if (Sens1)
Qual1 = GccEnt_enclosed;
else
Qual1 = GccEnt_outside;
}
if (param1 > param2)
{
if (Sens2 == true)
if (Sens2)
Qual2 = GccEnt_enclosed;
else
Qual2 = GccEnt_outside;
}
else
{
if (Sens2 == true)
if (Sens2)
Qual2 = GccEnt_outside;
else
Qual2 = GccEnt_enclosed;
@@ -1182,13 +1182,6 @@ bool IsLineOrCircle(const TopoDS_Edge& E, const TopoDS_Face& F)
else
basisC = C;
if (basisC->DynamicType() == STANDARD_TYPE(Geom2d_Circle)
|| basisC->DynamicType() == STANDARD_TYPE(Geom2d_Line))
{
return true;
}
else
{
return false;
} // else ...
return basisC->DynamicType() == STANDARD_TYPE(Geom2d_Circle)
|| basisC->DynamicType() == STANDARD_TYPE(Geom2d_Line); // else ...
} // IsLineOrCircle
@@ -785,13 +785,6 @@ bool IsLineOrCircle(const TopoDS_Edge& E, const TopoDS_Face& F)
else
basisC = C;
if (basisC->DynamicType() == STANDARD_TYPE(Geom2d_Circle)
|| basisC->DynamicType() == STANDARD_TYPE(Geom2d_Line))
{
return true;
}
else
{
return false;
} // else ...
return basisC->DynamicType() == STANDARD_TYPE(Geom2d_Circle)
|| basisC->DynamicType() == STANDARD_TYPE(Geom2d_Line); // else ...
} // IsLineOrCircle
@@ -516,7 +516,7 @@ int ChFi2d_FilletAlgo::NbResults(const gp_Pnt& thePoint)
NCollection_List<double>::Iterator anIter(myResultParams);
for (; anIter.More(); anIter.Next(), i++)
{
myStartSide = (myResultOrientation.Value(i)) ? true : false;
myStartSide = (myResultOrientation.Value(i)) != 0;
FilletPoint* aPoint = new FilletPoint(anIter.Value());
FillPoint(aPoint, anIter.Value() + 1.);
if (aPoint->hasSolution(myRadius))
@@ -547,7 +547,7 @@ TopoDS_Edge ChFi2d_FilletAlgo::Result(const gp_Pnt& thePoint,
NCollection_List<double>::Iterator anIter(myResultParams);
for (aNearest = nullptr, a = 1; anIter.More(); anIter.Next(), a++)
{
myStartSide = (myResultOrientation.Value(a)) ? true : false;
myStartSide = (myResultOrientation.Value(a)) != 0;
FilletPoint* aPoint = new FilletPoint(anIter.Value());
FillPoint(aPoint, anIter.Value() + 1.);
if (!aPoint->hasSolution(myRadius))
@@ -255,9 +255,7 @@ bool ChFi3d::IsTangentFaces(const TopoDS_Edge& theEdge,
TopOpeBRepTool_TOOL::Nt(uv1, theFace1, normal1);
TopOpeBRepTool_TOOL::Nt(uv2, theFace2, normal2);
double dot = normal1.Dot(normal2);
if (dot < 0.)
return false;
return true;
return dot >= 0.;
}
//=======================================================================
@@ -477,14 +477,14 @@ bool ChFi3d_KParticular(const occ::handle<ChFiDS_Spine>& Spine,
aST1 = aS1.GetType();
aST2 = aS2.GetType();
//
if (!(aST2 == GeomAbs_Plane || aST2 == GeomAbs_Cylinder || aST2 == GeomAbs_Cone))
if (aST2 != GeomAbs_Plane && aST2 != GeomAbs_Cylinder && aST2 != GeomAbs_Cone)
{
return !bRet;
}
//
const BRepAdaptor_Curve& bc = Spine->CurrentElementarySpine(IE);
aCT = bc.GetType();
if (!(aCT == GeomAbs_Line || aCT == GeomAbs_Circle))
if (aCT != GeomAbs_Line && aCT != GeomAbs_Circle)
{
return !bRet;
}
@@ -3066,7 +3066,7 @@ void ChFi3d_FilDS(const int SolidIndex,
DStr.ChangeShapeInterferences(IArcspine).Append(interfv);
}
} // end of degenerated case
else if (!(Closed && j == SeqFil.Length()))
else if (!Closed || j != SeqFil.Length())
{
// Processing of interference Point / Edges
if (V3.IsOnArc())
@@ -849,7 +849,7 @@ bool ChFi3d_Builder::PerformElement(const occ::handle<ChFiDS_Spine>& Spine,
ChFiDS_TypeOfConcavity TypeOfConcavity = ChFi3d::DefineConnectType(Ec, ff1, ff2, 1.e-5, true);
Spine->SetTypeOfConcavity(TypeOfConcavity);
bool ToRestrict = (Offset > 0) ? true : false;
bool ToRestrict = Offset > 0;
BRepAdaptor_Surface Sb1(ff1, ToRestrict);
BRepAdaptor_Surface Sb2(ff2, ToRestrict);
if (Offset > 0)
@@ -491,13 +491,8 @@ static bool IsG1(const ChFiDS_Map& TheMap,
{
FVoi = FRef;
// Modified by Sergey KHROMOV - Fri Dec 21 17:15:12 2001 Begin
// if (BRep_Tool::Continuity(E,FRef,FRef) >= GeomAbs_G1) {
if (ChFi3d::IsTangentFaces(E, FRef, FRef))
{
// Modified by Sergey KHROMOV - Fri Dec 21 17:15:16 2001 End
return true;
}
return false;
// if (BRep_Tool::Continuity(E,FRef,FRef) >= GeomAbs_G1)
return ChFi3d::IsTangentFaces(E, FRef, FRef);
}
}
}
@@ -1108,7 +1108,7 @@ void ChFi3d_Builder::PerformOneCorner(const int Index, const bool thePrepareOnSa
pfac1 = Hc->Value(CV[i].ParameterOnArc());
PcF = Pc->Value(Udeb);
PcL = Pc->Value(Ufin);
onfirst = (pfac1.Distance(PcF) < pfac1.Distance(PcL)) ? true : false;
onfirst = pfac1.Distance(PcF) < pfac1.Distance(PcL);
if (onfirst)
Pc->D1(Udeb, PcF, DerPc);
else
@@ -1650,11 +1650,8 @@ static bool IsShrink(const Geom2dAdaptor_Curve& PC,
case GeomAbs_Line: {
gp_Pnt2d P1 = PC.Value(Pf);
gp_Pnt2d P2 = PC.Value(Pl);
if (std::abs(P1.Coord(isU ? 1 : 2) - Param) <= tol
&& std::abs(P2.Coord(isU ? 1 : 2) - Param) <= tol)
return true;
else
return false;
return std::abs(P1.Coord(isU ? 1 : 2) - Param) <= tol
&& std::abs(P2.Coord(isU ? 1 : 2) - Param) <= tol;
}
case GeomAbs_BezierCurve:
case GeomAbs_BSplineCurve: {
@@ -2426,7 +2426,7 @@ void ChFi3d_FilBuilder::ExtentThreeCorner(const TopoDS_Vertex&
double dU = Spine->LastParameter(Spine->NbEdges());
if (Sens == 1)
{
if (!(Spine->GetTypeOfConcavity() == ChFiDS_Convex && Spine->FirstStatus() == ChFiDS_OnSame))
if (Spine->GetTypeOfConcavity() != ChFiDS_Convex || Spine->FirstStatus() != ChFiDS_OnSame)
{
Spine->SetFirstParameter(-dU * Coeff);
Spine->SetFirstTgt(0.);
@@ -2434,7 +2434,7 @@ void ChFi3d_FilBuilder::ExtentThreeCorner(const TopoDS_Vertex&
}
else
{
if (!(Spine->GetTypeOfConcavity() == ChFiDS_Convex && Spine->LastStatus() == ChFiDS_OnSame))
if (Spine->GetTypeOfConcavity() != ChFiDS_Convex || Spine->LastStatus() != ChFiDS_OnSame)
{
Spine->SetLastParameter(dU * (1. + Coeff));
Spine->SetLastTgt(dU);

Some files were not shown because too many files have changed in this diff Show More