1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

0029441: Modeling Algorithms - Incorrect intersection curves between faces

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
This commit is contained in:
ifv
2020-11-24 14:17:03 +03:00
committed by bugmaster
parent 59500bb229
commit a2cb8561eb
6 changed files with 164 additions and 13 deletions

View File

@@ -359,6 +359,8 @@ void ApproxInt_Approx::Perform(const TheISurface& ISurf,
isTheQuadFirst? ApproxInt_TheImpPrmSvSurfaces(ISurf, PSurf):
ApproxInt_TheImpPrmSvSurfaces(PSurf, ISurf);
myImpPrmSvSurfaces.SetUseSolver(Standard_False);
const Standard_Integer nbpntbez = indicemax-indicemin;
if(nbpntbez < aMinNbPointsForApprox)
{

View File

@@ -336,6 +336,7 @@ ApproxInt_ImpPrmSvSurfaces::ApproxInt_ImpPrmSvSurfaces( const TheISurface& ISurf
MyImplicitFirst(Standard_True),
MyZerImpFunc(PSurf,ISurf)
{
SetUseSolver(Standard_True);
}
//--------------------------------------------------------------------------------
ApproxInt_ImpPrmSvSurfaces::ApproxInt_ImpPrmSvSurfaces( const ThePSurface& PSurf
@@ -347,6 +348,7 @@ ApproxInt_ImpPrmSvSurfaces::ApproxInt_ImpPrmSvSurfaces( const ThePSurface& PSurf
MyImplicitFirst(Standard_False),
MyZerImpFunc(PSurf,ISurf)
{
SetUseSolver(Standard_True);
}
//--------------------------------------------------------------------------------
void ApproxInt_ImpPrmSvSurfaces::Pnt(const Standard_Real u1,
@@ -517,15 +519,21 @@ Standard_Boolean ApproxInt_ImpPrmSvSurfaces::Compute( 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));
@@ -907,10 +915,15 @@ ApproxInt_ImpPrmSvSurfaces::FillInitialVectorOfSolution(const Standard_Real u1,
//----------------------------------------------------
//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;
}

View File

@@ -317,6 +317,11 @@ ApproxInt_MultiLine
//-- 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;
@@ -564,6 +569,7 @@ ApproxInt_MultiLine
if((temp->NbPnts() >= NbPntsToInsert + High - Low + 1) && (CodeErreur==0))
{
((TheSvSurfaces *)PtrOnmySvSurfaces)->SetUseSolver(aSaveUseSolver);
return (ApproxInt_MultiLine( temp,
(High-Low>10)? PtrOnmySvSurfaces : NULL,
nbp3d,
@@ -579,6 +585,7 @@ ApproxInt_MultiLine
{
//-- 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,
@@ -607,7 +614,13 @@ Standard_Boolean
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;
@@ -682,7 +695,10 @@ Standard_Boolean
}
if (!OtherLineMade)
{
((TheSvSurfaces *)PtrOnmySvSurfaces)->SetUseSolver(aSaveUseSolver);
return Standard_False;
}
#ifdef DRAW
char* name = new char[100];
@@ -700,6 +716,7 @@ Standard_Boolean
}
#endif
Handle(TheLine) temp = new TheLine(ResultPntOn2SLine,Standard_False);
((TheSvSurfaces *)PtrOnmySvSurfaces)->SetUseSolver(aSaveUseSolver);
theNewMultiLine = ApproxInt_MultiLine( temp,
PtrOnmySvSurfaces,
nbp3d,

View File

@@ -28,6 +28,18 @@ class gp_Vec;
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
{
@@ -70,18 +82,26 @@ public:
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;