}// if (NbSegm)
//
// on traite les restrictions de la surface implicite
- for (Standard_Integer i=1; i<=slin.Length(); i++)
+
+ for (Standard_Integer i=1, aNbLin = slin.Length(); i<=aNbLin; i++)
{
Handle(IntPatch_Line)& aL = slin(i);
IntPatch_RstInt::PutVertexOnLine(aL,Surf1,D1,Surf2,Standard_True,TolTang);
else
IntPatch_RstInt::PutVertexOnLine(aL,Surf2,D2,Surf1,Standard_False,TolTang);
+
+ if(aL->ArcType() == IntPatch_Walking)
+ {
+ const Handle(IntPatch_WLine) aWL = Handle(IntPatch_WLine)::DownCast(aL);
+ slin.Append(aWL);
+ slin.Remove(i);
+ i--;
+ aNbLin--;
+ }
}
+ // Now slin is filled as follows: lower indices correspond to Restriction line,
+ // after (higher indices) - only Walking-line.
+
const Standard_Real aUPeriodOfSurf1 = Surf1->IsUPeriodic() ? Surf1->UPeriod() : 0.0,
aUPeriodOfSurf2 = Surf2->IsUPeriodic() ? Surf2->UPeriod() : 0.0,
aVPeriodOfSurf1 = Surf1->IsVPeriodic() ? Surf1->VPeriod() : 0.0,
Handle(IntPatch_RLine) aRL1 = Handle(IntPatch_RLine)::DownCast(aL1);
Handle(IntPatch_RLine) aRL2 = Handle(IntPatch_RLine)::DownCast(aL2);
- if(aRL1.IsNull() && aRL2.IsNull())
+ if(aRL1.IsNull())
{//If Walking-Walking
continue;
}
- else if(aRL1.IsNull())
- {// i-th line is not restriction,
- // but j-th is restriction
- slin.Append(aL1);
- slin.SetValue(i, aL2);
- slin.Remove(j);
- j--;
- continue;
- }
- //Here aL1 (i-th line) is Restriction-line and aL2 (j-th line) is not Restriction
+ //Here aL1 (i-th line) is Restriction-line and aL2 (j-th line) is
+ //Restriction or Walking
if(aBRL.IsVoid())
{//Fill aBRL
//
const Standard_Integer aNbLinIntersector = myIntersector.NbLines();
for (Standard_Integer i=1; i <= aNbLinIntersector; ++i) {
- MakeCurve(i, dom1, dom2);
+ MakeCurve(i, dom1, dom2, TolArc);
}
//
ComputeTolReached3d();
//function : MakeCurve
//purpose :
//=======================================================================
- void IntTools_FaceFace::MakeCurve(const Standard_Integer Index,
- const Handle(Adaptor3d_TopolTool)& dom1,
- const Handle(Adaptor3d_TopolTool)& dom2)
+void IntTools_FaceFace::MakeCurve(const Standard_Integer Index,
+ const Handle(Adaptor3d_TopolTool)& dom1,
+ const Handle(Adaptor3d_TopolTool)& dom2,
+ const Standard_Real theToler)
{
Standard_Boolean bDone, rejectSurface, reApprox, bAvoidLineConstructor;
Standard_Boolean ok, bPCurvesOk;
GeomInt_IntSS::
TrimILineOnSurfBoundaries(aC2d1, aC2d2, aBox1, aBox2, anArrayOfParameters);
+ //Intersect with true boundaries. After that, enlarge bounding-boxes in order to
+ //correct definition, if point on curve is inscribed in the box.
+ aBox1.Enlarge(theToler);
+ aBox2.Enlarge(theToler);
+
const Standard_Integer aNbIntersSolutionsm1 = anArrayOfParameters.Length() - 1;
//Trim RLine found.
for(Standard_Integer anInd = 0; anInd < aNbIntersSolutionsm1; anInd++)
{
- const Standard_Real aParF = anArrayOfParameters(anInd),
- aParL = anArrayOfParameters(anInd+1);
+ Standard_Real &aParF = anArrayOfParameters(anInd),
+ &aParL = anArrayOfParameters(anInd+1);
if((aParL - aParF) <= Precision::PConfusion())
+ {
+ //In order to more precise extending to the boundaries of source curves.
+ if(anInd < aNbIntersSolutionsm1-1)
+ aParL = aParF;
+
continue;
+ }
const Standard_Real aPar = 0.5*(aParF + aParL);
gp_Pnt2d aPt;
protected:
- Standard_EXPORT void MakeCurve (const Standard_Integer Index, const Handle(Adaptor3d_TopolTool)& D1, const Handle(Adaptor3d_TopolTool)& D2);
+ Standard_EXPORT void MakeCurve (const Standard_Integer Index,
+ const Handle(Adaptor3d_TopolTool)& D1,
+ const Handle(Adaptor3d_TopolTool)& D2,
+ const Standard_Real theToler);
Standard_EXPORT void ComputeTolReached3d();
#include <NCollection_IncAllocator.hxx>
#include <Precision.hxx>
+//==================================================================================
+// function : IsTangentExtCheck
+// purpose : Additional check if the point (theU, theV) in parametric surface
+// is a tangent point.
+// If that is TRUE then we can go along any (!) direction in order to
+// obtain next intersection point. At present, this case is difficult
+// for processing. Therefore, we will return an empty intersection line
+// in this case.
+//==================================================================================
+static Standard_Boolean IsTangentExtCheck(TheIWFunction& theFunc,
+ const Standard_Real theU,
+ const Standard_Real theV,
+ const Standard_Real theStepU,
+ const Standard_Real theStepV,
+ const Standard_Real theUinf,
+ const Standard_Real theUsup,
+ const Standard_Real theVinf,
+ const Standard_Real theVsup)
+{
+ //Factor 2.0 is chosen because we compare distance(s) between TWO faces
+ const Standard_Real aTol = 2.0*Precision::Confusion();
+ const Standard_Integer aNbItems = 4;
+ const Standard_Real aParU[aNbItems] = { Min(theU + theStepU, theUsup),
+ Max(theU - theStepU, theUinf),
+ theU, theU};
+ const Standard_Real aParV[aNbItems] = { theV, theV,
+ Min(theV + theStepV, theVsup),
+ Max(theV - theStepV, theVinf)};
+
+ math_Vector aX(1, 2), aVal(1, 1);
+
+ for(Standard_Integer i = 0; i < aNbItems; i++)
+ {
+ aX.Value(1) = aParU[i];
+ aX.Value(2) = aParV[i];
+
+ if(!theFunc.Value(aX, aVal))
+ continue;
+
+ if(aVal(1) > aTol)
+ return Standard_False;
+ }
+
+ return Standard_True;
+}
+
+
+
IntWalk_IWalking::IntWalk_IWalking (const Standard_Real Epsilon,
const Standard_Real Deflection,
const Standard_Real Increment ) :
const Standard_Boolean Reversed)
{
-
Standard_Integer I;
Standard_Boolean Rajout = Standard_False;
Standard_Integer nbPnts1 = Pnts1.Length();
Clear();
reversed = Reversed;
+ Um = ThePSurfaceTool::FirstUParameter(Caro);
+ Vm = ThePSurfaceTool::FirstVParameter(Caro);
+ UM = ThePSurfaceTool::LastUParameter(Caro);
+ VM = ThePSurfaceTool::LastVParameter(Caro);
+
+ if (UM < Um) {
+ Standard_Real utemp = UM;
+ UM = Um;
+ Um = utemp;
+ }
+ if (VM < Vm) {
+ Standard_Real vtemp = VM;
+ VM = Vm;
+ Vm = vtemp;
+ }
+
+ const Standard_Real aStepU = pas*(UM-Um), aStepV = pas*(VM-Vm);
// Loading of etat1 and etat2 as well as ustart and vstart.
wd2.reserve (nbPnts2);
for (I = 1; I <= nbPnts2; I++) {
IntWalk_WalkingData aWD2;
- aWD2.etat = 13;
- ThePointOfLoopTool::Value2d(Pnts2.Value(I), aWD2.ustart, aWD2.vstart);
+ aWD2.etat = 1;
+ const IntSurf_InteriorPoint& anIP = Pnts2.Value(I);
+ ThePointOfLoopTool::Value2d(anIP, aWD2.ustart, aWD2.vstart);
+ if (!IsTangentExtCheck(Func, aWD2.ustart, aWD2.vstart, aStepU, aStepV, Um, UM, Vm, VM))
+ aWD2.etat = 13;
+
wd2.push_back (aWD2);
}
tolerance(1) = ThePSurfaceTool::UResolution(Caro,Precision::Confusion());
tolerance(2) = ThePSurfaceTool::VResolution(Caro,Precision::Confusion());
- Um = ThePSurfaceTool::FirstUParameter(Caro);
- Vm = ThePSurfaceTool::FirstVParameter(Caro);
- UM = ThePSurfaceTool::LastUParameter(Caro);
- VM = ThePSurfaceTool::LastVParameter(Caro);
-
- if (UM < Um) {
- Standard_Real utemp = UM;
- UM = Um;
- Um = utemp;
- }
- if (VM < Vm) {
- Standard_Real vtemp = VM;
- VM = Vm;
- Vm = vtemp;
- }
-
Func.Set(Caro);
// calculation of all open lines
regexp {Tolerance Reached=+([-0-9.+eE]+)\n+([-0-9.+eE]+)} ${log} full Toler NbCurv
-#This value must be equal to the analogical value in bug25292_31 and bug25292_32 of "bugs modalg_5" testgrid.
set MaxTol 1.e-7
-#This value must be equal to the analogical value in bug25292_31 and bug25292_32 of "bugs modalg_5" testgrid.
set GoodNbCurv 1
if {${Toler} > ${MaxTol}} {
erase s1 s2
for {set i 1} {$i <= ${NbCurv}} {incr i} {
- set log [dump c_$i]
- set dumptrimres [regexp {Trimmed curve\nParameters : +([-0-9.+eE]+) +([-0-9.+eE]+)} ${log} full U1 U2]
+ bounds c_$i U1 U2
- if {${dumptrimres} == 0} {
- regexp {Degree +([-0-9.+eE]+), +([-0-9.+eE]+) Poles, +([-0-9.+eE]+)} ${log} full Degree Poles KnotsPoles
-
- puts "Degree=${Degree}"
- puts "Poles=${Poles}"
- puts "KnotsPoles=${KnotsPoles}"
- puts ""
-
- set Knot 1
- set exp_string "Knots :\n\n +${Knot} : +(\[-0-9.+eE\]+) +(\[-0-9.+eE\]+)"
- regexp ${exp_string} ${log} full U1 Mult1
-
- set Knot ${KnotsPoles}
- set exp_string " +${Knot} : +(\[-0-9.+eE\]+) +(\[-0-9.+eE\]+)"
- regexp ${exp_string} ${log} full U2 Mult2
- }
-
- puts "U1=${U1}"
- puts "U2=${U2}"
+ dump U1 U2
- if {[expr {$U2 - $U1}] < 1.0e-20} {
+ if {[dval $U2-$U1] < 1.0e-20} {
puts "Error: Wrong curve's range!"
}
donly ff1 f2
#############################
-set log [bopcurves ff1 f2]
+set log [bopcurves ff1 f2 -2d]
#############################
regexp {Tolerance Reached=+([-0-9.+eE]+)\n+([-0-9.+eE]+)} ${log} full Toler NbCurv
#-------------
for {set i 1} {$i <= ${NbCurv}} {incr i} {
- set log [dump c_$i]
- set dumptrimres [regexp {Trimmed curve\nParameters : +([-0-9.+eE]+) +([-0-9.+eE]+)} ${log} full U1 U2]
+ bounds c_$i U1 U2
- if {${dumptrimres} == 0} {
- regexp {Degree +([-0-9.+eE]+), +([-0-9.+eE]+) Poles, +([-0-9.+eE]+)} ${log} full Degree Poles KnotsPoles
-
- puts "Degree=${Degree}"
- puts "Poles=${Poles}"
- puts "KnotsPoles=${KnotsPoles}"
- puts ""
-
- set Knot 1
- set exp_string "Knots :\n\n +${Knot} : +(\[-0-9.+eE\]+) +(\[-0-9.+eE\]+)"
- regexp ${exp_string} ${log} full U1 Mult1
-
- set Knot ${KnotsPoles}
- set exp_string " +${Knot} : +(\[-0-9.+eE\]+) +(\[-0-9.+eE\]+)"
- regexp ${exp_string} ${log} full U2 Mult2
- }
-
- puts "U1=${U1}"
- puts "U2=${U2}"
+ dump U1 U2
- if {[expr {$U2 - $U1}] < 1.0e-20} {
+ if {[dval $U2-$U1] < 1.0e-20} {
puts "Error: Wrong curve's range!"
}
-
+
xdistcs c_$i s1 ${U1} ${U2} 10 1e-7
xdistcs c_$i s2 ${U1} ${U2} 10 1e-7
}
--- /dev/null
+puts "================"
+puts "OCC26699"
+puts "================"
+puts ""
+#######################################################################
+# Wrong section curves
+#######################################################################
+
+set MaxTol 1.e-7
+set GoodNbCurv 2
+
+restore [locate_data_file bug26699_f1.brep] f1
+restore [locate_data_file bug26699_f2.brep] f2
+
+set log [bopcurves f1 f2 -2d]
+
+regexp {Tolerance Reached=+([-0-9.+eE]+)\n+([-0-9.+eE]+)} ${log} full Toler NbCurv
+
+if {${Toler} > ${MaxTol}} {
+ puts "Error: Tolerance is too big!"
+}
+
+if {${NbCurv} != ${GoodNbCurv}} {
+ puts "Error: Curve Number is bad!"
+}
+
+set expL1 3.0
+set expL2 3.0
+
+regexp {The length c_1 is ([-0-9.+eE]+)} [length c_1] full ll1
+regexp {The length c_2 is ([-0-9.+eE]+)} [length c_2] full ll2
+
+checkreal "length c_1 " ${ll1} $expL1 0.0 1.0e-6
+checkreal "length c_2 " ${ll2} $expL1 0.0 1.0e-6
+
+axo
+donly f* c_*
+fit
+set only_screen_axo 1