Comments have been added.
Test case for issue CR25592
Transition from IntSurf,
Function from Blend,
FuncInv from Blend,
+ HElSpine from ChFiDS,
State from TopAbs
Perform(me: in out; F : in out Function from Blend;
FInv : in out FuncInv from Blend;
+ HGuide : HElSpine from ChFiDS;
Pdep : Real from Standard;
Pmax : Real from Standard;
MaxStep : Real from Standard;
InternalPerform (me: in out;F : in out Function from Blend;
FInv : in out FuncInv from Blend;
+ HGuide : HElSpine from ChFiDS;
Bound : Real from Standard)
is static private;
void Blend_Walking::Perform(Blend_Function& Func,
Blend_FuncInv& FuncInv,
+ const Handle(ChFiDS_HElSpine)& HGuide,
const Standard_Real Pdep,
const Standard_Real Pmax,
const Standard_Real MaxStep,
}
}
- InternalPerform(Func,FuncInv,Pmax);
+ InternalPerform(Func,FuncInv,HGuide,Pmax);
done = Standard_True;
}
previousP.ParametersOnS1(sol(1),sol(2));
previousP.ParametersOnS2(sol(3),sol(4));
- InternalPerform(Func,FuncInv,P);
+ Handle(ChFiDS_HElSpine) anHGuide;
+ InternalPerform(Func,FuncInv,anHGuide,P);
return Standard_True;
}
if(OnS1) clasonS1 = Standard_False;
else clasonS2 = Standard_False;
- InternalPerform(Func,FuncInv,P);
+ Handle(ChFiDS_HElSpine) anHGuide;
+ InternalPerform(Func,FuncInv,anHGuide,P);
clasonS1 = Standard_True;
clasonS2 = Standard_True;
previousP.ParametersOnS1(sol(1),sol(2));
previousP.ParametersOnS2(sol(3),sol(4));
- InternalPerform(Func,FuncInv,Pmin);
+ Handle(ChFiDS_HElSpine) anHGuide;
+ InternalPerform(Func,FuncInv,anHGuide,Pmin);
iscomplete = Standard_True;
return Standard_True;
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
+#include <gce_MakePln.hxx>
+
static void evalpinit(math_Vector& parinit,
const Blend_Point& previousP,
const Standard_Real parprec,
void Blend_Walking::InternalPerform(Blend_Function& Func,
Blend_FuncInv& FuncInv,
+ const Handle(ChFiDS_HElSpine)& HGuide,
const Standard_Real Bound)
{
// avec les surfaces periodiques.
State = Blend_OnRst12;
param = (w1+w2)/2;
+ gp_Pnt Pnt1, Pnt2;
p2d = TheArcTool::Value(recdomain1->Value(),solrst1(1));
sol(1) = p2d.X();
sol(2) = p2d.Y();
+ Pnt1 = TheSurfaceTool::Value(surf1,sol(1),sol(2));
p2d = TheArcTool::Value(recdomain2->Value(),solrst2(1));
sol(3) = p2d.X();
sol(4) = p2d.Y();
+ Pnt2 = TheSurfaceTool::Value(surf2,sol(3),sol(4));
+ if (!HGuide.IsNull())
+ {
+ const Standard_Real TolProd = 1.e-5;
+ Standard_Real SavedParams [2];
+ Standard_Boolean SameDirs [2] = {Standard_False, Standard_False};
+ ChFiDS_ElSpine& theElSpine = HGuide->ChangeCurve();
+ SavedParams[0] = theElSpine.GetSavedFirstParameter();
+ SavedParams[1] = theElSpine.GetSavedLastParameter();
+ for (Standard_Integer ind = 0; ind < 2; ind++)
+ {
+ if (!Precision::IsInfinite(SavedParams[ind]))
+ {
+ //Check the original first and last parameters of guide curve
+ //for equality to found parameter <param>:
+ //check equality of tangent to guide curve and
+ //normal to plane built on 3 points:
+ //point on guide curve and points on restrictions of adjacent
+ //surfaces.
+ gp_Pnt Pnt0;
+ gp_Vec Dir0;
+ HGuide->D1(SavedParams[ind], Pnt0, Dir0);
+ Standard_Real Length = Dir0.Magnitude();
+ if (Length <= gp::Resolution())
+ continue;
+ Dir0 /= Length;
+ gce_MakePln PlaneBuilder(Pnt0, Pnt1, Pnt2);
+ if (!PlaneBuilder.IsDone())
+ continue;
+ gp_Pln thePlane = PlaneBuilder.Value();
+ gp_Dir DirPlane = thePlane.Axis().Direction();
+ gp_Vec theProd = Dir0 ^ DirPlane;
+ Standard_Real ProdMod = theProd.Magnitude();
+ if (ProdMod <= TolProd)
+ SameDirs[ind] = Standard_True;
+ }
+ }
+ Standard_Real theParam = Precision::Infinite();
+ //Choose the closest parameter
+ if (SameDirs[0] && SameDirs[1])
+ theParam = (Abs(param - SavedParams[0]) < Abs(param - SavedParams[1]))?
+ SavedParams[0] : SavedParams[1];
+ else if (SameDirs[0])
+ theParam = SavedParams[0];
+ else if (SameDirs[1])
+ theParam = SavedParams[1];
+
+ if (!Precision::IsInfinite(theParam))
+ param = theParam;
+ }
}
else if (recad1) {
// sol sur 1
Standard_Real wl = Guide.LastParameter();
Standard_Real locfleche = (wl - wf) * fleche;
Standard_Real wfsav = wf, wlsav = wl;
- //Now the ElSpine is artificially extended to help rsnld.
- Standard_Real prab = 0.01;
- Guide.FirstParameter(wf-prab*(wl-wf));
- Guide.LastParameter (wl+prab*(wl-wf));
+ if (!Guide.IsPeriodic())
+ {
+ //Now the ElSpine is artificially extended to help rsnld.
+ Standard_Real prab = 0.01;
+ Guide.FirstParameter(wf-prab*(wl-wf));
+ Guide.LastParameter (wl+prab*(wl-wf));
+ }
Handle(ChFiDS_Spine)& Spine = Stripe->ChangeSpine();
Standard_Integer ii, nbed = Spine->NbEdges();
Standard_Real lastedlastp = Spine->LastParameter(nbed);
Last = wf;
if(Guide.IsPeriodic()) {
Last = First - Guide.Period();
+ Guide.SaveFirstParameter();
Guide.FirstParameter(Last);
+ Guide.SaveLastParameter();
Guide.LastParameter (First * 1.1);//Extension to help rsnld.
}
}
if (5*TolGuide > MS) TolGuide = MS/5;
if (5*TolEsp > MS) TolEsp = MS/5;
}
- TheWalk.Perform(Func,FInv,NewFirst,Target,MS,TolGuide,
+ TheWalk.Perform(Func,FInv,HGuide,NewFirst,Target,MS,TolGuide,
ParSol,TolEsp,Fleche,Appro);
if (!TheWalk.IsDone()) {
#ifdef OCCT_DEBUG
if (5*TolEsp > MS) TolEsp = MS/5;
}
- TheWalk.Perform(Func,FInv,NewFirst,Target,MS,TolGuide,
+ TheWalk.Perform(Func,FInv,HGuide,NewFirst,Target,MS,TolGuide,
ParSol,TolEsp,Fleche,Appro);
if (!TheWalk.IsDone()) {
LastParameter(me) returns Real from Standard
is redefined;
+ GetSavedFirstParameter(me) returns Real from Standard;
+
+ GetSavedLastParameter(me) returns Real from Standard;
+
Continuity(me) returns Shape from GeomAbs
is redefined static;
LastParameter(me : in out; P : Real from Standard);
+ SaveFirstParameter(me : in out);
+
+ SaveLastParameter(me : in out);
+
SetOrigin(me : in out; O : Real from Standard);
FirstPointAndTgt(me; P : out Pnt from gp; T : out Vec from gp);
period : Real from Standard;
periodic : Boolean from Standard;
+pfirstsav : Real from Standard;
+plastsav : Real from Standard;
end ElSpine;
ChFiDS_ElSpine::ChFiDS_ElSpine():periodic(0)
{
+ pfirstsav = Precision::Infinite();
+ plastsav = Precision::Infinite();
}
return plast;
}
+//=======================================================================
+//function : GetSavedFirstParameter
+//purpose :
+//=======================================================================
+
+Standard_Real ChFiDS_ElSpine::GetSavedFirstParameter() const
+{
+ return pfirstsav;
+}
+
+//=======================================================================
+//function : GetSavedLastParameter
+//purpose :
+//=======================================================================
+
+Standard_Real ChFiDS_ElSpine::GetSavedLastParameter() const
+{
+ return plastsav;
+}
+
//=======================================================================
//function : Continuity
//purpose :
plast = P;
}
+//=======================================================================
+//function : SaveFirstParameter
+//purpose :
+//=======================================================================
+
+void ChFiDS_ElSpine::SaveFirstParameter()
+{
+ pfirstsav = pfirst;
+}
+
+//=======================================================================
+//function : SaveLastParameter
+//purpose :
+//=======================================================================
+
+void ChFiDS_ElSpine::SaveLastParameter()
+{
+ plastsav = plast;
+}
+
//=======================================================================
//function : SetOrigin
--- /dev/null
+puts "============"
+puts "OCC25592"
+puts "============"
+puts ""
+######################################################
+# Bad result of Fillet operation
+######################################################
+
+restore [locate_data_file bug25592_tshape.brep] t
+explode t e
+shape c c
+add t_4 c
+add t_6 c
+fillet r t 30 c
+explode r f
+
+set info1 [bopargcheck r_2 #f]
+if { [regexp "to be valid for BOP" ${info1}] == 1 } {
+ puts "1. OK : Good result of Fillet operation\n"
+} else {
+ puts "1. Error : Bad result of Fillet operation\n"
+}
+
+set info2 [bopargcheck r_1 #f]
+if { [regexp "to be valid for BOP" ${info2}] == 1 } {
+ puts "2. OK : Good result of Fillet operation\n"
+} else {
+ puts "2. Error : Bad result of Fillet operation\n"
+}
+
+set info3 [bopargcheck r_6 #f]
+if { [regexp "to be valid for BOP" ${info3}] == 1 } {
+ puts "3. OK : Good result of Fillet operation\n"
+} else {
+ puts "3. Error : Bad result of Fillet operation\n"
+}
+
+set info4 [bopargcheck r_7 #f]
+if { [regexp "to be valid for BOP" ${info4}] == 1 } {
+ puts "4. OK : Good result of Fillet operation\n"
+} else {
+ puts "4. Error : Bad result of Fillet operation\n"
+}
+
+set info5 [bopargcheck r_9 #f]
+if { [regexp "to be valid for BOP" ${info5}] == 1 } {
+ puts "5. OK : Good result of Fillet operation\n"
+} else {
+ puts "5. Error : Bad result of Fillet operation\n"
+}