mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
Coding - Reorganize code with constexpr #68
After rework Precision.hxx some local variables can be marked as constexpr
This commit is contained in:
@@ -347,7 +347,7 @@ void IntPatch_GLine::AddVertex (const IntPatch_Point& Pnt)
|
||||
while(par<pf) par+=M_PI+M_PI;
|
||||
while(par>pl) par-=M_PI+M_PI;
|
||||
if(par<pf) {
|
||||
const Standard_Real PrecisionPConfusion ( Precision::PConfusion()*1000.0 );
|
||||
constexpr Standard_Real PrecisionPConfusion ( Precision::PConfusion()*1000.0 );
|
||||
if((pf-par)>PrecisionPConfusion) {
|
||||
return;
|
||||
}
|
||||
@@ -396,7 +396,7 @@ void IntPatch_GLine::ComputeVertexParameters(const Standard_Real /*Tol*/)
|
||||
|
||||
Standard_Integer nbvtx = NbVertex();
|
||||
|
||||
const Standard_Real PrecisionPConfusion ( Precision::PConfusion()*1000.0 );
|
||||
constexpr Standard_Real PrecisionPConfusion ( Precision::PConfusion()*1000.0 );
|
||||
|
||||
do {
|
||||
APointDeleted = Standard_False;
|
||||
|
@@ -2665,9 +2665,9 @@ static Standard_Boolean DecomposeResult(const Handle(IntPatch_PointLine)& theLin
|
||||
}
|
||||
|
||||
const Standard_Real aDeltaUmax = M_PI_2;
|
||||
const Standard_Real aTOL3D = 1.e-10,
|
||||
aTOL2D = Precision::PConfusion(),
|
||||
aTOL2DS = Precision::PConfusion();
|
||||
constexpr Standard_Real aTOL3D = 1.e-10,
|
||||
aTOL2D = Precision::PConfusion(),
|
||||
aTOL2DS = Precision::PConfusion();
|
||||
|
||||
const Handle(IntSurf_LineOn2S)& aSLine = theLine->Curve();
|
||||
|
||||
@@ -2801,7 +2801,7 @@ static Standard_Boolean DecomposeResult(const Handle(IntPatch_PointLine)& theLin
|
||||
////
|
||||
const IntSurf_PntOn2S& aRefPt = aSSLine->Value(aBindex-1);
|
||||
|
||||
Standard_Real aCompareTol3D = Precision::Confusion();
|
||||
constexpr Standard_Real aCompareTol3D = Precision::Confusion();
|
||||
Standard_Real aCompareTol2D = Precision::PConfusion();
|
||||
|
||||
IntSurf_PntOn2S aNewPoint = aRefPt;
|
||||
|
@@ -1801,7 +1801,7 @@ Standard_Boolean IntPatch_Intersection::CheckSingularPoints(
|
||||
}
|
||||
//
|
||||
const Standard_Integer aNbBndPnts = 5;
|
||||
const Standard_Real aTol = Precision::Confusion();
|
||||
constexpr Standard_Real aTol = Precision::Confusion();
|
||||
Standard_Integer i;
|
||||
theD1->Init();
|
||||
Standard_Boolean isU = Standard_True;
|
||||
@@ -1847,7 +1847,7 @@ Standard_Boolean IntPatch_Intersection::CheckSingularPoints(
|
||||
//Singular point aPP1;
|
||||
aPmid /= aNb;
|
||||
aPP1.SetXYZ(aPmid);
|
||||
Standard_Real aTolU = Precision::PConfusion(), aTolV = Precision::PConfusion();
|
||||
constexpr Standard_Real aTolU = Precision::PConfusion(), aTolV = Precision::PConfusion();
|
||||
Extrema_ExtPS aProj(aPP1, *theS2.get(), aTolU, aTolV, Extrema_ExtFlag_MIN);
|
||||
|
||||
if (aProj.IsDone())
|
||||
@@ -1883,7 +1883,7 @@ Standard_Real IntPatch_Intersection::DefineUVMaxStep(
|
||||
Standard_Real anUVMaxStep = 0.001;
|
||||
Standard_Real aDistToSing1 = Precision::Infinite();
|
||||
Standard_Real aDistToSing2 = Precision::Infinite();
|
||||
const Standard_Real aTolMin = Precision::Confusion(), aTolMax = 1.e-5;
|
||||
constexpr Standard_Real aTolMin = Precision::Confusion(), aTolMax = 1.e-5;
|
||||
if (theS1 != theS2)
|
||||
{
|
||||
Standard_Boolean isSing1 = CheckSingularPoints(theS1, theD1, theS2, aDistToSing1);
|
||||
|
@@ -49,8 +49,8 @@ Standard_Real IntPatch_PointLine::
|
||||
const Handle(Adaptor3d_Surface)& theS2,
|
||||
const IntSurf_PntOn2S& theUVPoint)
|
||||
{
|
||||
const Standard_Real aSmallValue = 1.0/Precision::Infinite();
|
||||
const Standard_Real aSqSmallValue = aSmallValue*aSmallValue;
|
||||
constexpr Standard_Real aSmallValue = 1.0/Precision::Infinite();
|
||||
constexpr Standard_Real aSqSmallValue = aSmallValue*aSmallValue;
|
||||
|
||||
Standard_Real aU1 = 0.0, aV1 = 0.0, aU2 = 0.0, aV2 = 0.0;
|
||||
theUVPoint.Parameters(aU1, aV1, aU2, aV2);
|
||||
|
@@ -1592,7 +1592,7 @@ void IntPatch_PrmPrmIntersection::Perform (const Handle(Adaptor3d_Surface)& S
|
||||
if (Surf1->IsUClosed() || Surf1->IsVClosed() ||
|
||||
Surf2->IsUClosed() || Surf2->IsVClosed())
|
||||
{
|
||||
Standard_Real TolPar = Precision::PConfusion();
|
||||
constexpr Standard_Real TolPar = Precision::PConfusion();
|
||||
IntSurf_ListOfPntOn2S AdditionalPnts;
|
||||
Standard_Real NewU1, NewV1, NewU2, NewV2;
|
||||
for(; IterLOP1.More(); IterLOP1.Next())
|
||||
|
@@ -464,7 +464,7 @@ void IntPatch_WLine::ComputeVertexParameters( const Standard_Real RTol)
|
||||
|
||||
//----------------------------------------------------
|
||||
//-- On detecte les points confondus dans la LineOn2S
|
||||
Standard_Real dmini = Precision::SquareConfusion();
|
||||
constexpr Standard_Real dmini = Precision::SquareConfusion();
|
||||
for(i=2; (i<=nbponline) && (nbponline > 2); i++) {
|
||||
const IntSurf_PntOn2S& aPnt1=curv->Value(i-1);
|
||||
const IntSurf_PntOn2S& aPnt2=curv->Value(i);
|
||||
|
@@ -445,7 +445,7 @@ static Handle(IntPatch_WLine)
|
||||
Standard_Real aPrevStep = aBase3dVec.SquareMagnitude();
|
||||
|
||||
// Choose base tolerance and scale it to pipe algorithm.
|
||||
const Standard_Real aBaseTolerance = Precision::Approximation();
|
||||
constexpr Standard_Real aBaseTolerance = Precision::Approximation();
|
||||
Standard_Real aResS1Tol = Min(theS1->UResolution(aBaseTolerance),
|
||||
theS1->VResolution(aBaseTolerance));
|
||||
Standard_Real aResS2Tol = Min(theS2->UResolution(aBaseTolerance),
|
||||
|
Reference in New Issue
Block a user