mirror of
https://github.com/Open-Cascade-SAS/OCCT.git
synced 2026-06-23 20:48:40 +08:00
Coding - Rework of Math global functions to stl (#833)
Majority of functions now simply call same functions from std namespace. Functions that duplicate std namespace functionality are declared deprecated. Calls of deprecated functions are replaced with std functions calls.
This commit is contained in:
@@ -108,8 +108,8 @@ Handle(Geom_BSplineCurve) GeomConvert::SplitBSplineCurve(const Handle(Geom_BSpli
|
||||
Standard_Integer TheLast = C->LastUKnotIndex();
|
||||
if (FromK1 == ToK2)
|
||||
throw Standard_DomainError();
|
||||
Standard_Integer FirstK = Min(FromK1, ToK2);
|
||||
Standard_Integer LastK = Max(FromK1, ToK2);
|
||||
Standard_Integer FirstK = std::min(FromK1, ToK2);
|
||||
Standard_Integer LastK = std::max(FromK1, ToK2);
|
||||
if (FirstK < TheFirst || LastK > TheLast)
|
||||
throw Standard_DomainError();
|
||||
|
||||
@@ -139,8 +139,8 @@ Handle(Geom_BSplineCurve) GeomConvert::SplitBSplineCurve(
|
||||
const Standard_Real, // ParametricTolerance,
|
||||
const Standard_Boolean SameOrientation)
|
||||
{
|
||||
Standard_Real FirstU = Min(FromU1, ToU2);
|
||||
Standard_Real LastU = Max(FromU1, ToU2);
|
||||
Standard_Real FirstU = std::min(FromU1, ToU2);
|
||||
Standard_Real LastU = std::max(FromU1, ToU2);
|
||||
|
||||
Handle(Geom_BSplineCurve) C1 = Handle(Geom_BSplineCurve)::DownCast(C->Copy());
|
||||
|
||||
@@ -330,7 +330,8 @@ Handle(Geom_BSplineCurve) GeomConvert::CurveToBSplineCurve(
|
||||
Standard_Real Uf = TheCurve->FirstParameter();
|
||||
Standard_Real Ul = TheCurve->LastParameter();
|
||||
ElCLib::AdjustPeriodic(Uf, Ul, Precision::Confusion(), U1, U2);
|
||||
if (Abs(U1 - Uf) <= Precision::Confusion() && Abs(U2 - Ul) <= Precision::Confusion())
|
||||
if (std::abs(U1 - Uf) <= Precision::Confusion()
|
||||
&& std::abs(U2 - Ul) <= Precision::Confusion())
|
||||
TheCurve->SetNotPeriodic();
|
||||
}
|
||||
///////////////////////////////////////////////
|
||||
@@ -889,9 +890,8 @@ void GeomConvert::ConcatG1(TColGeom_Array1OfBSplineCurve& ArrayOfCurves
|
||||
KnotC1(1) = 0.0;
|
||||
for (ii = 2; ii <= KnotC1.Length(); ii++)
|
||||
{
|
||||
// KnotC1(ii)=(-b+Abs(a)/a*Sqrt(b*b-4*a*(c-KnotC1(ii))))/(2*a);
|
||||
KnotC1(ii) =
|
||||
(-b + Sqrt(b * b - 4 * a * (c - KnotC1(ii)))) / (2 * a); // ifv 17.05.00 buc60667
|
||||
(-b + std::sqrt(b * b - 4 * a * (c - KnotC1(ii)))) / (2 * a); // ifv 17.05.00 buc60667
|
||||
}
|
||||
TColgp_Array1OfPnt Curve1Poles(1, Curve1->NbPoles());
|
||||
Curve1->Poles(Curve1Poles);
|
||||
@@ -1139,9 +1139,8 @@ void GeomConvert::ConcatC1(TColGeom_Array1OfBSplineCurve& ArrayOfCurves
|
||||
KnotC1(1) = 0.0;
|
||||
for (ii = 2; ii <= KnotC1.Length(); ii++)
|
||||
{
|
||||
// KnotC1(ii)=(-b+Abs(a)/a*Sqrt(b*b-4*a*(c-KnotC1(ii))))/(2*a);
|
||||
KnotC1(ii) =
|
||||
(-b + Sqrt(b * b - 4 * a * (c - KnotC1(ii)))) / (2 * a); // ifv 17.05.00 buc60667
|
||||
(-b + std::sqrt(b * b - 4 * a * (c - KnotC1(ii)))) / (2 * a); // ifv 17.05.00 buc60667
|
||||
}
|
||||
TColgp_Array1OfPnt Curve1Poles(1, Curve1->NbPoles());
|
||||
Curve1->Poles(Curve1Poles);
|
||||
|
||||
@@ -129,10 +129,10 @@ Handle(Geom_BSplineSurface) GeomConvert::SplitBSplineSurface(
|
||||
Standard_Integer LastV = S->LastVKnotIndex();
|
||||
if (FromUK1 == ToUK2 || FromVK1 == ToVK2)
|
||||
throw Standard_DomainError();
|
||||
Standard_Integer FirstUK = Min(FromUK1, ToUK2);
|
||||
Standard_Integer LastUK = Max(FromUK1, ToUK2);
|
||||
Standard_Integer FirstVK = Min(FromVK1, ToVK2);
|
||||
Standard_Integer LastVK = Max(FromVK1, ToVK2);
|
||||
Standard_Integer FirstUK = std::min(FromUK1, ToUK2);
|
||||
Standard_Integer LastUK = std::max(FromUK1, ToUK2);
|
||||
Standard_Integer FirstVK = std::min(FromVK1, ToVK2);
|
||||
Standard_Integer LastVK = std::max(FromVK1, ToVK2);
|
||||
if (FirstUK < FirstU || LastUK > LastU || FirstVK < FirstV || LastVK > LastV)
|
||||
{
|
||||
throw Standard_DomainError();
|
||||
@@ -183,8 +183,8 @@ Handle(Geom_BSplineSurface) GeomConvert::SplitBSplineSurface(const Handle(Geom_B
|
||||
|
||||
Standard_Integer FirstU = S->FirstUKnotIndex();
|
||||
Standard_Integer LastU = S->LastUKnotIndex();
|
||||
Standard_Integer FirstUK = Min(FromK1, ToK2);
|
||||
Standard_Integer LastUK = Max(FromK1, ToK2);
|
||||
Standard_Integer FirstUK = std::min(FromK1, ToK2);
|
||||
Standard_Integer LastUK = std::max(FromK1, ToK2);
|
||||
if (FirstUK < FirstU || LastUK > LastU)
|
||||
throw Standard_DomainError();
|
||||
|
||||
@@ -209,8 +209,8 @@ Handle(Geom_BSplineSurface) GeomConvert::SplitBSplineSurface(const Handle(Geom_B
|
||||
|
||||
Standard_Integer FirstV = S->FirstVKnotIndex();
|
||||
Standard_Integer LastV = S->LastVKnotIndex();
|
||||
Standard_Integer FirstVK = Min(FromK1, ToK2);
|
||||
Standard_Integer LastVK = Max(FromK1, ToK2);
|
||||
Standard_Integer FirstVK = std::min(FromK1, ToK2);
|
||||
Standard_Integer LastVK = std::max(FromK1, ToK2);
|
||||
if (FirstVK < FirstV || LastVK > LastV)
|
||||
throw Standard_DomainError();
|
||||
|
||||
@@ -246,10 +246,10 @@ Handle(Geom_BSplineSurface) GeomConvert::SplitBSplineSurface(
|
||||
const Standard_Boolean SameUOrientation,
|
||||
const Standard_Boolean SameVOrientation)
|
||||
{
|
||||
Standard_Real FirstU = Min(FromU1, ToU2);
|
||||
Standard_Real LastU = Max(FromU1, ToU2);
|
||||
Standard_Real FirstV = Min(FromV1, ToV2);
|
||||
Standard_Real LastV = Max(FromV1, ToV2);
|
||||
Standard_Real FirstU = std::min(FromU1, ToU2);
|
||||
Standard_Real LastU = std::max(FromU1, ToU2);
|
||||
Standard_Real FirstV = std::min(FromV1, ToV2);
|
||||
Standard_Real LastV = std::max(FromV1, ToV2);
|
||||
|
||||
Handle(Geom_BSplineSurface) NewSurface = Handle(Geom_BSplineSurface)::DownCast(S->Copy());
|
||||
|
||||
@@ -288,7 +288,7 @@ Handle(Geom_BSplineSurface) GeomConvert::SplitBSplineSurface(
|
||||
const Standard_Real ParametricTolerance,
|
||||
const Standard_Boolean SameOrientation)
|
||||
{
|
||||
if (Abs(FromParam1 - ToParam2) <= Abs(ParametricTolerance))
|
||||
if (std::abs(FromParam1 - ToParam2) <= std::abs(ParametricTolerance))
|
||||
{
|
||||
throw Standard_DomainError();
|
||||
}
|
||||
@@ -296,8 +296,8 @@ Handle(Geom_BSplineSurface) GeomConvert::SplitBSplineSurface(
|
||||
|
||||
if (USplit)
|
||||
{
|
||||
Standard_Real FirstU = Min(FromParam1, ToParam2);
|
||||
Standard_Real LastU = Max(FromParam1, ToParam2);
|
||||
Standard_Real FirstU = std::min(FromParam1, ToParam2);
|
||||
Standard_Real LastU = std::max(FromParam1, ToParam2);
|
||||
Standard_Real FirstV = S->VKnot(S->FirstVKnotIndex());
|
||||
Standard_Real LastV = S->VKnot(S->LastVKnotIndex());
|
||||
|
||||
@@ -318,8 +318,8 @@ Handle(Geom_BSplineSurface) GeomConvert::SplitBSplineSurface(
|
||||
{
|
||||
Standard_Real FirstU = S->UKnot(S->FirstUKnotIndex());
|
||||
Standard_Real LastU = S->UKnot(S->LastUKnotIndex());
|
||||
Standard_Real FirstV = Min(FromParam1, ToParam2);
|
||||
Standard_Real LastV = Max(FromParam1, ToParam2);
|
||||
Standard_Real FirstV = std::min(FromParam1, ToParam2);
|
||||
Standard_Real LastV = std::max(FromParam1, ToParam2);
|
||||
|
||||
NewSurface->Segment(FirstU, LastU, FirstV, LastV);
|
||||
|
||||
@@ -344,10 +344,10 @@ Handle(Geom_BSplineSurface) GeomConvert::SurfaceToBSplineSurface(const Handle(Ge
|
||||
|
||||
Standard_Real U1, U2, V1, V2;
|
||||
Sr->Bounds(U1, U2, V1, V2);
|
||||
Standard_Real UFirst = Min(U1, U2);
|
||||
Standard_Real ULast = Max(U1, U2);
|
||||
Standard_Real VFirst = Min(V1, V2);
|
||||
Standard_Real VLast = Max(V1, V2);
|
||||
Standard_Real UFirst = std::min(U1, U2);
|
||||
Standard_Real ULast = std::max(U1, U2);
|
||||
Standard_Real VFirst = std::min(V1, V2);
|
||||
Standard_Real VLast = std::max(V1, V2);
|
||||
|
||||
// If the surface Sr is infinite stop the computation
|
||||
if (Precision::IsNegativeInfinite(UFirst) || Precision::IsPositiveInfinite(ULast)
|
||||
@@ -401,8 +401,9 @@ Handle(Geom_BSplineSurface) GeomConvert::SurfaceToBSplineSurface(const Handle(Ge
|
||||
}
|
||||
//
|
||||
// For cylinders, cones, spheres, toruses
|
||||
const Standard_Boolean isUClosed = Abs((ULast - UFirst) - 2. * M_PI) <= Precision::PConfusion();
|
||||
const Standard_Real eps = 100. * Epsilon(2. * M_PI);
|
||||
const Standard_Boolean isUClosed =
|
||||
std::abs((ULast - UFirst) - 2. * M_PI) <= Precision::PConfusion();
|
||||
const Standard_Real eps = 100. * Epsilon(2. * M_PI);
|
||||
//
|
||||
if (Surf->IsKind(STANDARD_TYPE(Geom_Plane)))
|
||||
{
|
||||
@@ -437,7 +438,8 @@ Handle(Geom_BSplineSurface) GeomConvert::SurfaceToBSplineSurface(const Handle(Ge
|
||||
Convert_CylinderToBSplineSurface Convert(Cyl, VFirst, VLast);
|
||||
TheSurface = BSplineSurfaceBuilder(Convert);
|
||||
Standard_Integer aNbK = TheSurface->NbUKnots();
|
||||
if (Abs(TheSurface->UKnot(1) - UFirst) > eps || Abs(TheSurface->UKnot(aNbK) - ULast) > eps)
|
||||
if (std::abs(TheSurface->UKnot(1) - UFirst) > eps
|
||||
|| std::abs(TheSurface->UKnot(aNbK) - ULast) > eps)
|
||||
{
|
||||
TheSurface->CheckAndSegment(UFirst, ULast, VFirst, VLast);
|
||||
}
|
||||
@@ -458,7 +460,8 @@ Handle(Geom_BSplineSurface) GeomConvert::SurfaceToBSplineSurface(const Handle(Ge
|
||||
Convert_ConeToBSplineSurface Convert(Co, VFirst, VLast);
|
||||
TheSurface = BSplineSurfaceBuilder(Convert);
|
||||
Standard_Integer aNbK = TheSurface->NbUKnots();
|
||||
if (Abs(TheSurface->UKnot(1) - UFirst) > eps || Abs(TheSurface->UKnot(aNbK) - ULast) > eps)
|
||||
if (std::abs(TheSurface->UKnot(1) - UFirst) > eps
|
||||
|| std::abs(TheSurface->UKnot(aNbK) - ULast) > eps)
|
||||
{
|
||||
TheSurface->CheckAndSegment(UFirst, ULast, VFirst, VLast);
|
||||
}
|
||||
@@ -482,7 +485,8 @@ Handle(Geom_BSplineSurface) GeomConvert::SurfaceToBSplineSurface(const Handle(Ge
|
||||
Convert_SphereToBSplineSurface Convert(Sph, VFirst, VLast, Standard_False);
|
||||
TheSurface = BSplineSurfaceBuilder(Convert);
|
||||
Standard_Integer aNbK = TheSurface->NbUKnots();
|
||||
if (Abs(TheSurface->UKnot(1) - UFirst) > eps || Abs(TheSurface->UKnot(aNbK) - ULast) > eps)
|
||||
if (std::abs(TheSurface->UKnot(1) - UFirst) > eps
|
||||
|| std::abs(TheSurface->UKnot(aNbK) - ULast) > eps)
|
||||
{
|
||||
TheSurface->CheckAndSegment(UFirst, ULast, VFirst, VLast);
|
||||
}
|
||||
@@ -510,7 +514,8 @@ Handle(Geom_BSplineSurface) GeomConvert::SurfaceToBSplineSurface(const Handle(Ge
|
||||
Convert_TorusToBSplineSurface Convert(Tr, VFirst, VLast, Standard_False);
|
||||
TheSurface = BSplineSurfaceBuilder(Convert);
|
||||
Standard_Integer aNbK = TheSurface->NbUKnots();
|
||||
if (Abs(TheSurface->UKnot(1) - UFirst) > eps || Abs(TheSurface->UKnot(aNbK) - ULast) > eps)
|
||||
if (std::abs(TheSurface->UKnot(1) - UFirst) > eps
|
||||
|| std::abs(TheSurface->UKnot(aNbK) - ULast) > eps)
|
||||
{
|
||||
TheSurface->CheckAndSegment(UFirst, ULast, VFirst, VLast);
|
||||
}
|
||||
@@ -520,7 +525,8 @@ Handle(Geom_BSplineSurface) GeomConvert::SurfaceToBSplineSurface(const Handle(Ge
|
||||
Convert_TorusToBSplineSurface Convert(Tr, UFirst, ULast);
|
||||
TheSurface = BSplineSurfaceBuilder(Convert);
|
||||
Standard_Integer aNbK = TheSurface->NbVKnots();
|
||||
if (Abs(TheSurface->VKnot(1) - VFirst) > eps || Abs(TheSurface->VKnot(aNbK) - VLast) > eps)
|
||||
if (std::abs(TheSurface->VKnot(1) - VFirst) > eps
|
||||
|| std::abs(TheSurface->VKnot(aNbK) - VLast) > eps)
|
||||
{
|
||||
TheSurface->CheckAndSegment(UFirst, ULast, VFirst, VLast);
|
||||
}
|
||||
@@ -573,7 +579,7 @@ Handle(Geom_BSplineSurface) GeomConvert::SurfaceToBSplineSurface(const Handle(Ge
|
||||
else
|
||||
{
|
||||
// Nombre de spans : ouverture maximale = 150 degres ( = PI / 1.2 rds)
|
||||
nbUSpans = (Standard_Integer)IntegerPart(1.2 * (ULast - UFirst) / M_PI) + 1;
|
||||
nbUSpans = (Standard_Integer)std::trunc(1.2 * (ULast - UFirst) / M_PI) + 1;
|
||||
AlfaU = (ULast - UFirst) / (nbUSpans * 2);
|
||||
NbUPoles = 2 * nbUSpans + 1;
|
||||
NbUKnots = nbUSpans + 1;
|
||||
@@ -613,7 +619,7 @@ Handle(Geom_BSplineSurface) GeomConvert::SurfaceToBSplineSurface(const Handle(Ge
|
||||
}
|
||||
}
|
||||
gp_GTrsf Aff;
|
||||
Aff.SetAffinity(Revol->Axis(), 1 / Cos(AlfaU));
|
||||
Aff.SetAffinity(Revol->Axis(), 1 / std::cos(AlfaU));
|
||||
gp_XYZ coord;
|
||||
for (j = 1; j <= NbVPoles; j++)
|
||||
{
|
||||
@@ -627,7 +633,7 @@ Handle(Geom_BSplineSurface) GeomConvert::SurfaceToBSplineSurface(const Handle(Ge
|
||||
for (j = 1; j <= NbVPoles; j++)
|
||||
{
|
||||
NewPoles(i, j) = Poles(j).Transformed(Trsf);
|
||||
NewWeights(i, j) = Weights(j) * Cos(AlfaU);
|
||||
NewWeights(i, j) = Weights(j) * std::cos(AlfaU);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -850,7 +856,7 @@ Handle(Geom_BSplineSurface) GeomConvert::SurfaceToBSplineSurface(const Handle(Ge
|
||||
}
|
||||
}
|
||||
gp_GTrsf Aff;
|
||||
Aff.SetAffinity(Revol->Axis(), 1 / Cos(AlfaU));
|
||||
Aff.SetAffinity(Revol->Axis(), 1 / std::cos(AlfaU));
|
||||
gp_XYZ coord;
|
||||
for (j = 1; j <= NbVPoles; j++)
|
||||
{
|
||||
@@ -864,7 +870,7 @@ Handle(Geom_BSplineSurface) GeomConvert::SurfaceToBSplineSurface(const Handle(Ge
|
||||
for (j = 1; j <= NbVPoles; j++)
|
||||
{
|
||||
NewPoles(i, j) = Poles(j).Transformed(Trsf);
|
||||
NewWeights(i, j) = Weights(j) * Cos(AlfaU);
|
||||
NewWeights(i, j) = Weights(j) * std::cos(AlfaU);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -131,7 +131,7 @@ void GeomConvert_CompCurveToBSplineCurve::Add(Handle(Geom_BSplineCurve)& FirstCu
|
||||
const Standard_Integer MinM)
|
||||
{
|
||||
// Harmonisation des degres.
|
||||
Standard_Integer Deg = Max(FirstCurve->Degree(), SecondCurve->Degree());
|
||||
Standard_Integer Deg = std::max(FirstCurve->Degree(), SecondCurve->Degree());
|
||||
if (FirstCurve->Degree() < Deg)
|
||||
{
|
||||
FirstCurve->IncreaseDegree(Deg);
|
||||
@@ -192,7 +192,7 @@ void GeomConvert_CompCurveToBSplineCurve::Add(Handle(Geom_BSplineCurve)& FirstCu
|
||||
Noeuds(ii) = Ratio1 * FirstCurve->Knot(ii) - Delta1;
|
||||
if (ii > 1)
|
||||
{
|
||||
eps = Epsilon(Abs(Noeuds(ii - 1)));
|
||||
eps = Epsilon(std::abs(Noeuds(ii - 1)));
|
||||
if (eps < 5.e-10)
|
||||
eps = 5.e-10;
|
||||
if (Noeuds(ii) - Noeuds(ii - 1) <= eps)
|
||||
@@ -206,7 +206,7 @@ void GeomConvert_CompCurveToBSplineCurve::Add(Handle(Geom_BSplineCurve)& FirstCu
|
||||
for (ii = 2, jj = NbK1 + 1; ii <= NbK2; ii++, jj++)
|
||||
{
|
||||
Noeuds(jj) = Ratio2 * SecondCurve->Knot(ii) - Delta2;
|
||||
eps = Epsilon(Abs(Noeuds(jj - 1)));
|
||||
eps = Epsilon(std::abs(Noeuds(jj - 1)));
|
||||
if (eps < 5.e-10)
|
||||
eps = 5.e-10;
|
||||
if (Noeuds(jj) - Noeuds(jj - 1) <= eps)
|
||||
|
||||
@@ -230,12 +230,12 @@ Standard_Boolean GeomConvert_CurveToAnaCurve::GetCircle(gp_Circ& crc,
|
||||
const gp_Pnt& P2)
|
||||
{
|
||||
// Control if points are not aligned (should be done by MakeCirc
|
||||
Standard_Real aMaxCoord = Sqrt(Precision::Infinite());
|
||||
if (Abs(P0.X()) > aMaxCoord || Abs(P0.Y()) > aMaxCoord || Abs(P0.Z()) > aMaxCoord)
|
||||
Standard_Real aMaxCoord = std::sqrt(Precision::Infinite());
|
||||
if (std::abs(P0.X()) > aMaxCoord || std::abs(P0.Y()) > aMaxCoord || std::abs(P0.Z()) > aMaxCoord)
|
||||
return Standard_False;
|
||||
if (Abs(P1.X()) > aMaxCoord || Abs(P1.Y()) > aMaxCoord || Abs(P1.Z()) > aMaxCoord)
|
||||
if (std::abs(P1.X()) > aMaxCoord || std::abs(P1.Y()) > aMaxCoord || std::abs(P1.Z()) > aMaxCoord)
|
||||
return Standard_False;
|
||||
if (Abs(P2.X()) > aMaxCoord || Abs(P2.Y()) > aMaxCoord || Abs(P2.Z()) > aMaxCoord)
|
||||
if (std::abs(P2.X()) > aMaxCoord || std::abs(P2.Y()) > aMaxCoord || std::abs(P2.Z()) > aMaxCoord)
|
||||
return Standard_False;
|
||||
|
||||
// Building the circle
|
||||
@@ -309,7 +309,7 @@ Handle(Geom_Curve) GeomConvert_CurveToAnaCurve::ComputeCircle(const Handle(Geom_
|
||||
|
||||
// first parameter should be closed to zero
|
||||
|
||||
if (Abs(cf) < Precision::PConfusion() || Abs(PI2 - cf) < Precision::PConfusion())
|
||||
if (std::abs(cf) < Precision::PConfusion() || std::abs(PI2 - cf) < Precision::PConfusion())
|
||||
cf = 0.;
|
||||
|
||||
Standard_Real cm = ElCLib::Parameter(crc, c3d->Value((c1 + c2) / 2.));
|
||||
@@ -424,14 +424,14 @@ static Standard_Boolean ConicDefinition(const Standard_Real a,
|
||||
Standard_Real cos2t;
|
||||
Standard_Real auxil;
|
||||
|
||||
if (Abs(term2) <= eps && Abs(term1) <= eps)
|
||||
if (std::abs(term2) <= eps && std::abs(term1) <= eps)
|
||||
{
|
||||
cos2t = 1.;
|
||||
auxil = 0.;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Abs(term1) < eps)
|
||||
if (std::abs(term1) < eps)
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
@@ -446,7 +446,7 @@ static Standard_Boolean ConicDefinition(const Standard_Real a,
|
||||
Standard_Real aprim = (a + c + auxil) / 2.;
|
||||
Standard_Real cprim = (a + c - auxil) / 2.;
|
||||
|
||||
if (Abs(aprim) < gp::Resolution() || Abs(cprim) < gp::Resolution())
|
||||
if (std::abs(aprim) < gp::Resolution() || std::abs(cprim) < gp::Resolution())
|
||||
return Standard_False;
|
||||
|
||||
term1 = -gdet / (aprim * pdet);
|
||||
@@ -548,8 +548,8 @@ Handle(Geom_Curve) GeomConvert_CurveToAnaCurve::ComputeEllipse(const Handle(Geom
|
||||
if (!IsArrayPntPlanar(AP, ndir, prec))
|
||||
return res;
|
||||
|
||||
if (Abs(ndir.X()) < gp::Resolution() && Abs(ndir.Y()) < gp::Resolution()
|
||||
&& Abs(ndir.Z()) < gp::Resolution())
|
||||
if (std::abs(ndir.X()) < gp::Resolution() && std::abs(ndir.Y()) < gp::Resolution()
|
||||
&& std::abs(ndir.Z()) < gp::Resolution())
|
||||
return res;
|
||||
|
||||
gp_Ax3 AX(gp_Pnt(0, 0, 0), ndir);
|
||||
@@ -644,7 +644,7 @@ Handle(Geom_Curve) GeomConvert_CurveToAnaCurve::ComputeEllipse(const Handle(Geom
|
||||
|
||||
// first parameter should be closed to zero
|
||||
|
||||
if (Abs(cf) < Precision::PConfusion() || Abs(PI2 - cf) < Precision::PConfusion())
|
||||
if (std::abs(cf) < Precision::PConfusion() || std::abs(PI2 - cf) < Precision::PConfusion())
|
||||
cf = 0.;
|
||||
|
||||
Standard_Real cm = ElCLib::Parameter(anEllipse, c3d->Value((c1 + c2) / 2.));
|
||||
@@ -772,12 +772,12 @@ Handle(Geom_Curve) GeomConvert_CurveToAnaCurve::ComputeCurve(const Handle(Geom_C
|
||||
{
|
||||
d[0] = RealLast();
|
||||
newc3d[0] = ComputeLine(c3d, tolerance, c1, c2, fp[0], lp[0], d[0]);
|
||||
Standard_Real tol = Min(tolerance, d[0]);
|
||||
Standard_Real tol = std::min(tolerance, d[0]);
|
||||
if (!Precision::IsInfinite(c1) && !Precision::IsInfinite(c2))
|
||||
{
|
||||
d[1] = RealLast();
|
||||
newc3d[1] = ComputeCircle(c3d, tol, c1, c2, fp[1], lp[1], d[1]);
|
||||
tol = Min(tol, d[1]);
|
||||
tol = std::min(tol, d[1]);
|
||||
d[2] = RealLast();
|
||||
newc3d[2] = ComputeEllipse(c3d, tol, c1, c2, fp[2], lp[2], d[2]);
|
||||
}
|
||||
|
||||
@@ -191,14 +191,15 @@ Handle(Geom_Surface) GeomConvert_SurfToAnaSurf::TryCylinerCone(const Handle(Geom
|
||||
P3 = lastiso->Value((lastiso->LastParameter() - lastiso->FirstParameter()) / 2);
|
||||
}
|
||||
// cylinder
|
||||
if (((Abs(R2 - R1)) < theToler) && ((Abs(R3 - R1)) < theToler) && ((Abs(R3 - R2)) < theToler))
|
||||
if (((std::abs(R2 - R1)) < theToler) && ((std::abs(R3 - R1)) < theToler)
|
||||
&& ((std::abs(R3 - R2)) < theToler))
|
||||
{
|
||||
gp_Ax3 Axes(P1, gp_Dir(gp_Vec(P1, P3)));
|
||||
aNewSurf = new Geom_CylindricalSurface(Axes, R1);
|
||||
}
|
||||
// cone
|
||||
else if ((((Abs(R1)) > (Abs(R2))) && ((Abs(R2)) > (Abs(R3))))
|
||||
|| (((Abs(R3)) > (Abs(R2))) && ((Abs(R2)) > (Abs(R1)))))
|
||||
else if ((((std::abs(R1)) > (std::abs(R2))) && ((std::abs(R2)) > (std::abs(R3))))
|
||||
|| (((std::abs(R3)) > (std::abs(R2))) && ((std::abs(R2)) > (std::abs(R1)))))
|
||||
{
|
||||
Standard_Real radius;
|
||||
gp_Ax3 Axes;
|
||||
@@ -239,7 +240,7 @@ static void GetLSGap(const Handle(TColgp_HArray1OfXYZ)& thePoints,
|
||||
{
|
||||
gp_Vec aD(thePoints->Value(i) - aLoc);
|
||||
aD.Cross(aDir);
|
||||
theGap = Max(theGap, Abs((aD.Magnitude() - theR)));
|
||||
theGap = std::max(theGap, std::abs((aD.Magnitude() - theR)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -404,16 +405,16 @@ Handle(Geom_Surface) GeomConvert_SurfToAnaSurf::TryCylinderByGaussField(
|
||||
++n;
|
||||
Standard_Real aMinCurv = aProps.MinCurvature();
|
||||
Standard_Real aMaxCurv = aProps.MaxCurvature();
|
||||
Standard_Real aGaussCurv = Abs(aProps.GaussianCurvature());
|
||||
Standard_Real aK1 = Sqrt(aGaussCurv);
|
||||
Standard_Real aGaussCurv = std::abs(aProps.GaussianCurvature());
|
||||
Standard_Real aK1 = std::sqrt(aGaussCurv);
|
||||
if (aK1 > theToler)
|
||||
{
|
||||
return aNewSurf;
|
||||
}
|
||||
gp_XYZ aD;
|
||||
aProps.CurvatureDirections(aMaxD, aMinD);
|
||||
aMinCurv = Abs(aMinCurv);
|
||||
aMaxCurv = Abs(aMaxCurv);
|
||||
aMinCurv = std::abs(aMinCurv);
|
||||
aMaxCurv = std::abs(aMaxCurv);
|
||||
if (aMinCurv > aMaxCurv)
|
||||
{
|
||||
// aMinCurv < 0;
|
||||
@@ -429,11 +430,11 @@ Handle(Geom_Surface) GeomConvert_SurfToAnaSurf::TryCylinderByGaussField(
|
||||
//
|
||||
if (n > 1)
|
||||
{
|
||||
if (Abs(aMaxCurv - anAvMaxCurv / (n - 1)) > aTol / anR2)
|
||||
if (std::abs(aMaxCurv - anAvMaxCurv / (n - 1)) > aTol / anR2)
|
||||
{
|
||||
return aNewSurf;
|
||||
}
|
||||
if (Abs(aMinCurv - anAvMinCurv / (n - 1)) > aTol)
|
||||
if (std::abs(aMinCurv - anAvMinCurv / (n - 1)) > aTol)
|
||||
{
|
||||
return aNewSurf;
|
||||
}
|
||||
@@ -454,7 +455,7 @@ Handle(Geom_Surface) GeomConvert_SurfToAnaSurf::TryCylinderByGaussField(
|
||||
anAvR /= n;
|
||||
anAvDir /= n;
|
||||
//
|
||||
if (Abs(anAvMinCurv) > theToler)
|
||||
if (std::abs(anAvMinCurv) > theToler)
|
||||
{
|
||||
return aNewSurf;
|
||||
}
|
||||
@@ -464,8 +465,8 @@ Handle(Geom_Surface) GeomConvert_SurfToAnaSurf::TryCylinderByGaussField(
|
||||
Standard_Real d = (anRs(i) - anAvR);
|
||||
aSigmaR += d * d;
|
||||
}
|
||||
aSigmaR = Sqrt(aSigmaR / n);
|
||||
aSigmaR = 3. * aSigmaR / Sqrt(n);
|
||||
aSigmaR = std::sqrt(aSigmaR / n);
|
||||
aSigmaR = 3. * aSigmaR / std::sqrt(n);
|
||||
if (aSigmaR > aTol)
|
||||
{
|
||||
return aNewSurf;
|
||||
@@ -569,7 +570,7 @@ Handle(Geom_Surface) GeomConvert_SurfToAnaSurf::TryTorusSphere(
|
||||
Standard_Real R2 = aCircle2->Circ().Radius();
|
||||
|
||||
// check radiuses
|
||||
if ((Abs(R - R1) > toler) || (Abs(R - R2) > toler))
|
||||
if ((std::abs(R - R1) > toler) || (std::abs(R - R2) > toler))
|
||||
return newSurface;
|
||||
|
||||
// get centers of the major radius
|
||||
|
||||
@@ -72,7 +72,7 @@ Handle(Geom2d_Curve) GeomConvert_Units::RadianToDegree(const Handle(Geom2d_Curve
|
||||
Handle(Geom_ConicalSurface) conicS = Handle(Geom_ConicalSurface)::DownCast(theSurf);
|
||||
Standard_Real semAng = conicS->SemiAngle();
|
||||
uFact = AngleFact;
|
||||
vFact = LengthFact * Cos(semAng);
|
||||
vFact = LengthFact * std::cos(semAng);
|
||||
}
|
||||
else if (theSurf->IsKind(STANDARD_TYPE(Geom_Plane)))
|
||||
{
|
||||
@@ -205,7 +205,7 @@ Handle(Geom2d_Curve) GeomConvert_Units::DegreeToRadian(const Handle(Geom2d_Curve
|
||||
Handle(Geom_ConicalSurface) conicS = Handle(Geom_ConicalSurface)::DownCast(theSurface);
|
||||
Standard_Real semAng = conicS->SemiAngle();
|
||||
uFact = AngleFact;
|
||||
vFact = LengthFact / Cos(semAng);
|
||||
vFact = LengthFact / std::cos(semAng);
|
||||
}
|
||||
else if (theSurface->IsKind(STANDARD_TYPE(Geom_Plane)))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user