InitChron(chr_booltool);
#endif
if(!Degenerated){
- BRepAlgo_BooleanOperations BoolTool;
- BoolTool.Shapes2d(Faces->Value(j),prj);
- BoolTool.Common();
- Handle(TopOpeBRepBuild_HBuilder) HB;
- TopTools_ListOfShape LS;
- TopTools_ListIteratorOfListOfShape Iter;
- HB = BoolTool.Builder();
- LS.Clear();
- if (HB->IsSplit(prj, TopAbs_IN))
- LS = HB->Splits(prj, TopAbs_IN);
- Iter.Initialize(LS);
- if(Iter.More()) {
-#ifdef DEBUG
- cout << " BooleanOperations :" << Iter.More()<<" solutions " << endl;
-#endif
- for(; Iter.More(); Iter.Next()) {
- BB.Add(myRes, Iter.Value());
- myAncestorMap.Bind(Iter.Value(), Edges->Value(i));
- myCorresp.Bind(Iter.Value(),Faces->Value(j));
- }
- }
-
- else {
-
- BRepTopAdaptor_FClass2d classifier(TopoDS::Face(Faces->Value(j)),
- Precision::Confusion());
- gp_Pnt2d Puv;
- Standard_Real f = PCur2d->FirstParameter();
- Standard_Real l = PCur2d->LastParameter();
- Standard_Real pmil = (f + l )/2;
- PCur2d->D0(pmil, Puv);
- TopAbs_State state;
- state = classifier.Perform(Puv);
- if(state == TopAbs_IN || state == TopAbs_ON) {
- BB.Add(myRes, prj);
- DescenList.Append(prj);
- myAncestorMap.Bind(prj, Edges->Value(i));
- myCorresp.Bind(prj, Faces->Value(j));
- }
- }
+
+ // {Fix for Issue 0023820 ... introducing try-catch so that result of the previous iteration is kept
+ try
+ {
+ BRepAlgo_BooleanOperations BoolTool;
+ BoolTool.Shapes2d(Faces->Value(j),prj);
+ BoolTool.Common();
+ Handle(TopOpeBRepBuild_HBuilder) HB;
+ TopTools_ListOfShape LS;
+ TopTools_ListIteratorOfListOfShape Iter;
+ HB = BoolTool.Builder();
+ LS.Clear();
+ if (HB->IsSplit(prj, TopAbs_IN))
+ LS = HB->Splits(prj, TopAbs_IN);
+ Iter.Initialize(LS);
+
+ if(Iter.More()) {
+ #ifdef DEBUG
+ cout << " BooleanOperations :" << Iter.More()<<" solutions " << endl;
+ #endif
+ for(; Iter.More(); Iter.Next()) {
+ BB.Add(myRes, Iter.Value());
+ myAncestorMap.Bind(Iter.Value(), Edges->Value(i));
+ myCorresp.Bind(Iter.Value(),Faces->Value(j));
+ }
+ }
+ else {
+
+ BRepTopAdaptor_FClass2d classifier(TopoDS::Face(Faces->Value(j)),
+ Precision::Confusion());
+ gp_Pnt2d Puv;
+ Standard_Real f = PCur2d->FirstParameter();
+ Standard_Real l = PCur2d->LastParameter();
+ Standard_Real pmil = (f + l )/2;
+ PCur2d->D0(pmil, Puv);
+ TopAbs_State state;
+ state = classifier.Perform(Puv);
+
+ if(state == TopAbs_IN || state == TopAbs_ON) {
+ BB.Add(myRes, prj);
+ DescenList.Append(prj);
+ myAncestorMap.Bind(prj, Edges->Value(i));
+ myCorresp.Bind(prj, Faces->Value(j));
+ }
+ }
+ }
+ catch (Standard_Failure) {
+ continue;
+ }
}
else {
#ifdef DEB
FirstU = myCurve->FirstParameter();
LastU = myCurve->LastParameter();
+
+ // {Fix for Issue 0023820 ...
+ // Taking derivative of the curve in the parametric space of the curve
+ gp_Pnt Pt;
+ gp_Vec V;
+
+ myCurve->D1(FirstU, Pt, V);
+ Standard_Real VD1 = V.Magnitude();
+ // ... Fix for Issue 0023820}
+
const Standard_Real MinStep = 0.01*(LastU - FirstU),
MaxStep = 0.1*(LastU - FirstU);
- SearchStep = 10*MinStep;
+
+ // {Fix for Issue 0023820 ...
+ // The step is taken to be minimum of the two values given below.
+ // The 2nd variable gives the 1/10th of the rate of change of parameter
+ SearchStep = Min(10*MinStep, 0.1/VD1);
+ // ... Fix for Issue 0023820}
Step = SearchStep;
//Initialization of aPrjPS
if (t == LastU) {t = LastU + 1; break;}//return;
//Computation of WalkStep
- d2CurvOnSurf(Triple.X(), Triple.Y(), Triple.Z(), D1, D2, myCurve, mySurface);
- MagnD1 = D1.Magnitude();
- MagnD2 = D2.Magnitude();
- if(MagnD2 < Precision::Confusion() ) WalkStep = MaxStep;
- else WalkStep = Min(MaxStep, Max(MinStep, 0.1*MagnD1/MagnD2));
-
- Step = WalkStep;
- t += Step;
- if (t > (LastU-MinStep/2) )
- {
- Step =Step+LastU-t;
- t = LastU;
- }
+ d2CurvOnSurf(Triple.X(), Triple.Y(), Triple.Z(), D1, D2, myCurve, mySurface);
+ MagnD1 = D1.Magnitude();
+ MagnD2 = D2.Magnitude();
+ if(MagnD2 < Precision::Confusion() ) WalkStep = MaxStep;
+ else WalkStep = Min(MaxStep, Max(MinStep, 0.1*MagnD1/MagnD2));
+
+ Step = WalkStep;
+ t += Step;
+ if (t > (LastU-MinStep/2) )
+ {
+ Step =Step+LastU-t;
+ t = LastU;
+ }
DecStep=Step;
}
}
gp_Pnt2d(Tol, myTolV),
gp_Pnt2d(Tl, mySurface->FirstVParameter()),
gp_Pnt2d(Tr, mySurface->LastVParameter()));
- TUdisc.Append(Solver.Solution().X());
- }
+
+ // {Fix for Issue 0023820 ...
+ // Continue and preserve the projection result of the previous iteration
+ try
+ {
+ TUdisc.Append(Solver.Solution().X());
+ }
+ catch (Standard_Failure)
+ {
+ ; // just continue
+ }
+ // ... Fix for Issue 0023820}
+ }
}
}
for(i = 2; i <= TUdisc.Length(); i++)
gp_Pnt2d(Tol, myTolV),
gp_Pnt2d(Tl, mySurface->FirstUParameter()),
gp_Pnt2d(Tr, mySurface->LastUParameter()));
- TVdisc.Append(Solver.Solution().X());
- }
+
+ // We Want to preserve the previous projection result and continue
+ try
+ {
+ TVdisc.Append(Solver.Solution().X());
+ }
+ catch (Standard_Failure)
+ {
+
+ }
+ }
}
}
for(i = 2; i <= TVdisc.Length(); i++)