mirror of
https://github.com/Open-Cascade-SAS/OCCT.git
synced 2026-09-04 11:47:53 +08:00
Coding - Apply Clang-Tidy automatic fixes (#1245)
Flags: aChecks="modernize-deprecated-headers,modernize-redundant-void-arg,modernize-use-bool-literals,modernize-use-equals-default,modernize-use-equals-delete,modernize-use-nullptr,modernize-use-override,performance-avoid-endl,performance-move-constructor-init,readability-braces-around-statements,readability-delete-null-pointer,readability-redundant-control-flow,readability-redundant-declaration,readability-redundant-function-ptr-dereference,readability-redundant-member-init,readability-redundant-string-init,readability-static-accessed-through-instance" clang-tidy version: 22.1.3
This commit is contained in:
@@ -66,7 +66,9 @@ struct OrientedCurve
|
||||
inline gp_Pnt2d Point(const bool isEnd) const
|
||||
{
|
||||
if (isEnd == IsReverse)
|
||||
{
|
||||
return Curve->StartPoint();
|
||||
}
|
||||
return Curve->EndPoint();
|
||||
}
|
||||
};
|
||||
@@ -92,9 +94,13 @@ TopoDS_Wire BRepAlgo::ConvertWire(const TopoDS_Wire& theWire,
|
||||
BRepAdaptor_Curve2d aCurve(anEdge, theFace);
|
||||
double aTol = BRep_Tool::Tolerance(anEdge);
|
||||
if (aTol < MINIMAL_TOLERANCE)
|
||||
{
|
||||
aTol = MINIMAL_TOLERANCE;
|
||||
}
|
||||
if (aTol > aMaxTol)
|
||||
{
|
||||
aMaxTol = aTol;
|
||||
}
|
||||
Geom2dConvert_ApproxArcsSegments anAlgo(aCurve, aTol, theAngleTol);
|
||||
const NCollection_Sequence<occ::handle<Geom2d_Curve>>& aResultApprox = anAlgo.GetResult();
|
||||
|
||||
@@ -134,7 +140,9 @@ TopoDS_Wire BRepAlgo::ConvertWire(const TopoDS_Wire& theWire,
|
||||
gp_Pnt2d aPnt[2] = {vecCurve(0).Point(false), vecCurve(vecCurve.Length() - 1).Point(true)};
|
||||
double aDist = aPnt[0].Distance(aPnt[1]);
|
||||
if (aDist > aMaxTol + Precision::Confusion())
|
||||
{
|
||||
aDist = Precision::Confusion();
|
||||
}
|
||||
else
|
||||
{
|
||||
aDist = 0.5 * aDist + Precision::Confusion();
|
||||
@@ -203,7 +211,9 @@ TopoDS_Wire BRepAlgo::ConvertWire(const TopoDS_Wire& theWire,
|
||||
}
|
||||
|
||||
if (aMkWire.IsDone())
|
||||
{
|
||||
aResult = aMkWire.Wire();
|
||||
}
|
||||
}
|
||||
return aResult;
|
||||
}
|
||||
@@ -280,7 +290,9 @@ TopoDS_Wire BRepAlgo::ConcatenateWire(const TopoDS_Wire& W,
|
||||
if (index >= 1)
|
||||
{ // continuity test loop
|
||||
if (edge.Orientation() == TopAbs_REVERSED)
|
||||
{
|
||||
tab(index)->Reverse();
|
||||
}
|
||||
tolleft = BRep_Tool::Tolerance(TopExp::LastVertex(edge));
|
||||
tolright = BRep_Tool::Tolerance(TopExp::FirstVertex(edge));
|
||||
tabtolvertex(index - 1) = std::max(tolleft, tolright);
|
||||
@@ -295,24 +307,33 @@ TopoDS_Wire BRepAlgo::ConcatenateWire(const TopoDS_Wire& W,
|
||||
tab(index)->Reverse();
|
||||
}
|
||||
else
|
||||
{
|
||||
Vfirst = TopExp::FirstVertex(edge);
|
||||
}
|
||||
}
|
||||
|
||||
if (index == nb_curve - 1)
|
||||
{ // storage of the last edge features
|
||||
if (edge.Orientation() == TopAbs_REVERSED)
|
||||
{
|
||||
Vlast = TopExp::FirstVertex(edge);
|
||||
}
|
||||
else
|
||||
{
|
||||
Vlast = TopExp::LastVertex(edge);
|
||||
}
|
||||
}
|
||||
WExp.Next();
|
||||
}
|
||||
|
||||
if (BRep_Tool::Tolerance(Vfirst)
|
||||
> BRep_Tool::Tolerance(Vlast)) // computation of the closing tolerance
|
||||
if (BRep_Tool::Tolerance(Vfirst) > BRep_Tool::Tolerance(Vlast))
|
||||
{ // computation of the closing tolerance
|
||||
toler = BRep_Tool::Tolerance(Vfirst);
|
||||
}
|
||||
else
|
||||
{
|
||||
toler = BRep_Tool::Tolerance(Vlast);
|
||||
}
|
||||
|
||||
Pfirst = BRep_Tool::Pnt(Vfirst);
|
||||
Plast = BRep_Tool::Pnt(Vlast);
|
||||
@@ -331,18 +352,22 @@ TopoDS_Wire BRepAlgo::ConcatenateWire(const TopoDS_Wire& W,
|
||||
concatcurve; // array of the concatenated curves
|
||||
occ::handle<NCollection_HArray1<int>> ArrayOfIndices; // array of the remaining Vertex
|
||||
if (Option == GeomAbs_G1)
|
||||
{
|
||||
GeomConvert::ConcatG1(tab,
|
||||
tabtolvertex,
|
||||
concatcurve,
|
||||
closed_flag,
|
||||
closed_tolerance); // G1 concatenation
|
||||
}
|
||||
else
|
||||
{
|
||||
GeomConvert::ConcatC1(tab,
|
||||
tabtolvertex,
|
||||
ArrayOfIndices,
|
||||
concatcurve,
|
||||
closed_flag,
|
||||
closed_tolerance); // C1 concatenation
|
||||
}
|
||||
|
||||
for (index = 0; index <= (concatcurve->Length() - 1); index++)
|
||||
{ // building of the resulting Wire
|
||||
@@ -408,7 +433,9 @@ TopoDS_Edge BRepAlgo::ConcatenateWireC0(const TopoDS_Wire& aWire)
|
||||
occ::handle<Geom_Curve> aCurve = BRep_Tool::Curve(anEdge, fpar, lpar);
|
||||
|
||||
if (aCurve.IsNull())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
GeomAdaptor_Curve aGACurve(aCurve);
|
||||
GeomAbs_CurveType aType = aGACurve.GetType();
|
||||
@@ -653,7 +680,9 @@ TopoDS_Edge BRepAlgo::ConcatenateWireC0(const TopoDS_Wire& aWire)
|
||||
LastVtx_final.Orientation(TopAbs_REVERSED);
|
||||
|
||||
if (CurveSeq.IsEmpty())
|
||||
{
|
||||
return ResEdge;
|
||||
}
|
||||
|
||||
int nb_curve = CurveSeq.Length(); // number of curves
|
||||
NCollection_Array1<occ::handle<Geom_BSplineCurve>> tab(0, nb_curve - 1); // array of the curves
|
||||
@@ -668,7 +697,9 @@ TopoDS_Edge BRepAlgo::ConcatenateWireC0(const TopoDS_Wire& aWire)
|
||||
for (i = 1; i <= nb_curve; i++)
|
||||
{
|
||||
if (CurveSeq(i)->IsInstance(STANDARD_TYPE(Geom_TrimmedCurve)))
|
||||
{
|
||||
CurveSeq(i) = (*((occ::handle<Geom_TrimmedCurve>*)&(CurveSeq(i))))->BasisCurve();
|
||||
}
|
||||
|
||||
occ::handle<Geom_TrimmedCurve> aTrCurve =
|
||||
new Geom_TrimmedCurve(CurveSeq(i), FparSeq(i), LparSeq(i));
|
||||
@@ -686,7 +717,9 @@ TopoDS_Edge BRepAlgo::ConcatenateWireC0(const TopoDS_Wire& aWire)
|
||||
// DrawTrSurf::Set(name, tab(i-1));
|
||||
|
||||
if (i > 1)
|
||||
{
|
||||
tabtolvertex(i - 2) = TolSeq(i - 1) * 5.;
|
||||
}
|
||||
}
|
||||
tabtolvertex(nb_curve - 1) = TolSeq(TolSeq.Length()) * 5.;
|
||||
|
||||
@@ -721,14 +754,20 @@ TopoDS_Edge BRepAlgo::ConcatenateWireC0(const TopoDS_Wire& aWire)
|
||||
{
|
||||
double MaxTolVer = LinTol;
|
||||
for (i = 1; i <= TolSeq.Length(); i++)
|
||||
{
|
||||
if (TolSeq(i) > MaxTolVer)
|
||||
{
|
||||
MaxTolVer = TolSeq(i);
|
||||
}
|
||||
}
|
||||
MaxTolVer *= 5.;
|
||||
|
||||
GeomConvert_CompCurveToBSplineCurve Concat(concatcurve->Value(concatcurve->Lower()));
|
||||
|
||||
for (i = concatcurve->Lower() + 1; i <= concatcurve->Upper(); i++)
|
||||
{
|
||||
Concat.Add(concatcurve->Value(i), MaxTolVer, true);
|
||||
}
|
||||
|
||||
concatcurve->SetValue(concatcurve->Lower(), Concat.BSplineCurve());
|
||||
}
|
||||
@@ -746,7 +785,9 @@ TopoDS_Edge BRepAlgo::ConcatenateWireC0(const TopoDS_Wire& aWire)
|
||||
else
|
||||
{
|
||||
if (CurveSeq(1)->IsInstance(STANDARD_TYPE(Geom_TrimmedCurve)))
|
||||
{
|
||||
CurveSeq(1) = (*((occ::handle<Geom_TrimmedCurve>*)&(CurveSeq(1))))->BasisCurve();
|
||||
}
|
||||
|
||||
occ::handle<Geom_Curve> aCopyCurve = occ::down_cast<Geom_Curve>(CurveSeq(1)->Copy());
|
||||
|
||||
@@ -754,7 +795,9 @@ TopoDS_Edge BRepAlgo::ConcatenateWireC0(const TopoDS_Wire& aWire)
|
||||
}
|
||||
|
||||
if (isReverse)
|
||||
{
|
||||
ResEdge.Reverse();
|
||||
}
|
||||
|
||||
return ResEdge;
|
||||
}
|
||||
|
||||
@@ -50,7 +50,9 @@ bool BRepAlgo::IsValid(const NCollection_List<TopoDS_Shape>& theArgs,
|
||||
const bool GeomCtrl)
|
||||
{
|
||||
if (theResult.IsNull())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
bool validate = false;
|
||||
|
||||
NCollection_Map<TopoDS_Shape, TopTools_ShapeMapHasher> allFaces;
|
||||
@@ -74,10 +76,14 @@ bool BRepAlgo::IsValid(const NCollection_List<TopoDS_Shape>& theArgs,
|
||||
if (allFaces.IsEmpty())
|
||||
{
|
||||
if (validate)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
BRepCheck_Analyzer ana(theResult, GeomCtrl);
|
||||
if (!ana.IsValid())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (!validate)
|
||||
{
|
||||
@@ -89,7 +95,9 @@ bool BRepAlgo::IsValid(const NCollection_List<TopoDS_Shape>& theArgs,
|
||||
if (!allFaces.Contains(curf))
|
||||
{
|
||||
if (toCheck.IsNull())
|
||||
{
|
||||
bB.MakeCompound(toCheck);
|
||||
}
|
||||
BRepTools::Update(curf);
|
||||
bB.Add(toCheck, curf);
|
||||
}
|
||||
@@ -154,7 +162,9 @@ bool BRepAlgo::IsValid(const NCollection_List<TopoDS_Shape>& theArgs,
|
||||
// corrected
|
||||
ana.Init(toCheck, true);
|
||||
if (!ana.IsValid())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -163,17 +173,27 @@ bool BRepAlgo::IsValid(const NCollection_List<TopoDS_Shape>& theArgs,
|
||||
for (tEx.Init(theResult, TopAbs_SHELL); tEx.More(); tEx.Next())
|
||||
{
|
||||
if (HR.IsNull())
|
||||
{
|
||||
HR = new BRepCheck_Shell(TopoDS::Shell(tEx.Current()));
|
||||
}
|
||||
else
|
||||
{
|
||||
HR->Init(tEx.Current());
|
||||
}
|
||||
if (HR->Status().First() != BRepCheck_NoError)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (HR->Orientation(false) != BRepCheck_NoError)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (closedSolid)
|
||||
{
|
||||
if (HR->Closed() != BRepCheck_NoError)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -83,7 +83,9 @@ bool BRepAlgo_AsDes::HasDescendant(const TopoDS_Shape& S) const
|
||||
const NCollection_List<TopoDS_Shape>& BRepAlgo_AsDes::Ascendant(const TopoDS_Shape& S) const
|
||||
{
|
||||
if (up.IsBound(S))
|
||||
{
|
||||
return up(S);
|
||||
}
|
||||
static NCollection_List<TopoDS_Shape> empty;
|
||||
return empty;
|
||||
}
|
||||
@@ -93,7 +95,9 @@ const NCollection_List<TopoDS_Shape>& BRepAlgo_AsDes::Ascendant(const TopoDS_Sha
|
||||
const NCollection_List<TopoDS_Shape>& BRepAlgo_AsDes::Descendant(const TopoDS_Shape& S) const
|
||||
{
|
||||
if (down.IsBound(S))
|
||||
{
|
||||
return down(S);
|
||||
}
|
||||
static NCollection_List<TopoDS_Shape> empty;
|
||||
return empty;
|
||||
}
|
||||
@@ -103,7 +107,9 @@ const NCollection_List<TopoDS_Shape>& BRepAlgo_AsDes::Descendant(const TopoDS_Sh
|
||||
NCollection_List<TopoDS_Shape>& BRepAlgo_AsDes::ChangeDescendant(const TopoDS_Shape& S)
|
||||
{
|
||||
if (down.IsBound(S))
|
||||
{
|
||||
return down.ChangeFind(S);
|
||||
}
|
||||
static NCollection_List<TopoDS_Shape> empty;
|
||||
return empty;
|
||||
}
|
||||
@@ -133,7 +139,9 @@ static void ReplaceInList(const TopoDS_Shape& OldS,
|
||||
L.Remove(it);
|
||||
}
|
||||
else
|
||||
{
|
||||
it.Next();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -76,7 +76,9 @@ static bool ChangePCurve(TopoDS_Edge& E, const occ::handle<Geom_Surface>& S, Top
|
||||
|
||||
BRep_Tool::CurveOnSurface(E, C2, SE, LE, f, l, 1);
|
||||
if (!C2.IsNull())
|
||||
{
|
||||
BB.UpdateEdge(E, C2, S, L, Precision::Confusion());
|
||||
}
|
||||
return (C2.IsNull());
|
||||
}
|
||||
|
||||
@@ -210,7 +212,9 @@ static bool IsClosed(const TopoDS_Wire& W)
|
||||
|
||||
{
|
||||
if (W.Closed())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
TopoDS_Vertex V1, V2;
|
||||
TopExp::Vertices(W, V1, V2);
|
||||
return (V1.IsSame(V2));
|
||||
@@ -298,7 +302,9 @@ static void BuildFaceIn(
|
||||
BRep_Builder B;
|
||||
|
||||
if (!KeyContains.IsBound(W) || KeyContains(W).IsEmpty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Removal of W in KeyIsIn.
|
||||
// for (NCollection_List<TopoDS_Shape>::Iterator it(KeyContains(W)); it.More(); it.Next()) {
|
||||
|
||||
@@ -62,9 +62,13 @@ void BRepAlgo_Image::Bind(const TopoDS_Shape& OldS, const NCollection_List<TopoD
|
||||
for (; it.More(); it.Next())
|
||||
{
|
||||
if (!HasImage(OldS))
|
||||
{
|
||||
Bind(OldS, it.Value());
|
||||
}
|
||||
else
|
||||
{
|
||||
Add(OldS, it.Value());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -121,7 +125,9 @@ void BRepAlgo_Image::Remove(const TopoDS_Shape& S)
|
||||
it.Next();
|
||||
}
|
||||
if (L.IsEmpty())
|
||||
{
|
||||
down.UnBind(OldS);
|
||||
}
|
||||
up.UnBind(S);
|
||||
}
|
||||
|
||||
@@ -166,14 +172,18 @@ const TopoDS_Shape& BRepAlgo_Image::Root(const TopoDS_Shape& S) const
|
||||
TopoDS_Shape S2 = S;
|
||||
|
||||
if (S1.IsSame(S2))
|
||||
{
|
||||
return up(S);
|
||||
}
|
||||
|
||||
while (up.IsBound(S1))
|
||||
{
|
||||
S2 = S1;
|
||||
S1 = up(S1);
|
||||
if (S1.IsSame(S2))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
return up(S2);
|
||||
}
|
||||
@@ -239,7 +249,9 @@ void BRepAlgo_Image::Compact()
|
||||
const TopoDS_Shape& S = it.Value();
|
||||
NCollection_List<TopoDS_Shape> LI;
|
||||
if (HasImage(S))
|
||||
{
|
||||
LastImage(S, LI);
|
||||
}
|
||||
M.Bind(S, LI);
|
||||
}
|
||||
up.Clear();
|
||||
@@ -298,7 +310,9 @@ void BRepAlgo_Image::RemoveRoot(const TopoDS_Shape& Root)
|
||||
}
|
||||
|
||||
if (!isRemoved)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const NCollection_List<TopoDS_Shape>* pNewS = down.Seek(Root);
|
||||
if (pNewS)
|
||||
@@ -307,7 +321,9 @@ void BRepAlgo_Image::RemoveRoot(const TopoDS_Shape& Root)
|
||||
{
|
||||
const TopoDS_Shape* pOldS = up.Seek(it.Value());
|
||||
if (pOldS && pOldS->IsSame(Root))
|
||||
{
|
||||
up.UnBind(it.Value());
|
||||
}
|
||||
}
|
||||
down.UnBind(Root);
|
||||
}
|
||||
@@ -318,13 +334,19 @@ void BRepAlgo_Image::RemoveRoot(const TopoDS_Shape& Root)
|
||||
void BRepAlgo_Image::ReplaceRoot(const TopoDS_Shape& OldRoot, const TopoDS_Shape& NewRoot)
|
||||
{
|
||||
if (!HasImage(OldRoot))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const NCollection_List<TopoDS_Shape>& aLImage = Image(OldRoot);
|
||||
if (HasImage(NewRoot))
|
||||
{
|
||||
Add(NewRoot, aLImage);
|
||||
}
|
||||
else
|
||||
{
|
||||
Bind(NewRoot, aLImage);
|
||||
}
|
||||
|
||||
SetRoot(NewRoot);
|
||||
RemoveRoot(OldRoot);
|
||||
|
||||
@@ -81,12 +81,16 @@ static void Bubble(const TopoDS_Edge& E, NCollection_Sequence<TopoDS_Shape>& Seq
|
||||
{
|
||||
// Remove duplicates
|
||||
for (int i = 1; i < Seq.Length(); i++)
|
||||
{
|
||||
for (int j = i + 1; j <= Seq.Length(); j++)
|
||||
{
|
||||
if (Seq(i) == Seq(j))
|
||||
{
|
||||
Seq.Remove(j);
|
||||
j--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool Invert = true;
|
||||
int NbPoints = Seq.Length();
|
||||
@@ -167,7 +171,9 @@ static TopoDS_Vertex UpdateClosedEdge(const TopoDS_Edge& E, NCollection_Sequence
|
||||
///////////////////////////////////////////////
|
||||
|
||||
if (SV.IsEmpty())
|
||||
{
|
||||
return VRes;
|
||||
}
|
||||
|
||||
VB[0] = TopoDS::Vertex(SV.First());
|
||||
VB[1] = TopoDS::Vertex(SV.Last());
|
||||
@@ -180,9 +186,13 @@ static TopoDS_Vertex UpdateClosedEdge(const TopoDS_Edge& E, NCollection_Sequence
|
||||
{
|
||||
VRes = VB[i];
|
||||
if (i == 0)
|
||||
{
|
||||
OnStart = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
OnEnd = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (OnStart && OnEnd)
|
||||
@@ -198,13 +208,19 @@ static TopoDS_Vertex UpdateClosedEdge(const TopoDS_Edge& E, NCollection_Sequence
|
||||
{
|
||||
SV.Remove(1);
|
||||
if (!SV.IsEmpty())
|
||||
{
|
||||
SV.Remove(SV.Length());
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (OnStart)
|
||||
{
|
||||
SV.Remove(1);
|
||||
}
|
||||
else if (OnEnd)
|
||||
{
|
||||
SV.Remove(SV.Length());
|
||||
}
|
||||
|
||||
return VRes;
|
||||
}
|
||||
@@ -269,7 +285,9 @@ static void RemovePendingEdges(
|
||||
LE.Remove(itl);
|
||||
}
|
||||
else
|
||||
{
|
||||
itl.Next();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -289,14 +307,22 @@ static bool SamePnt2d(const TopoDS_Vertex& V, TopoDS_Edge& E1, TopoDS_Edge& E2,
|
||||
occ::handle<Geom2d_Curve> C1 = BRep_Tool::CurveOnSurface(E1, FF, f1, l1);
|
||||
occ::handle<Geom2d_Curve> C2 = BRep_Tool::CurveOnSurface(E2, FF, f2, l2);
|
||||
if (E1.Orientation() == TopAbs_FORWARD)
|
||||
{
|
||||
P1 = C1->Value(f1);
|
||||
}
|
||||
else
|
||||
{
|
||||
P1 = C1->Value(l1);
|
||||
}
|
||||
|
||||
if (E2.Orientation() == TopAbs_FORWARD)
|
||||
{
|
||||
P2 = C2->Value(l2);
|
||||
}
|
||||
else
|
||||
{
|
||||
P2 = C2->Value(f2);
|
||||
}
|
||||
double Tol = 100 * BRep_Tool::Tolerance(V);
|
||||
double Dist = P1.Distance(P2);
|
||||
return Dist < Tol;
|
||||
@@ -355,9 +381,13 @@ static bool SelectEdge(const TopoDS_Face& F,
|
||||
double dist, distmin = 100 * BRep_Tool::Tolerance(CV);
|
||||
double u;
|
||||
if (CE.Orientation() == TopAbs_FORWARD)
|
||||
{
|
||||
u = l;
|
||||
}
|
||||
else
|
||||
{
|
||||
u = f;
|
||||
}
|
||||
|
||||
gp_Pnt2d P2, PV = C->Value(u);
|
||||
|
||||
@@ -368,9 +398,13 @@ static bool SelectEdge(const TopoDS_Face& F,
|
||||
{
|
||||
C = BRep_Tool::CurveOnSurface(E, FForward, f, l);
|
||||
if (E.Orientation() == TopAbs_FORWARD)
|
||||
{
|
||||
u = f;
|
||||
}
|
||||
else
|
||||
{
|
||||
u = l;
|
||||
}
|
||||
P2 = C->Value(u);
|
||||
dist = PV.Distance(P2);
|
||||
if (dist <= distmin)
|
||||
@@ -382,7 +416,9 @@ static bool SelectEdge(const TopoDS_Face& F,
|
||||
k++;
|
||||
}
|
||||
if (kmin == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
k = 1;
|
||||
itl.Initialize(LE);
|
||||
@@ -457,7 +493,9 @@ static void StoreInMVE(
|
||||
NCollection_List<TopoDS_Shape> VList;
|
||||
TopoDS_Iterator VerExp(E);
|
||||
for (; VerExp.More(); VerExp.Next())
|
||||
{
|
||||
VList.Append(VerExp.Value());
|
||||
}
|
||||
NCollection_List<TopoDS_Shape>::Iterator itl(VList);
|
||||
for (; itl.More(); itl.Next())
|
||||
{
|
||||
@@ -481,7 +519,9 @@ static void StoreInMVE(
|
||||
{
|
||||
TopoDS_Shape NewNewV = VerticesForSubstitute(V);
|
||||
if (!NewNewV.IsSame(V1))
|
||||
{
|
||||
VerticesForSubstitute.Bind(V1, NewNewV);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -489,8 +529,12 @@ static void StoreInMVE(
|
||||
NCollection_DataMap<TopoDS_Shape, TopoDS_Shape, TopTools_ShapeMapHasher>::Iterator
|
||||
mapit(VerticesForSubstitute);
|
||||
for (; mapit.More(); mapit.Next())
|
||||
{
|
||||
if (mapit.Value().IsSame(V1))
|
||||
{
|
||||
VerticesForSubstitute(mapit.Key()) = V;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
E.Free(true);
|
||||
@@ -586,7 +630,9 @@ void BRepAlgo_Loop::Perform()
|
||||
{
|
||||
TopoDS_Edge& E = TopoDS::Edge(itl1.ChangeValue());
|
||||
if (!Emap.Add(E))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
StoreInMVE(myFace, E, MVE, YaCouture, myVerticesForSubstitute, myTolConf);
|
||||
}
|
||||
}
|
||||
@@ -600,7 +646,9 @@ void BRepAlgo_Loop::Perform()
|
||||
{
|
||||
TopoDS_Edge& E = TopoDS::Edge(itl.ChangeValue());
|
||||
if (DejaVu.Add(E))
|
||||
{
|
||||
StoreInMVE(myFace, E, MVE, YaCouture, myVerticesForSubstitute, myTolConf);
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------
|
||||
@@ -625,7 +673,9 @@ void BRepAlgo_Loop::Perform()
|
||||
RemovePendingEdges(MVE);
|
||||
|
||||
if (MVE.Extent() == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
//--------------------------------
|
||||
// Start edge.
|
||||
//--------------------------------
|
||||
@@ -643,7 +693,9 @@ void BRepAlgo_Loop::Perform()
|
||||
CV = VF = V2;
|
||||
}
|
||||
if (!MVE.Contains(CV))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
NCollection_List<TopoDS_Shape>& aListEdges = MVE.ChangeFromKey(CV);
|
||||
for (itl.Initialize(aListEdges); itl.More(); itl.Next())
|
||||
{
|
||||
@@ -662,9 +714,13 @@ void BRepAlgo_Loop::Perform()
|
||||
//-------------------------------
|
||||
TopExp::Vertices(CE, V1, V2);
|
||||
if (!CV.IsSame(V1))
|
||||
{
|
||||
CV = V1;
|
||||
}
|
||||
else
|
||||
{
|
||||
CV = V2;
|
||||
}
|
||||
|
||||
B.Add(NW, CE);
|
||||
UsedEdges.Add(CE);
|
||||
@@ -680,7 +736,9 @@ void BRepAlgo_Loop::Perform()
|
||||
{
|
||||
CE = NE;
|
||||
if (MVE.FindFromKey(CV).IsEmpty())
|
||||
{
|
||||
MVE.RemoveKey(CV);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -800,9 +858,13 @@ void BRepAlgo_Loop::CutEdge(const TopoDS_Edge& E,
|
||||
// Eventually all extremities of the edge.
|
||||
//-----------------------------------------
|
||||
if (!VF.IsNull() && !VF.IsSame(SV.First()))
|
||||
{
|
||||
SV.Prepend(VF);
|
||||
}
|
||||
if (!VL.IsNull() && !VL.IsSame(SV.Last()))
|
||||
{
|
||||
SV.Append(VL);
|
||||
}
|
||||
}
|
||||
|
||||
while (!SV.IsEmpty())
|
||||
@@ -812,11 +874,15 @@ void BRepAlgo_Loop::CutEdge(const TopoDS_Edge& E,
|
||||
SV.Remove(1);
|
||||
}
|
||||
if (SV.IsEmpty())
|
||||
{
|
||||
break;
|
||||
}
|
||||
V1 = TopoDS::Vertex(SV.First());
|
||||
SV.Remove(1);
|
||||
if (SV.IsEmpty())
|
||||
{
|
||||
break;
|
||||
}
|
||||
if (SV.First().Orientation() == TopAbs_REVERSED)
|
||||
{
|
||||
V2 = TopoDS::Vertex(SV.First());
|
||||
@@ -830,14 +896,18 @@ void BRepAlgo_Loop::CutEdge(const TopoDS_Edge& E,
|
||||
aLocalEdge = V2.Oriented(TopAbs_REVERSED);
|
||||
B.Add(TopoDS::Edge(NewEdge), aLocalEdge);
|
||||
if (V1.IsSame(VF))
|
||||
{
|
||||
U1 = f;
|
||||
}
|
||||
else
|
||||
{
|
||||
TopoDS_Shape aLocalV = V1.Oriented(TopAbs_INTERNAL);
|
||||
U1 = BRep_Tool::Parameter(TopoDS::Vertex(aLocalV), WE);
|
||||
}
|
||||
if (V2.IsSame(VL))
|
||||
{
|
||||
U2 = l;
|
||||
}
|
||||
else
|
||||
{
|
||||
TopoDS_Shape aLocalV = V2.Oriented(TopAbs_INTERNAL);
|
||||
@@ -858,15 +928,21 @@ void BRepAlgo_Loop::CutEdge(const TopoDS_Edge& E,
|
||||
double fpar, lpar;
|
||||
BRep_Tool::Range(EE, fpar, lpar);
|
||||
if (lpar - fpar <= Precision::Confusion())
|
||||
{
|
||||
NE.Remove(it);
|
||||
}
|
||||
else
|
||||
{
|
||||
gp_Pnt2d pf, pl;
|
||||
BRep_Tool::UVPoints(EE, myFace, pf, pl);
|
||||
if (pf.Distance(pl) <= Tol && !BRep_Tool::IsClosed(EE))
|
||||
{
|
||||
NE.Remove(it);
|
||||
}
|
||||
else
|
||||
{
|
||||
it.Next();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -969,14 +1045,18 @@ void BRepAlgo_Loop::UpdateVEmap(
|
||||
}
|
||||
|
||||
if (VerLver.IsEmpty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
BRep_Builder aBB;
|
||||
for (int ii = 1; ii <= VerLver.Extent(); ii++)
|
||||
{
|
||||
const NCollection_List<TopoDS_Shape>& aVlist = VerLver(ii);
|
||||
if (aVlist.Extent() == 1)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
double aMaxTol = 0.;
|
||||
NCollection_Array1<gp_Pnt> Points(1, aVlist.Extent());
|
||||
@@ -1014,23 +1094,31 @@ void BRepAlgo_Loop::UpdateVEmap(
|
||||
const TopoDS_Shape& anEdge = aElist.First();
|
||||
NCollection_List<TopoDS_Shape>::Iterator itcedges(myConstEdges);
|
||||
for (; itcedges.More(); itcedges.Next())
|
||||
{
|
||||
if (anEdge.IsSame(itcedges.Value()))
|
||||
{
|
||||
aConstVertex = aVertex;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!aConstVertex.IsNull())
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (aConstVertex.IsNull())
|
||||
{
|
||||
aConstVertex = TopoDS::Vertex(aVlist.First());
|
||||
}
|
||||
aBB.UpdateVertex(aConstVertex, aCentre, aMaxTol);
|
||||
|
||||
for (itl.Initialize(aVlist); itl.More(); itl.Next())
|
||||
{
|
||||
const TopoDS_Vertex& aVertex = TopoDS::Vertex(itl.Value());
|
||||
if (aVertex.IsSame(aConstVertex))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
const NCollection_List<TopoDS_Shape>& aElist = theVEmap.FindFromKey(aVertex);
|
||||
TopoDS_Edge anEdge = TopoDS::Edge(aElist.First());
|
||||
@@ -1050,10 +1138,14 @@ void BRepAlgo_Loop::UpdateVEmap(
|
||||
const NCollection_List<TopoDS_Shape>& aElist = theVEmap(ii);
|
||||
NCollection_List<TopoDS_Shape>::Iterator itl(aElist);
|
||||
for (; itl.More(); itl.Next())
|
||||
{
|
||||
Emap.Add(itl.Value());
|
||||
}
|
||||
}
|
||||
|
||||
theVEmap.Clear();
|
||||
for (int ii = 1; ii <= Emap.Extent(); ii++)
|
||||
{
|
||||
TopExp::MapShapesAndAncestors(Emap(ii), TopAbs_VERTEX, TopAbs_EDGE, theVEmap);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -310,10 +310,14 @@ void BRepAlgo_NormalProjection::Build()
|
||||
Only3d = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
HPCur = HProjector;
|
||||
}
|
||||
|
||||
if ((!myWith3d || Elementary) && (HProjector->MaxDistance(k) <= myTol3d))
|
||||
{
|
||||
Only2d = true;
|
||||
}
|
||||
|
||||
if (Only2d && Only3d)
|
||||
{
|
||||
@@ -332,7 +336,9 @@ void BRepAlgo_NormalProjection::Build()
|
||||
appr.Perform(myMaxSeg, myMaxDegree, myContinuity, Only3d, Only2d);
|
||||
|
||||
if (appr.MaxError3d() > 1.e3 * myTol3d)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
#ifdef OCCT_DEBUG_CHRONO
|
||||
ResultChron(chr_approx, t_approx);
|
||||
@@ -349,7 +355,9 @@ void BRepAlgo_NormalProjection::Build()
|
||||
#endif
|
||||
|
||||
if (!Only3d)
|
||||
{
|
||||
PCur2d = appr.Curve2d();
|
||||
}
|
||||
if (Only2d)
|
||||
{
|
||||
BRepLib_MakeEdge MKed(GeomAdaptor::MakeCurve(*hcur), Udeb, Ufin);
|
||||
@@ -534,7 +542,9 @@ void BRepAlgo_NormalProjection::Build()
|
||||
// relations of map myAncestorMap, myCorresp will be lost.
|
||||
|
||||
if (YaVertexRes)
|
||||
{
|
||||
BB.Add(myRes, VertexRes);
|
||||
}
|
||||
|
||||
myIsDone = true;
|
||||
|
||||
@@ -653,7 +663,9 @@ bool BRepAlgo_NormalProjection::BuildWire(NCollection_List<TopoDS_Shape>& ListOf
|
||||
TopExp_Explorer exp2(Wire, TopAbs_EDGE);
|
||||
int NbEdges = 0;
|
||||
for (; exp2.More(); exp2.Next())
|
||||
{
|
||||
NbEdges++;
|
||||
}
|
||||
if (NbEdges == List.Extent())
|
||||
{
|
||||
ListOfWire.Append(Wire);
|
||||
|
||||
Reference in New Issue
Block a user