ApproxInt/ApproxInt_SvSurfaces.hxx : adding field myUseSolver in order to manage calculations of characteristics of intersection points.
ApproxInt/ApproxInt_MultiLine.gxx : implementation of using myUseSolver for treatment points of MultiLine.
ApproxInt/ApproxInt_ImpPrmSvSurfaces.gxx : implementation of using myUseSolver for case intersection of implicit and parametric surfaces.
Test cases added
isTheQuadFirst? ApproxInt_TheImpPrmSvSurfaces(ISurf, PSurf):
ApproxInt_TheImpPrmSvSurfaces(PSurf, ISurf);
+ myImpPrmSvSurfaces.SetUseSolver(Standard_False);
+
const Standard_Integer nbpntbez = indicemax-indicemin;
if(nbpntbez < aMinNbPointsForApprox)
{
MyImplicitFirst(Standard_True),
MyZerImpFunc(PSurf,ISurf)
{
+ SetUseSolver(Standard_True);
}
//--------------------------------------------------------------------------------
ApproxInt_ImpPrmSvSurfaces::ApproxInt_ImpPrmSvSurfaces( const ThePSurface& PSurf
MyImplicitFirst(Standard_False),
MyZerImpFunc(PSurf,ISurf)
{
+ SetUseSolver(Standard_True);
}
//--------------------------------------------------------------------------------
void ApproxInt_ImpPrmSvSurfaces::Pnt(const Standard_Real u1,
return(Standard_False);
}
+ Standard_Boolean aRsnldIsDone = Standard_False;
Standard_Real PourTesterU = X(1);
Standard_Real PourTesterV = X(2);
-
- math_FunctionSetRoot Rsnld(MyZerImpFunc);
- Rsnld.SetTolerance(Tolerance);
- Rsnld.Perform(MyZerImpFunc,X,BornInf,BornSup);
- if(Rsnld.IsDone()) {
+ if (GetUseSolver())
+ {
+ math_FunctionSetRoot Rsnld(MyZerImpFunc);
+ Rsnld.SetTolerance(Tolerance);
+ Rsnld.Perform(MyZerImpFunc, X, BornInf, BornSup);
+ aRsnldIsDone = Rsnld.IsDone();
+ if (aRsnldIsDone)
+ Rsnld.Root(X);
+ }
+ if(aRsnldIsDone || !GetUseSolver())
+ {
MyHasBeenComputed = Standard_True;
- Rsnld.Root(X);
Standard_Real DistAvantApresU = Abs(PourTesterU-X(1));
Standard_Real DistAvantApresV = Abs(PourTesterV-X(2));
//----------------------------------------------------
//Make a small step from boundaries in order to avoid
//finding "outboundaried" solution (Rsnld -> NotDone).
- if(X(1)-0.0000000001 <= binfu) X(1)=X(1)+0.0000001;
- if(X(1)+0.0000000001 >= bsupu) X(1)=X(1)-0.0000001;
- if(X(2)-0.0000000001 <= binfv) X(2)=X(2)+0.0000001;
- if(X(2)+0.0000000001 >= bsupv) X(2)=X(2)-0.0000001;
+ if (GetUseSolver())
+ {
+ Standard_Real du = Max(Precision::Confusion(), ThePSurfaceTool::UResolution(aPSurf, Precision::Confusion()));
+ Standard_Real dv = Max(Precision::Confusion(), ThePSurfaceTool::VResolution(aPSurf, Precision::Confusion()));
+ if (X(1) - 0.0000000001 <= binfu) X(1) = X(1) + du;
+ if (X(1) + 0.0000000001 >= bsupu) X(1) = X(1) - du;
+ if (X(2) - 0.0000000001 <= binfv) X(2) = X(2) + dv;
+ if (X(2) + 0.0000000001 >= bsupv) X(2) = X(2) - dv;
+ }
return Standard_True;
}
//-- return(*this);
}
+ Standard_Boolean aSaveUseSolver = ((TheSvSurfaces *)PtrOnmySvSurfaces)->GetUseSolver();
+ if (!aSaveUseSolver)
+ {
+ ((TheSvSurfaces *)PtrOnmySvSurfaces)->SetUseSolver(Standard_True);
+ }
Standard_Integer NbPntsToInsert=aNbPntsToInsert;
if(NbPntsToInsert<(High-Low)) NbPntsToInsert=(High-Low);
Standard_Integer NbPnts = NbPntsToInsert + High - Low + 1;
if((temp->NbPnts() >= NbPntsToInsert + High - Low + 1) && (CodeErreur==0))
{
+ ((TheSvSurfaces *)PtrOnmySvSurfaces)->SetUseSolver(aSaveUseSolver);
return (ApproxInt_MultiLine( temp,
(High-Low>10)? PtrOnmySvSurfaces : NULL,
nbp3d,
{
//-- cout<<" ApproxInt_MultiLine "<<endl;
//-- cout<<" Pas de Rajout de points ds1min = "<<minds1<<" ds2min = "<<minds2<<endl;
+ ((TheSvSurfaces *)PtrOnmySvSurfaces)->SetUseSolver(aSaveUseSolver);
Handle(IntSurf_LineOn2S) vide1 = new IntSurf_LineOn2S();
Handle(TheLine) vide = new TheLine(vide1,Standard_False);
return (ApproxInt_MultiLine( vide,
Standard_Boolean OtherLineMade = Standard_False;
if(PtrOnmySvSurfaces==NULL)
return Standard_False;
-
+
+ Standard_Boolean aSaveUseSolver = ((TheSvSurfaces *)PtrOnmySvSurfaces)->GetUseSolver();
+ if (!aSaveUseSolver)
+ {
+ ((TheSvSurfaces *)PtrOnmySvSurfaces)->SetUseSolver(Standard_True);
+ }
+
const Standard_Real SqTol3d = Precision::SquareConfusion();
math_Vector tolerance(1,2);
tolerance(1) = tolerance(2) = 1.e-8;
}
if (!OtherLineMade)
+ {
+ ((TheSvSurfaces *)PtrOnmySvSurfaces)->SetUseSolver(aSaveUseSolver);
return Standard_False;
+ }
#ifdef DRAW
char* name = new char[100];
}
#endif
Handle(TheLine) temp = new TheLine(ResultPntOn2SLine,Standard_False);
+ ((TheSvSurfaces *)PtrOnmySvSurfaces)->SetUseSolver(aSaveUseSolver);
theNewMultiLine = ApproxInt_MultiLine( temp,
PtrOnmySvSurfaces,
nbp3d,
class gp_Vec2d;
class IntSurf_PntOn2S;
+//! This class is root class for classes dedicated to calculate
+//! 2d and 3d points and tangents of intersection lines of two surfaces of different types
+//! for given u, v parameters of intersection point on two surfaces.
+//!
+//! The field myUseSolver is used to manage type of calculation:
+//! if myUseSolver = true, input parameters u1, v1, u2, v2 are considered as first approximation of
+//! exact intersection point, then coordinates u1, v1, u2, v2 are refined with help of
+//! the solver used in intersection algorithm and required values are calculated.
+//! if myUseSolver = false, u1, v1, u2, v2 are considered as "exact" intersection points on two surfaces
+//! and required values are calculated directly using u1, v1, u2, v2
+//!
+
class ApproxInt_SvSurfaces
{
gp_Vec2d& Tg) = 0;
Standard_EXPORT virtual ~ApproxInt_SvSurfaces();
+ Standard_EXPORT virtual void SetUseSolver(const Standard_Boolean theUseSol)
+ {
+ myUseSolver = theUseSol;
+ }
+ Standard_EXPORT virtual Standard_Boolean GetUseSolver() const
+ {
+ return myUseSolver;
+ }
protected:
-
+
private:
-
+Standard_Boolean myUseSolver;
--- /dev/null
+puts "============"
+puts "0029441: Modeling Algorithms - Incorrect intersection curves between faces"
+puts "============"
+puts ""
+
+binrestore [locate_data_file bug28984_faces.bin] f
+
+set OK 1
+explode f
+bopcurves f_1 f_2 -2d
+
+if {[isdraw c2d1_1]} {
+ puts "check extremity of 1-st pcurve x ~ 1.012680192, |dx| ~ 0, |dy| >> |dx|"
+ 2dcvalue c2d1_1 1 x y dx dy
+ set ex [expr abs([dval (x-1.012680192)])]
+ set edxdy [expr abs([dval dx/dy])]
+ if {$ex > 1.e-8 || $edxdy > 1.e-10} {
+ puts "Extremities of 1-st pcurve are wrong"
+ set OK 0
+ } else {
+ puts "Extremities of 1-st pcurve are valid"
+ }
+} else {
+ set OK 0
+ puts "Error: 1-st pcurve is not exist"
+}
+
+if { $OK > 0 } {
+ if {[isdraw c2d1_2]} {
+ puts "check extremity of 2-nd pcurve x ~ 1.0117170137, |dx| ~ 0, |dy| >> |dx|"
+ 2dcvalue c2d1_2 1 x y dx dy
+ set ex [expr abs([dval (x-1.0117170137)])]
+ set edxdy [expr abs([dval dx/dy])]
+ if {$ex > 1.e-8 || $edxdy > 1.e-10} {
+ puts "Extremities of 2-nd pcurve are wrong"
+ set OK 0
+ } else {
+ puts "Extremities of 2-nd pcurve are valid"
+ }
+ } else {
+ set OK 0
+ puts "Error: 2-nd pcurve is not exist"
+ }
+}
+
+if { $OK < 1 } {
+ puts "Error: bad pcurves"
+}
--- /dev/null
+puts "============"
+puts "0029441: Modeling Algorithms - Incorrect intersection curves between faces"
+puts "============"
+puts ""
+
+binrestore [locate_data_file bug28892_tools.bin] b
+
+set OK 1
+explode b so
+explode b_8 f; copy b_8_1 f1
+explode b_13 f; copy b_13_5 f2
+don f1 f2
+bopcurves f1 f2 -2d
+
+if {[isdraw c2d1_1]} {
+ puts "check extremity of 1-st pcurve x ~ 5.2714710662, |dx| ~ 0, |dy| >> |dx|"
+ 2dcvalue c2d1_1 1 x y dx dy
+ set ex [expr abs([dval (x-5.2714710662)])]
+ set edxdy [expr abs([dval dx/dy])]
+ if {$ex > 1.e-8 || $edxdy > 1.e-10} {
+ puts "Extremities of 1-st pcurve are wrong"
+ set OK 0
+ } else {
+ puts "Extremities of 1-st pcurve are valid"
+ }
+} else {
+ set OK 0
+ puts "Error: 1-st pcurve is not exist"
+}
+
+if { $OK > 0 } {
+ if {[isdraw c2d1_2]} {
+ puts "check extremity of 2-nd pcurve x ~ 5.2705066089, |dx| ~ 0, |dy| >> |dx|"
+ 2dcvalue c2d1_2 1 x y dx dy
+ set ex [expr abs([dval (x-5.2705066089)])]
+ set edxdy [expr abs([dval dx/dy])]
+ if {$ex > 1.e-8 || $edxdy > 1.e-10} {
+ puts "Extremities of 2-nd pcurve are wrong"
+ set OK 0
+ } else {
+ puts "Extremities of 2-nd pcurve are valid"
+ }
+ } else {
+ set OK 0
+ puts "Error: 2-nd pcurve is not exist"
+ }
+}
+
+if { $OK < 1 } {
+ puts "Error: bad pcurves"
+}