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
@@ -282,7 +282,7 @@ void AppDef_Variational::Init()
myNbTangPoints++;
if (myNbP2d != 0 && myNbP3d == 0)
{
if (AppDef_MyLineTool::Tangency(mySSP, ipoint, TabV2d) == false)
if (!AppDef_MyLineTool::Tangency(mySSP, ipoint, TabV2d))
throw Standard_ConstructionError();
for (jp2d = 1; jp2d <= myNbP2d; jp2d++)
{
@@ -296,7 +296,7 @@ void AppDef_Variational::Init()
}
if (myNbP3d != 0 && myNbP2d == 0)
{
if (AppDef_MyLineTool::Tangency(mySSP, ipoint, TabV3d) == false)
if (!AppDef_MyLineTool::Tangency(mySSP, ipoint, TabV3d))
throw Standard_ConstructionError();
for (jp3d = 1; jp3d <= myNbP3d; jp3d++)
{
@@ -313,7 +313,7 @@ void AppDef_Variational::Init()
}
if (myNbP3d != 0 && myNbP2d != 0)
{
if (AppDef_MyLineTool::Tangency(mySSP, ipoint, TabV3d, TabV2d) == false)
if (!AppDef_MyLineTool::Tangency(mySSP, ipoint, TabV3d, TabV2d))
throw Standard_ConstructionError();
for (jp3d = 1; jp3d <= myNbP3d; jp3d++)
{
@@ -345,9 +345,9 @@ void AppDef_Variational::Init()
myNbCurvPoints++;
if (myNbP2d != 0 && myNbP3d == 0)
{
if (AppDef_MyLineTool::Tangency(mySSP, ipoint, TabV2d) == false)
if (!AppDef_MyLineTool::Tangency(mySSP, ipoint, TabV2d))
throw Standard_ConstructionError();
if (AppDef_MyLineTool::Curvature(mySSP, ipoint, TabV2dcurv) == false)
if (!AppDef_MyLineTool::Curvature(mySSP, ipoint, TabV2dcurv))
throw Standard_ConstructionError();
for (jp2d = 1; jp2d <= myNbP2d; jp2d++)
{
@@ -366,16 +366,16 @@ void AppDef_Variational::Init()
if (myNbP3d != 0 && myNbP2d == 0)
{
if (AppDef_MyLineTool::Tangency(mySSP, ipoint, TabV3d) == false)
if (!AppDef_MyLineTool::Tangency(mySSP, ipoint, TabV3d))
throw Standard_ConstructionError();
if (AppDef_MyLineTool::Curvature(mySSP, ipoint, TabV3dcurv) == false)
if (!AppDef_MyLineTool::Curvature(mySSP, ipoint, TabV3dcurv))
throw Standard_ConstructionError();
for (jp3d = 1; jp3d <= myNbP3d; jp3d++)
{
Vt3d = TabV3d.Value(jp3d);
Vt3d.Normalize();
Vc3d = TabV3dcurv.Value(jp3d);
if ((Vc3d.Normalized()).IsNormal(Vt3d, Precision::Angular()) == false)
if (!(Vc3d.Normalized()).IsNormal(Vt3d, Precision::Angular()))
throw Standard_ConstructionError();
myTabConstraints->SetValue(jndex++, Vt3d.X());
myTabConstraints->SetValue(jndex++, Vt3d.Y());
@@ -388,16 +388,16 @@ void AppDef_Variational::Init()
}
if (myNbP3d != 0 && myNbP2d != 0)
{
if (AppDef_MyLineTool::Tangency(mySSP, ipoint, TabV3d, TabV2d) == false)
if (!AppDef_MyLineTool::Tangency(mySSP, ipoint, TabV3d, TabV2d))
throw Standard_ConstructionError();
if (AppDef_MyLineTool::Curvature(mySSP, ipoint, TabV3dcurv, TabV2dcurv) == false)
if (!AppDef_MyLineTool::Curvature(mySSP, ipoint, TabV3dcurv, TabV2dcurv))
throw Standard_ConstructionError();
for (jp3d = 1; jp3d <= myNbP3d; jp3d++)
{
Vt3d = TabV3d.Value(jp3d);
Vt3d.Normalize();
Vc3d = TabV3dcurv.Value(jp3d);
if ((Vc3d.Normalized()).IsNormal(Vt3d, Precision::Angular()) == false)
if (!(Vc3d.Normalized()).IsNormal(Vt3d, Precision::Angular()))
throw Standard_ConstructionError();
myTabConstraints->SetValue(jndex++, Vt3d.X());
myTabConstraints->SetValue(jndex++, Vt3d.Y());
@@ -429,7 +429,7 @@ void AppDef_Variational::Init()
}
// OverConstraint Detection
int MaxSeg;
if (myWithCutting == true)
if (myWithCutting)
MaxSeg = myMaxSegment;
else
MaxSeg = 1;
@@ -456,7 +456,7 @@ void AppDef_Variational::Init()
void AppDef_Variational::Approximate()
{
if (myIsCreated == false)
if (!myIsCreated)
throw StdFail_NotDone();
double WQuadratic, WQuality;
@@ -665,7 +665,7 @@ bool AppDef_Variational::IsOverConstrained() const
//
AppParCurves_MultiBSpCurve AppDef_Variational::Value() const
{
if (myIsDone == false)
if (!myIsDone)
throw StdFail_NotDone();
return myMBSpCurve;
}
@@ -680,7 +680,7 @@ AppParCurves_MultiBSpCurve AppDef_Variational::Value() const
//
double AppDef_Variational::MaxError() const
{
if (myIsDone == false)
if (!myIsDone)
throw StdFail_NotDone();
return myMaxError;
}
@@ -693,7 +693,7 @@ double AppDef_Variational::MaxError() const
//
int AppDef_Variational::MaxErrorIndex() const
{
if (myIsDone == false)
if (!myIsDone)
throw StdFail_NotDone();
return myMaxErrorIndex;
}
@@ -708,7 +708,7 @@ int AppDef_Variational::MaxErrorIndex() const
//
double AppDef_Variational::QuadraticError() const
{
if (myIsDone == false)
if (!myIsDone)
throw StdFail_NotDone();
return myCriterium[0];
}
@@ -723,7 +723,7 @@ double AppDef_Variational::QuadraticError() const
void AppDef_Variational::Distance(math_Matrix& mat)
{
if (myIsDone == false)
if (!myIsDone)
throw StdFail_NotDone();
int ipoint, jp2d, jp3d, index;
NCollection_Array1<gp_Pnt> TabP3d(1, std::max(1, myNbP3d));
@@ -777,7 +777,7 @@ void AppDef_Variational::Distance(math_Matrix& mat)
//
double AppDef_Variational::AverageError() const
{
if (myIsDone == false)
if (!myIsDone)
throw StdFail_NotDone();
return myAverageError;
}
@@ -790,7 +790,7 @@ double AppDef_Variational::AverageError() const
//
const occ::handle<NCollection_HArray1<double>>& AppDef_Variational::Parameters() const
{
if (myIsDone == false)
if (!myIsDone)
throw StdFail_NotDone();
return myParameters;
}
@@ -803,7 +803,7 @@ const occ::handle<NCollection_HArray1<double>>& AppDef_Variational::Parameters()
//
const occ::handle<NCollection_HArray1<double>>& AppDef_Variational::Knots() const
{
if (myIsDone == false)
if (!myIsDone)
throw StdFail_NotDone();
return myKnots;
}
@@ -818,7 +818,7 @@ void AppDef_Variational::Criterium(double& VFirstOrder,
double& VSecondOrder,
double& VThirdOrder) const
{
if (myIsDone == false)
if (!myIsDone)
throw StdFail_NotDone();
VFirstOrder = myCriterium[1];
VSecondOrder = myCriterium[2];
@@ -983,10 +983,7 @@ bool AppDef_Variational::SetConstraints(
{
myConstraints = aConstraint;
Init();
if (myIsOverConstr)
return false;
else
return true;
return !myIsOverConstr;
}
//
@@ -1048,7 +1045,7 @@ bool AppDef_Variational::SetMaxDegree(const int Degree)
//
bool AppDef_Variational::SetMaxSegment(const int NbSegment)
{
if (myWithCutting == true
if (myWithCutting
&& ((myMaxDegree - myNivCont) * NbSegment - myNbPassPoints - 2 * myNbTangPoints
- 3 * myNbCurvPoints)
< 0)
@@ -1123,7 +1120,7 @@ void AppDef_Variational::SetWithMinMax(const bool MinMax)
//
bool AppDef_Variational::SetWithCutting(const bool Cutting)
{
if (Cutting == false)
if (!Cutting)
{
if (((myMaxDegree - myNivCont) * myKnots->Length() - myNbPassPoints - 2 * myNbTangPoints
- 3 * myNbCurvPoints)
@@ -2150,7 +2147,7 @@ void AppDef_Variational::InitSmoothCriterion()
double CurvTol = Eps2 * Length / myNbPoints;
// Decoupe de l'intervalle en fonction des contraintes
if (myWithCutting == true && NbConstr != 0)
if (myWithCutting && NbConstr != 0)
{
InitCutting(TheBase, CurvTol, TheCurve);
@@ -2886,9 +2883,7 @@ static bool NotParallel(gp_Vec& T, gp_Vec& V)
if (V.CrossMagnitude(T) > 1.e-12)
return true;
V.SetZ(V.Z() + 1.);
if (V.CrossMagnitude(T) > 1.e-12)
return true;
return false;
return V.CrossMagnitude(T) > 1.e-12;
}
void AppDef_Variational::AssemblingConstraints(const occ::handle<FEmTool_Curve>& Curve,
@@ -764,8 +764,5 @@ bool Approx_CurveOnSurface::buildC3dOnIsoLine(const occ::handle<Adaptor2d_Curve2
// OCCT is unable to convert it keeping original parameterization, while the geometric
// form of the result is entirely identical. In that case, it is better to utilize
// a general-purpose approach.
if (myError3d > myTol)
return false;
return true;
return myError3d <= myTol;
}
@@ -829,12 +829,7 @@ bool Approx_SameParameter::Interpolate(const Approx_SameParameter_Data& theData,
1,
thePoles(1),
inversion_problem);
if (inversion_problem)
{
return false;
}
return true;
return inversion_problem == 0;
}
//=================================================================================================
@@ -438,7 +438,7 @@ bool Approx_SweepApproximation::D0(const double Param,
myFunc->SetInterval(First, Last);
}
if (!((Param == myParam) && (myOrder >= 0) && (first == First) && (Last == last)))
if ((Param != myParam) || (myOrder < 0) || (first != First) || (Last != last))
{
// Positioning in case when the last operation is not repeated.
Ok = myFunc->D0(Param,
@@ -507,7 +507,7 @@ bool Approx_SweepApproximation::D1(const double Param,
myFunc->SetInterval(First, Last);
}
if (!((Param == myParam) && (myOrder >= 1) && (first == First) && (Last == last)))
if ((Param != myParam) || (myOrder < 1) || (first != First) || (Last != last))
{
// Positioning
@@ -590,7 +590,7 @@ bool Approx_SweepApproximation::D2(const double Param,
myFunc->SetInterval(First, Last);
}
if (!((Param == myParam) && (myOrder >= 2) && (first == First) && (Last == last)))
if ((Param != myParam) || (myOrder < 2) || (first != First) || (Last != last))
{
// Positioning in case when the last operation is not repeated
Ok = myFunc->D2(Param,
@@ -143,12 +143,7 @@ public:
private:
Curv2dMaxMinCoordMVar& operator=(const Curv2dMaxMinCoordMVar&) = delete;
bool CheckInputData(double theParam)
{
if (theParam < myUMin || theParam > myUMax)
return false;
return true;
}
bool CheckInputData(double theParam) { return theParam >= myUMin && theParam <= myUMax; }
const occ::handle<Geom2d_Curve>& myCurve;
double myUMin;
@@ -190,12 +185,7 @@ public:
private:
Curv2dMaxMinCoord& operator=(const Curv2dMaxMinCoord&) = delete;
bool CheckInputData(double theParam)
{
if (theParam < myUMin || theParam > myUMax)
return false;
return true;
}
bool CheckInputData(double theParam) { return theParam >= myUMin && theParam <= myUMax; }
const occ::handle<Geom2d_Curve>& myCurve;
double myUMin;
@@ -456,12 +456,7 @@ public:
private:
CurvMaxMinCoordMVar& operator=(const CurvMaxMinCoordMVar&) = delete;
bool CheckInputData(double theParam)
{
if (theParam < myUMin || theParam > myUMax)
return false;
return true;
}
bool CheckInputData(double theParam) { return theParam >= myUMin && theParam <= myUMax; }
const Adaptor3d_Curve& myCurve;
double myUMin;
@@ -503,12 +498,7 @@ public:
private:
CurvMaxMinCoord& operator=(const CurvMaxMinCoord&) = delete;
bool CheckInputData(double theParam)
{
if (theParam < myUMin || theParam > myUMax)
return false;
return true;
}
bool CheckInputData(double theParam) { return theParam >= myUMin && theParam <= myUMax; }
const Adaptor3d_Curve& myCurve;
double myUMin;
@@ -810,10 +810,8 @@ private:
bool CheckInputData(const math_Vector& theParams)
{
if (theParams(1) < myUMin || theParams(1) > myUMax || theParams(2) < myVMin
|| theParams(2) > myVMax)
return false;
return true;
return theParams(1) >= myUMin && theParams(1) <= myUMax && theParams(2) >= myVMin
&& theParams(2) <= myVMax;
}
const Adaptor3d_Surface& mySurf;
@@ -562,10 +562,7 @@ static bool IsCaseAnalyticallyComputable(const GeomAbs_CurveType& theType,
return false;
}
// check if it is a plane
if (std::abs(theCurvePos.Direction() * theSurfaceDirection) <= gp::Resolution())
return false;
else
return true;
return std::abs(theCurvePos.Direction() * theSurfaceDirection) > gp::Resolution();
}
//=================================================================================================
@@ -94,10 +94,7 @@ static bool HasSingularity(const GeomAdaptor_SurfaceOfRevolution& S)
P = C->Value(C->LastParameter());
if (L.SquareDistance(P) < Precision::SquareConfusion())
return true;
return false;
return L.SquareDistance(P) < Precision::SquareConfusion();
}
//=============================================================================
@@ -154,9 +151,7 @@ static bool IsCaseAnalyticallyComputable(const GeomAbs_CurveType& theType,
double aThreshold = Precision::Angular() * Precision::Angular() * dist2;
gp_Pnt p2 = AxeOfRevolution.Location().XYZ() + dist * AxeOfRevolution.Direction().XYZ();
if ((pl.SquareDistance(p1) < aThreshold) && (pl.SquareDistance(p2) < aThreshold))
return true;
return false;
return (pl.SquareDistance(p1) < aThreshold) && (pl.SquareDistance(p2) < aThreshold);
// gp_Vec V (AxeOfRevolution.Location(),theCurvePos.Location());
// if (std::abs( V * theCurvePos.Direction()) <= gp::Resolution())
// return true;
@@ -91,13 +91,6 @@ bool Extrema_FuncPSDist::Values(const math_Vector& X, double& F, math_Vector& G)
bool Extrema_FuncPSDist::IsInside(const math_Vector& X)
{
if (X(1) < mySurf.FirstUParameter() || X(1) > mySurf.LastUParameter()
|| X(2) < mySurf.FirstVParameter() || X(2) > mySurf.LastVParameter())
{
// Point out of borders.
return false;
}
// Point is inside.
return true;
return X(1) >= mySurf.FirstUParameter() && X(1) <= mySurf.LastUParameter()
&& X(2) >= mySurf.FirstVParameter() && X(2) <= mySurf.LastVParameter();
}
@@ -131,10 +131,7 @@ Extrema_GenExtCS::Extrema_GenExtCS()
//=================================================================================================
Extrema_GenExtCS::~Extrema_GenExtCS()
{
//
}
Extrema_GenExtCS::~Extrema_GenExtCS() = default;
//=================================================================================================
@@ -228,10 +228,7 @@ Extrema_GenExtPS::Extrema_GenExtPS()
//=================================================================================================
Extrema_GenExtPS::~Extrema_GenExtPS()
{
//
}
Extrema_GenExtPS::~Extrema_GenExtPS() = default;
//=================================================================================================
@@ -112,10 +112,7 @@ Extrema_GenExtSS::Extrema_GenExtSS()
//=================================================================================================
Extrema_GenExtSS::~Extrema_GenExtSS()
{
//
}
Extrema_GenExtSS::~Extrema_GenExtSS() = default;
//=================================================================================================
@@ -80,11 +80,7 @@ bool Extrema_GlobOptFuncCQuadric::checkInputData(const math_Vector& X, double& c
{
ct = X(X.Lower());
if (ct < myTf || ct > myTl)
{
return false;
}
return true;
return ct >= myTf && ct <= myTl;
}
//=================================================================================================
@@ -201,11 +197,7 @@ bool Extrema_GlobOptFuncCQuadric::Value(const math_Vector& X, double& F)
return false;
value(ct, F);
if (Precision::IsInfinite(F))
{
return false;
}
return true;
return !Precision::IsInfinite(F);
}
//=================================================================================================
@@ -94,12 +94,9 @@ bool Extrema_GlobOptFuncCS::checkInputData(const math_Vector& X, double& cu, dou
su = X(aStartIndex + 1);
sv = X(aStartIndex + 2);
if (cu < myC->FirstParameter() || cu > myC->LastParameter() || su < myS->FirstUParameter()
|| su > myS->LastUParameter() || sv < myS->FirstVParameter() || sv > myS->LastVParameter())
{
return false;
}
return true;
return cu >= myC->FirstParameter() && cu <= myC->LastParameter() && su >= myS->FirstUParameter()
&& su <= myS->LastUParameter() && sv >= myS->FirstVParameter()
&& sv <= myS->LastVParameter();
}
//=================================================================================================
@@ -71,11 +71,7 @@ bool Extrema_GlobOptFuncConicS::checkInputData(const math_Vector& X, double& su,
su = X(aStartIndex);
sv = X(aStartIndex + 1);
if (su < myUf || su > myUl || sv < myVf || sv > myVl)
{
return false;
}
return true;
return su >= myUf && su <= myUl && sv >= myVf && sv <= myVl;
}
//=================================================================================================
@@ -181,11 +177,7 @@ bool Extrema_GlobOptFuncConicS::Value(const math_Vector& X, double& F)
return false;
value(su, sv, F);
if (Precision::IsInfinite(F))
{
return false;
}
return true;
return !Precision::IsInfinite(F);
}
//=================================================================================================
@@ -251,10 +251,7 @@ bool FEmTool_ProfileMatrix::IsInProfile(const int i, const int j) const
{
if (j <= i)
{
if ((i - j) <= profile(1, i))
return true;
else
return false;
return (i - j) <= profile(1, i);
}
else if ((j - i) <= profile(1, j))
return true;
@@ -298,10 +298,7 @@ static void AdvCompute(CPnts_AbscissaPoint& theComputer,
//=================================================================================================
GCPnts_AbscissaPoint::GCPnts_AbscissaPoint()
{
//
}
GCPnts_AbscissaPoint::GCPnts_AbscissaPoint() = default;
//=================================================================================================
@@ -26,7 +26,6 @@ GCPnts_QuasiUniformAbscissa::GCPnts_QuasiUniformAbscissa()
: myDone(false),
myNbPoints(0)
{
//
}
//=================================================================================================
@@ -476,7 +476,6 @@ GCPnts_QuasiUniformDeflection::GCPnts_QuasiUniformDeflection()
myDeflection(0.0),
myCont(GeomAbs_C1)
{
//
}
//=================================================================================================
@@ -225,7 +225,6 @@ GCPnts_UniformAbscissa::GCPnts_UniformAbscissa()
myNbPoints(0),
myAbscissa(0.0)
{
//
}
//=================================================================================================
@@ -40,7 +40,6 @@ GCPnts_UniformDeflection::GCPnts_UniformDeflection()
: myDone(false),
myDeflection(0.0)
{
//
}
//=================================================================================================
@@ -602,18 +602,15 @@ static bool NeedToBeTreated(const occ::handle<Geom2d_BSplineCurve>& BS)
if (BS->IsRational())
{
BS->Weights(tabWeights);
if ((BSplCLib::IsRational(tabWeights, 1, BS->NbPoles()))
&& ((BS->Weight(1) < (1 - Precision::Confusion()))
|| (BS->Weight(1) > (1 + Precision::Confusion()))
|| (BS->Weight(2) < (1 - Precision::Confusion()))
|| (BS->Weight(2) > (1 + Precision::Confusion()))
|| (BS->Weight(BS->NbPoles() - 1) < (1 - Precision::Confusion()))
|| (BS->Weight(BS->NbPoles() - 1) > (1 + Precision::Confusion()))
|| (BS->Weight(BS->NbPoles()) < (1 - Precision::Confusion()))
|| (BS->Weight(BS->NbPoles()) > (1 + Precision::Confusion()))))
return true;
else
return false;
return (BSplCLib::IsRational(tabWeights, 1, BS->NbPoles()))
&& ((BS->Weight(1) < (1 - Precision::Confusion()))
|| (BS->Weight(1) > (1 + Precision::Confusion()))
|| (BS->Weight(2) < (1 - Precision::Confusion()))
|| (BS->Weight(2) > (1 + Precision::Confusion()))
|| (BS->Weight(BS->NbPoles() - 1) < (1 - Precision::Confusion()))
|| (BS->Weight(BS->NbPoles() - 1) > (1 + Precision::Confusion()))
|| (BS->Weight(BS->NbPoles()) < (1 - Precision::Confusion()))
|| (BS->Weight(BS->NbPoles()) > (1 + Precision::Confusion())));
}
else
return false;
@@ -639,11 +636,8 @@ static bool Need2DegRepara(const NCollection_Array1<occ::handle<Geom2d_BSplineCu
tab(i)->D1(tab(i)->LastParameter(), Pint, Vec2);
Rapport = Rapport * Vec2.Magnitude() / Vec1.Magnitude();
}
if ((Rapport <= (1.0e0 + Precision::Confusion()))
&& (Rapport >= (1.0e0 - Precision::Confusion())))
return false;
else
return true;
return (Rapport > (1.0e0 + Precision::Confusion()))
|| (Rapport < (1.0e0 - Precision::Confusion()));
}
//=======================================================================
@@ -948,7 +942,7 @@ void Geom2dConvert::ConcatG1(
while (index <= nb_curve - 1)
{ // determination des caracteristiques du Wire
nb_vertexG1 = 0;
while (((index + nb_vertexG1) <= nb_curve - 2) && (tabG1(index + nb_vertexG1) == true))
while (((index + nb_vertexG1) <= nb_curve - 2) && (tabG1(index + nb_vertexG1)))
nb_vertexG1++;
nb_group++;
if (index == 0)
@@ -1082,7 +1076,7 @@ void Geom2dConvert::ConcatG1(
Geom2dConvert_CompCurveToBSplineCurve C(Curve2);
fusion = C.Add(Curve1,
local_tolerance(j - 1)); // fusion de deux courbes adjacentes
if (fusion == false)
if (!fusion)
throw Standard_ConstructionError("Geom2dConvert Concatenation Error");
Curve2 = C.BSplineCurve();
}
@@ -1098,7 +1092,7 @@ void Geom2dConvert::ConcatG1(
for (i=0;i<=nb_group-1;i++){ //boucle principale sur chaque groupe de
nb_vertexG1=0; //continuite interne G1
while (((index+nb_vertexG1)<=nb_curve-2)&&(tabG1(index+nb_vertexG1)==true))
while (((index+nb_vertexG1)<=nb_curve-2)&&(tabG1(index+nb_vertexG1)))
nb_vertexG1++;
for (j=index;j<=index+nb_vertexG1;j++){ //boucle secondaire a l'interieur de chaque groupe
@@ -1110,7 +1104,7 @@ void Geom2dConvert::ConcatG1(
Geom2dConvert_CompCurveToBSplineCurve C(ArrayOfConcatenated->Value(i));
fusion=C.Add(Curve1,ArrayOfToler(j-1)); //fusion de deux courbes adjacentes
// clang-format on
if (fusion == false)
if (!fusion)
throw Standard_ConstructionError("Geom2dConvert Concatenation Error");
ArrayOfConcatenated->SetValue(i, C.BSplineCurve());
}
@@ -1203,7 +1197,7 @@ void Geom2dConvert::ConcatC1(
while (index <= nb_curve - 1)
{ // determination des caracteristiques du Wire
nb_vertexG1 = 0;
while (((index + nb_vertexG1) <= nb_curve - 2) && (tabG1(index + nb_vertexG1) == true))
while (((index + nb_vertexG1) <= nb_curve - 2) && (tabG1(index + nb_vertexG1)))
nb_vertexG1++;
nb_group++;
if (index == 0)
@@ -1332,7 +1326,7 @@ void Geom2dConvert::ConcatC1(
Geom2dConvert_CompCurveToBSplineCurve C(Curve2);
fusion = C.Add(Curve1,
local_tolerance(j - 1)); // fusion de deux courbes adjacentes
if (fusion == false)
if (!fusion)
throw Standard_ConstructionError("Geom2dConvert Concatenation Error");
Curve2 = C.BSplineCurve();
}
@@ -1350,7 +1344,7 @@ void Geom2dConvert::ConcatC1(
// clang-format on
nb_vertexG1 = 0; // continuite interne G1
while (((index + nb_vertexG1) <= nb_curve - 2) && (tabG1(index + nb_vertexG1) == true))
while (((index + nb_vertexG1) <= nb_curve - 2) && (tabG1(index + nb_vertexG1)))
nb_vertexG1++;
if ((!ClosedFlag) || (nb_group == 1))
@@ -1384,7 +1378,7 @@ void Geom2dConvert::ConcatC1(
// clang-format off
fusion=C.Add(Curve1,ArrayOfToler(j-1)); //fusion de deux courbes adjacentes
// clang-format on
if (fusion == false)
if (!fusion)
throw Standard_ConstructionError("Geom2dConvert Concatenation Error");
ArrayOfConcatenated->SetValue(i, C.BSplineCurve());
}
@@ -1467,7 +1461,7 @@ void Geom2dConvert::C0BSplineToC1BSplineCurve(occ::handle<Geom2d_BSplineCurve>&
for (i = 1; i < ArrayOfConcatenated->Length(); i++)
{
fusion = C.Add(ArrayOfConcatenated->Value(i), tolerance, true);
if (fusion == false)
if (!fusion)
throw Standard_ConstructionError("Geom2dConvert Concatenation Error");
}
}
@@ -84,11 +84,11 @@ Geom2dConvert_ApproxArcsSegments::Geom2dConvert_ApproxArcsSegments(
// Create a couple of arcs of equal size.
const Geom2dConvert_PPoint aPP(.5 * (myExt[0].Parameter() + myExt[1].Parameter()), myCurve);
occ::handle<Geom2d_Curve> aCurve = makeCircle(myExt[0], aPP);
if (aCurve.IsNull() == false)
if (!aCurve.IsNull())
{
mySeqCurves.Append(aCurve);
aCurve = makeCircle(aPP, myExt[1]);
if (aCurve.IsNull() == false)
if (!aCurve.IsNull())
mySeqCurves.Append(aCurve);
}
}
@@ -100,7 +100,7 @@ Geom2dConvert_ApproxArcsSegments::Geom2dConvert_ApproxArcsSegments(
// Check status of the calculation
if (myStatus == StatusNotDone)
{
if (mySeqCurves.IsEmpty() == false)
if (!mySeqCurves.IsEmpty())
myStatus = StatusOK;
else
{
@@ -327,7 +327,7 @@ bool Geom2dConvert_ApproxArcsSegments::makeFreeform()
}
const occ::handle<Geom2d_Curve>& aCurve = aSeqLinearParts.Value((i + 1) / 2);
if (aCurve.IsNull() == false)
if (!aCurve.IsNull())
mySeqCurves.Append(aCurve);
else
{
@@ -454,7 +454,7 @@ void Geom2dConvert_ApproxArcsSegments::getLinearParts(
if (isInflectionPoint(aCurParam.Parameter(), aFirstInflParam, myCurve, myAngleTolerance))
{
aLastInflParam = mySeqParams(i);
while (isStillInflectionFirst == false)
while (!isStillInflectionFirst)
{
if (++indStartLinear >= i)
{
@@ -31,7 +31,6 @@ Geom2dConvert_CompCurveToBSplineCurve::Geom2dConvert_CompCurveToBSplineCurve(
: myTol(Precision::Confusion()),
myType(theParameterisation)
{
//
}
//=================================================================================================
@@ -615,18 +615,15 @@ static bool NeedToBeTreated(const occ::handle<Geom_BSplineCurve>& BS)
if (BS->IsRational())
{
BS->Weights(tabWeights);
if ((BSplCLib::IsRational(tabWeights, 1, BS->NbPoles()))
&& ((BS->Weight(1) < (1 - Precision::Confusion()))
|| (BS->Weight(1) > (1 + Precision::Confusion()))
|| (BS->Weight(2) < (1 - Precision::Confusion()))
|| (BS->Weight(2) > (1 + Precision::Confusion()))
|| (BS->Weight(BS->NbPoles() - 1) < (1 - Precision::Confusion()))
|| (BS->Weight(BS->NbPoles() - 1) > (1 + Precision::Confusion()))
|| (BS->Weight(BS->NbPoles()) < (1 - Precision::Confusion()))
|| (BS->Weight(BS->NbPoles()) > (1 + Precision::Confusion()))))
return true;
else
return false;
return (BSplCLib::IsRational(tabWeights, 1, BS->NbPoles()))
&& ((BS->Weight(1) < (1 - Precision::Confusion()))
|| (BS->Weight(1) > (1 + Precision::Confusion()))
|| (BS->Weight(2) < (1 - Precision::Confusion()))
|| (BS->Weight(2) > (1 + Precision::Confusion()))
|| (BS->Weight(BS->NbPoles() - 1) < (1 - Precision::Confusion()))
|| (BS->Weight(BS->NbPoles() - 1) > (1 + Precision::Confusion()))
|| (BS->Weight(BS->NbPoles()) < (1 - Precision::Confusion()))
|| (BS->Weight(BS->NbPoles()) > (1 + Precision::Confusion())));
}
else
return false;
@@ -652,11 +649,8 @@ static bool Need2DegRepara(const NCollection_Array1<occ::handle<Geom_BSplineCurv
tab(i)->D1(tab(i)->LastParameter(), Pint, Vec2);
Rapport = Rapport * Vec2.Magnitude() / Vec1.Magnitude();
}
if ((Rapport <= (1.0e0 + Precision::Confusion()))
&& (Rapport >= (1.0e0 - Precision::Confusion())))
return false;
else
return true;
return (Rapport > (1.0e0 + Precision::Confusion()))
|| (Rapport < (1.0e0 - Precision::Confusion()));
}
//=======================================================================
@@ -818,7 +812,7 @@ void GeomConvert::ConcatG1(
while (index <= nb_curve - 1)
{ // determination of the Wire features
nb_vertexG1 = 0;
while (((index + nb_vertexG1) <= nb_curve - 2) && (tabG1(index + nb_vertexG1) == true))
while (((index + nb_vertexG1) <= nb_curve - 2) && (tabG1(index + nb_vertexG1)))
nb_vertexG1++;
nb_group++;
if (index == 0)
@@ -936,7 +930,7 @@ void GeomConvert::ConcatG1(
GeomConvert_CompCurveToBSplineCurve C(Curve2);
fusion = C.Add(Curve1,
local_tolerance(j - 1)); // merge of two consecutive curves
if (fusion == false)
if (!fusion)
throw Standard_ConstructionError("GeomConvert Concatenation Error");
Curve2 = C.BSplineCurve();
}
@@ -953,7 +947,7 @@ void GeomConvert::ConcatG1(
// clang-format on
nb_vertexG1 = 0; // group
while (((index + nb_vertexG1) <= nb_curve - 2) && (tabG1(index + nb_vertexG1) == true))
while (((index + nb_vertexG1) <= nb_curve - 2) && (tabG1(index + nb_vertexG1)))
nb_vertexG1++;
for (j = index; j <= index + nb_vertexG1; j++)
@@ -968,7 +962,7 @@ void GeomConvert::ConcatG1(
// clang-format off
fusion=C.Add(Curve1,ArrayOfToler(j-1)); //merge of two consecutive curves
// clang-format on
if (fusion == false)
if (!fusion)
throw Standard_ConstructionError("GeomConvert Concatenation Error");
ArrayOfConcatenated->SetValue(i, C.BSplineCurve());
}
@@ -1056,7 +1050,7 @@ void GeomConvert::ConcatC1(
while (index <= nb_curve - 1)
{ // determination of the Wire features
nb_vertexG1 = 0;
while (((index + nb_vertexG1) <= nb_curve - 2) && (tabG1(index + nb_vertexG1) == true))
while (((index + nb_vertexG1) <= nb_curve - 2) && (tabG1(index + nb_vertexG1)))
nb_vertexG1++;
nb_group++;
if (index == 0)
@@ -1185,7 +1179,7 @@ void GeomConvert::ConcatC1(
GeomConvert_CompCurveToBSplineCurve C(Curve2);
fusion = C.Add(Curve1,
local_tolerance(j - 1)); // merge of two consecutive curves
if (fusion == false)
if (!fusion)
throw Standard_ConstructionError("GeomConvert Concatenation Error");
Curve2 = C.BSplineCurve();
}
@@ -1203,7 +1197,7 @@ void GeomConvert::ConcatC1(
// clang-format on
nb_vertexG1 = 0; // group
while (((index + nb_vertexG1) <= nb_curve - 2) && (tabG1(index + nb_vertexG1) == true))
while (((index + nb_vertexG1) <= nb_curve - 2) && (tabG1(index + nb_vertexG1)))
nb_vertexG1++;
if ((!ClosedG1Flag) || (nb_group == 1))
@@ -1235,7 +1229,7 @@ void GeomConvert::ConcatC1(
// Merge of two consecutive curves.
GeomConvert_CompCurveToBSplineCurve C(ArrayOfConcatenated->Value(i));
fusion = C.Add(Curve1, local_tolerance(j - 1), true);
if (fusion == false)
if (!fusion)
throw Standard_ConstructionError("GeomConvert Concatenation Error");
ArrayOfConcatenated->SetValue(i, C.BSplineCurve());
}
@@ -1264,7 +1258,7 @@ void GeomConvert::C0BSplineToC1BSplineCurve(occ::handle<Geom_BSplineCurve>& BS,
for (i = 1; i < ArrayOfConcatenated->Length(); i++)
{
fusion = C.Add(ArrayOfConcatenated->Value(i), tolerance);
if (fusion == false)
if (!fusion)
throw Standard_ConstructionError("GeomConvert Concatenation Error");
}
}
@@ -505,8 +505,8 @@ occ::handle<Geom_BSplineSurface> GeomConvert::SurfaceToBSplineSurface(
// if isUClosed = true and U trim does not coincide with first period of torus,
// method CheckAndSegment shifts position of U seam boundary of surface.
// probably bug? So, for this case we must build not periodic surface.
bool isUFirstPeriod = !(UFirst < 0. || ULast > 2. * M_PI);
bool isVFirstPeriod = !(VFirst < 0. || VLast > 2. * M_PI);
bool isUFirstPeriod = UFirst >= 0. && ULast <= 2. * M_PI;
bool isVFirstPeriod = VFirst >= 0. && VLast <= 2. * M_PI;
if (isUClosed && isUFirstPeriod)
{
Convert_TorusToBSplineSurface Convert(Tr, VFirst, VLast, false);
@@ -34,7 +34,6 @@ GeomConvert_CompCurveToBSplineCurve::GeomConvert_CompCurveToBSplineCurve(
: myTol(Precision::Confusion()),
myType(theParameterisation)
{
//
}
//=================================================================================================
@@ -146,10 +146,7 @@ static bool SignDenom(const NCollection_Array1<gp_Pnt2d>& Poles)
{
bool Result;
if (Poles(0).Y() < 0)
Result = false;
else
Result = true;
Result = Poles(0).Y() >= 0;
return Result;
}
@@ -476,14 +476,7 @@ void IntAna_IntConicQuad::Perform(const gp_Lin& L,
}
if (parallel)
{
if (std::abs(Dis) < Tolang)
{
inquadric = true;
}
else
{
inquadric = false;
}
inquadric = std::abs(Dis) < Tolang;
}
else
{
@@ -516,15 +509,8 @@ void IntAna_IntConicQuad::Perform(const gp_Circ& C,
{
parallel = true;
double distmax = P.Distance(C.Location()) + C.Radius() * Tolang;
if (distmax < Tol)
{
inquadric = true;
}
else
{
inquadric = false;
}
done = true;
inquadric = distmax < Tol;
done = true;
}
else if (IntP.TypeInter() == IntAna_Same)
{
@@ -460,7 +460,7 @@ void IntAna_IntQuadQuad::Perform(const gp_Cylinder& Cyl, const IntAna_Quadric& Q
MyTrigonometricFunction MTF(C_CC, C_SS, C_SC, C_C, C_S, C_1);
TrigonometricRoots PolDIS(C_CC - C_SS, C_SC, C_C + C_C, C_S + C_S, C_1 + C_SS, 0., PIpPI);
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if (PolDIS.IsDone() == false)
if (!PolDIS.IsDone())
{
done = false;
return;
@@ -721,7 +721,7 @@ void IntAna_IntQuadQuad::Perform(const gp_Cylinder& Cyl, const IntAna_Quadric& Q
}
}
for (i = 1; UnPtTg == (false) && (i <= nbsolDIS); i++)
for (i = 1; !UnPtTg && (i <= nbsolDIS); i++)
{
Theta1 = PolDIS.Value(i);
Theta2 = (i < nbsolDIS) ? PolDIS.Value(i + 1) : (PolDIS.Value(1) + PIpPI);
@@ -1434,7 +1434,7 @@ void IntAna_IntQuadQuad::InternalSetNextAndPrevious()
NotLastOpenC2 = !TheCurve[c2].IsLastOpen();
NotFirstOpenC2 = !TheCurve[c2].IsFirstOpen();
TheCurve[c2].Domain(DInfC2, DSupC2);
if (TheCurve[c1].IsFirstOpen() == false)
if (!TheCurve[c1].IsFirstOpen())
{
if (NotLastOpenC2)
{
@@ -1457,7 +1457,7 @@ void IntAna_IntQuadQuad::InternalSetNextAndPrevious()
}
}
}
if (TheCurve[c1].IsLastOpen() == false)
if (!TheCurve[c1].IsLastOpen())
{
if (NotLastOpenC2)
{
@@ -757,7 +757,7 @@ void IntAna_QuadQuadGeo::Perform(const gp_Pln& P,
dist = A * X + B * Y + C * Z + D; // distance signee sommet du cone/ Plan
gp_XYZ normp = P.Axis().Direction().XYZ();
if (P.Direct() == false)
if (!P.Direct())
{ //-- lbr le 14 jan 97
normp.Reverse();
}
@@ -994,7 +994,7 @@ void IntAna_QuadQuadGeo::Perform(const gp_Pln& P, const gp_Sphere& S)
typeres = IntAna_Circle;
pt1.SetCoord(X - dist * A, Y - dist * B, Z - dist * C);
dir1 = P.Axis().Direction();
if (P.Direct() == false)
if (!P.Direct())
dir1.Reverse();
dir2 = P.Position().XDirection();
param1 = std::sqrt(radius * radius - dist * dist);
@@ -1203,13 +1203,13 @@ void ProjLib_CompProjectedCurve::Perform()
occ::handle<Geom2d_Curve> PCur2d; // Only for isoparametric projection
occ::handle<Geom_Curve> PCur3d;
if (myProj2d == true)
if (myProj2d)
{
myResult2dPoint = new NCollection_HArray1<gp_Pnt2d>(1, myNbCurves);
myResult2dCurve = new NCollection_HArray1<occ::handle<Geom2d_Curve>>(1, myNbCurves);
}
if (myProj3d == true)
if (myProj3d)
{
myResult3dPoint = new NCollection_HArray1<gp_Pnt>(1, myNbCurves);
myResult3dCurve = new NCollection_HArray1<occ::handle<Geom_Curve>>(1, myNbCurves);
@@ -1232,11 +1232,11 @@ void ProjLib_CompProjectedCurve::Perform()
if (IsSinglePnt(k, P2d)) // Part k of the projection is punctual
{
GetSurface()->D0(P2d.X(), P2d.Y(), P);
if (myProj2d == true)
if (myProj2d)
{
myResult2dPoint->SetValue(k, P2d);
}
if (myProj3d == true)
if (myProj3d)
{
myResult3dPoint->SetValue(k, P);
}
@@ -1350,12 +1350,12 @@ void ProjLib_CompProjectedCurve::Perform()
}
}
if (myProj2d == true)
if (myProj2d)
{
myResult2dCurve->SetValue(k, PCur2d);
}
if (myProj3d == true)
if (myProj3d)
{
myResult3dCurve->SetValue(k, PCur3d);
}
@@ -95,7 +95,7 @@ struct PlaneProjector
// OFV:
static inline bool IsEqual(double Check, double With, double Toler)
{
return ((std::abs(Check - With) < Toler) ? true : false);
return (std::abs(Check - With) < Toler);
}
//=================================================================================================
@@ -408,11 +408,11 @@ static void Function_SetUVBounds(double& myU1,
isFirst = false;
} // for(double par = W1 + Step; par <= W2; par += Step)
if (!(std::abs(pmin - W1) <= Precision::PConfusion()
|| std::abs(pmin - W2) <= Precision::PConfusion()))
if (std::abs(pmin - W1) > Precision::PConfusion()
&& std::abs(pmin - W2) > Precision::PConfusion())
myU1 -= dmax * .5;
if (!(std::abs(pmax - W1) <= Precision::PConfusion()
|| std::abs(pmax - W2) <= Precision::PConfusion()))
if (std::abs(pmax - W1) > Precision::PConfusion()
&& std::abs(pmax - W2) > Precision::PConfusion())
myU2 += dmax * .5;
if ((myU1 >= 0. && myU1 <= 2 * M_PI) && (myU2 >= 0. && myU2 <= 2 * M_PI))
@@ -534,11 +534,11 @@ static void Function_SetUVBounds(double& myU1,
U1 = U;
}
if (!(std::abs(pmin - W1) <= Precision::PConfusion()
|| std::abs(pmin - W2) <= Precision::PConfusion()))
if (std::abs(pmin - W1) > Precision::PConfusion()
&& std::abs(pmin - W2) > Precision::PConfusion())
myU1 -= dmax * .5;
if (!(std::abs(pmax - W1) <= Precision::PConfusion()
|| std::abs(pmax - W2) <= Precision::PConfusion()))
if (std::abs(pmax - W1) > Precision::PConfusion()
&& std::abs(pmax - W2) > Precision::PConfusion())
myU2 += dmax * .5;
if ((myU1 >= 0. && myU1 <= 2 * M_PI) && (myU2 >= 0. && myU2 <= 2 * M_PI))
@@ -811,11 +811,11 @@ static void Function_SetUVBounds(double& myU1,
U1 = U;
}
if (!(std::abs(pmin - W1) <= Precision::PConfusion()
|| std::abs(pmin - W2) <= Precision::PConfusion()))
if (std::abs(pmin - W1) > Precision::PConfusion()
&& std::abs(pmin - W2) > Precision::PConfusion())
myU1 -= dmax * .5;
if (!(std::abs(pmax - W1) <= Precision::PConfusion()
|| std::abs(pmax - W2) <= Precision::PConfusion()))
if (std::abs(pmax - W1) > Precision::PConfusion()
&& std::abs(pmax - W2) > Precision::PConfusion())
myU2 += dmax * .5;
if ((myU1 >= 0. && myU1 <= 2 * M_PI) && (myU2 >= 0. && myU2 <= 2 * M_PI))
@@ -912,17 +912,17 @@ static void Function_SetUVBounds(double& myU1,
V1 = V;
}
if (!(std::abs(pminU - W1) <= Precision::PConfusion()
|| std::abs(pminU - W2) <= Precision::PConfusion()))
if (std::abs(pminU - W1) > Precision::PConfusion()
&& std::abs(pminU - W2) > Precision::PConfusion())
myU1 -= dmaxU * .5;
if (!(std::abs(pmaxU - W1) <= Precision::PConfusion()
|| std::abs(pmaxU - W2) <= Precision::PConfusion()))
if (std::abs(pmaxU - W1) > Precision::PConfusion()
&& std::abs(pmaxU - W2) > Precision::PConfusion())
myU2 += dmaxU * .5;
if (!(std::abs(pminV - W1) <= Precision::PConfusion()
|| std::abs(pminV - W2) <= Precision::PConfusion()))
if (std::abs(pminV - W1) > Precision::PConfusion()
&& std::abs(pminV - W2) > Precision::PConfusion())
myV1 -= dmaxV * .5;
if (!(std::abs(pmaxV - W1) <= Precision::PConfusion()
|| std::abs(pmaxV - W2) <= Precision::PConfusion()))
if (std::abs(pmaxV - W1) > Precision::PConfusion()
&& std::abs(pmaxV - W2) > Precision::PConfusion())
myV2 += dmaxV * .5;
if ((myU1 >= 0. && myU1 <= 2 * M_PI) && (myU2 >= 0. && myU2 <= 2 * M_PI))
@@ -64,7 +64,7 @@ gce_MakeCirc::gce_MakeCirc(const gp_Pnt& P1, const gp_Pnt& P2, const gp_Pnt& P3)
TheCirc = gp_Circ(gp_Ax2(P1, Dirx, Dirz), 0.);
return;
}
if (!(dist1 >= aResolution && dist2 >= aResolution))
if (dist1 < aResolution || dist2 < aResolution)
{
TheError = gce_ConfusedPoints;
return;
@@ -108,7 +108,7 @@ gce_MakeCirc2d::gce_MakeCirc2d(const gp_Pnt2d& P1, const gp_Pnt2d& P2, const gp_
double Alpha1 = ElCLib::Parameter(TheCirc2d, P1);
double Alpha2 = ElCLib::Parameter(TheCirc2d, P2);
double Alpha3 = ElCLib::Parameter(TheCirc2d, P3);
if (!((Alpha1 <= Alpha2) && (Alpha2 <= Alpha3)))
if ((Alpha1 > Alpha2) || (Alpha2 > Alpha3))
{
TheCirc2d.Reverse();
}