mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-16 10:08:36 +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:
parent
59500bb229
commit
a2cb8561eb
@ -359,6 +359,8 @@ void ApproxInt_Approx::Perform(const TheISurface& ISurf,
|
|||||||
isTheQuadFirst? ApproxInt_TheImpPrmSvSurfaces(ISurf, PSurf):
|
isTheQuadFirst? ApproxInt_TheImpPrmSvSurfaces(ISurf, PSurf):
|
||||||
ApproxInt_TheImpPrmSvSurfaces(PSurf, ISurf);
|
ApproxInt_TheImpPrmSvSurfaces(PSurf, ISurf);
|
||||||
|
|
||||||
|
myImpPrmSvSurfaces.SetUseSolver(Standard_False);
|
||||||
|
|
||||||
const Standard_Integer nbpntbez = indicemax-indicemin;
|
const Standard_Integer nbpntbez = indicemax-indicemin;
|
||||||
if(nbpntbez < aMinNbPointsForApprox)
|
if(nbpntbez < aMinNbPointsForApprox)
|
||||||
{
|
{
|
||||||
|
@ -336,6 +336,7 @@ ApproxInt_ImpPrmSvSurfaces::ApproxInt_ImpPrmSvSurfaces( const TheISurface& ISurf
|
|||||||
MyImplicitFirst(Standard_True),
|
MyImplicitFirst(Standard_True),
|
||||||
MyZerImpFunc(PSurf,ISurf)
|
MyZerImpFunc(PSurf,ISurf)
|
||||||
{
|
{
|
||||||
|
SetUseSolver(Standard_True);
|
||||||
}
|
}
|
||||||
//--------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------
|
||||||
ApproxInt_ImpPrmSvSurfaces::ApproxInt_ImpPrmSvSurfaces( const ThePSurface& PSurf
|
ApproxInt_ImpPrmSvSurfaces::ApproxInt_ImpPrmSvSurfaces( const ThePSurface& PSurf
|
||||||
@ -347,6 +348,7 @@ ApproxInt_ImpPrmSvSurfaces::ApproxInt_ImpPrmSvSurfaces( const ThePSurface& PSurf
|
|||||||
MyImplicitFirst(Standard_False),
|
MyImplicitFirst(Standard_False),
|
||||||
MyZerImpFunc(PSurf,ISurf)
|
MyZerImpFunc(PSurf,ISurf)
|
||||||
{
|
{
|
||||||
|
SetUseSolver(Standard_True);
|
||||||
}
|
}
|
||||||
//--------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------
|
||||||
void ApproxInt_ImpPrmSvSurfaces::Pnt(const Standard_Real u1,
|
void ApproxInt_ImpPrmSvSurfaces::Pnt(const Standard_Real u1,
|
||||||
@ -517,15 +519,21 @@ Standard_Boolean ApproxInt_ImpPrmSvSurfaces::Compute( Standard_Real& u1,
|
|||||||
return(Standard_False);
|
return(Standard_False);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Standard_Boolean aRsnldIsDone = Standard_False;
|
||||||
Standard_Real PourTesterU = X(1);
|
Standard_Real PourTesterU = X(1);
|
||||||
Standard_Real PourTesterV = X(2);
|
Standard_Real PourTesterV = X(2);
|
||||||
|
if (GetUseSolver())
|
||||||
|
{
|
||||||
math_FunctionSetRoot Rsnld(MyZerImpFunc);
|
math_FunctionSetRoot Rsnld(MyZerImpFunc);
|
||||||
Rsnld.SetTolerance(Tolerance);
|
Rsnld.SetTolerance(Tolerance);
|
||||||
Rsnld.Perform(MyZerImpFunc,X,BornInf,BornSup);
|
Rsnld.Perform(MyZerImpFunc, X, BornInf, BornSup);
|
||||||
if(Rsnld.IsDone()) {
|
aRsnldIsDone = Rsnld.IsDone();
|
||||||
MyHasBeenComputed = Standard_True;
|
if (aRsnldIsDone)
|
||||||
Rsnld.Root(X);
|
Rsnld.Root(X);
|
||||||
|
}
|
||||||
|
if(aRsnldIsDone || !GetUseSolver())
|
||||||
|
{
|
||||||
|
MyHasBeenComputed = Standard_True;
|
||||||
|
|
||||||
Standard_Real DistAvantApresU = Abs(PourTesterU-X(1));
|
Standard_Real DistAvantApresU = Abs(PourTesterU-X(1));
|
||||||
Standard_Real DistAvantApresV = Abs(PourTesterV-X(2));
|
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
|
//Make a small step from boundaries in order to avoid
|
||||||
//finding "outboundaried" solution (Rsnld -> NotDone).
|
//finding "outboundaried" solution (Rsnld -> NotDone).
|
||||||
if(X(1)-0.0000000001 <= binfu) X(1)=X(1)+0.0000001;
|
if (GetUseSolver())
|
||||||
if(X(1)+0.0000000001 >= bsupu) X(1)=X(1)-0.0000001;
|
{
|
||||||
if(X(2)-0.0000000001 <= binfv) X(2)=X(2)+0.0000001;
|
Standard_Real du = Max(Precision::Confusion(), ThePSurfaceTool::UResolution(aPSurf, Precision::Confusion()));
|
||||||
if(X(2)+0.0000000001 >= bsupv) X(2)=X(2)-0.0000001;
|
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 Standard_True;
|
||||||
}
|
}
|
||||||
|
@ -317,6 +317,11 @@ ApproxInt_MultiLine
|
|||||||
//-- return(*this);
|
//-- return(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Standard_Boolean aSaveUseSolver = ((TheSvSurfaces *)PtrOnmySvSurfaces)->GetUseSolver();
|
||||||
|
if (!aSaveUseSolver)
|
||||||
|
{
|
||||||
|
((TheSvSurfaces *)PtrOnmySvSurfaces)->SetUseSolver(Standard_True);
|
||||||
|
}
|
||||||
Standard_Integer NbPntsToInsert=aNbPntsToInsert;
|
Standard_Integer NbPntsToInsert=aNbPntsToInsert;
|
||||||
if(NbPntsToInsert<(High-Low)) NbPntsToInsert=(High-Low);
|
if(NbPntsToInsert<(High-Low)) NbPntsToInsert=(High-Low);
|
||||||
Standard_Integer NbPnts = NbPntsToInsert + High - Low + 1;
|
Standard_Integer NbPnts = NbPntsToInsert + High - Low + 1;
|
||||||
@ -564,6 +569,7 @@ ApproxInt_MultiLine
|
|||||||
|
|
||||||
if((temp->NbPnts() >= NbPntsToInsert + High - Low + 1) && (CodeErreur==0))
|
if((temp->NbPnts() >= NbPntsToInsert + High - Low + 1) && (CodeErreur==0))
|
||||||
{
|
{
|
||||||
|
((TheSvSurfaces *)PtrOnmySvSurfaces)->SetUseSolver(aSaveUseSolver);
|
||||||
return (ApproxInt_MultiLine( temp,
|
return (ApproxInt_MultiLine( temp,
|
||||||
(High-Low>10)? PtrOnmySvSurfaces : NULL,
|
(High-Low>10)? PtrOnmySvSurfaces : NULL,
|
||||||
nbp3d,
|
nbp3d,
|
||||||
@ -579,6 +585,7 @@ ApproxInt_MultiLine
|
|||||||
{
|
{
|
||||||
//-- cout<<" ApproxInt_MultiLine "<<endl;
|
//-- cout<<" ApproxInt_MultiLine "<<endl;
|
||||||
//-- cout<<" Pas de Rajout de points ds1min = "<<minds1<<" ds2min = "<<minds2<<endl;
|
//-- cout<<" Pas de Rajout de points ds1min = "<<minds1<<" ds2min = "<<minds2<<endl;
|
||||||
|
((TheSvSurfaces *)PtrOnmySvSurfaces)->SetUseSolver(aSaveUseSolver);
|
||||||
Handle(IntSurf_LineOn2S) vide1 = new IntSurf_LineOn2S();
|
Handle(IntSurf_LineOn2S) vide1 = new IntSurf_LineOn2S();
|
||||||
Handle(TheLine) vide = new TheLine(vide1,Standard_False);
|
Handle(TheLine) vide = new TheLine(vide1,Standard_False);
|
||||||
return (ApproxInt_MultiLine( vide,
|
return (ApproxInt_MultiLine( vide,
|
||||||
@ -608,6 +615,12 @@ Standard_Boolean
|
|||||||
if(PtrOnmySvSurfaces==NULL)
|
if(PtrOnmySvSurfaces==NULL)
|
||||||
return Standard_False;
|
return Standard_False;
|
||||||
|
|
||||||
|
Standard_Boolean aSaveUseSolver = ((TheSvSurfaces *)PtrOnmySvSurfaces)->GetUseSolver();
|
||||||
|
if (!aSaveUseSolver)
|
||||||
|
{
|
||||||
|
((TheSvSurfaces *)PtrOnmySvSurfaces)->SetUseSolver(Standard_True);
|
||||||
|
}
|
||||||
|
|
||||||
const Standard_Real SqTol3d = Precision::SquareConfusion();
|
const Standard_Real SqTol3d = Precision::SquareConfusion();
|
||||||
math_Vector tolerance(1,2);
|
math_Vector tolerance(1,2);
|
||||||
tolerance(1) = tolerance(2) = 1.e-8;
|
tolerance(1) = tolerance(2) = 1.e-8;
|
||||||
@ -682,7 +695,10 @@ Standard_Boolean
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!OtherLineMade)
|
if (!OtherLineMade)
|
||||||
|
{
|
||||||
|
((TheSvSurfaces *)PtrOnmySvSurfaces)->SetUseSolver(aSaveUseSolver);
|
||||||
return Standard_False;
|
return Standard_False;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef DRAW
|
#ifdef DRAW
|
||||||
char* name = new char[100];
|
char* name = new char[100];
|
||||||
@ -700,6 +716,7 @@ Standard_Boolean
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
Handle(TheLine) temp = new TheLine(ResultPntOn2SLine,Standard_False);
|
Handle(TheLine) temp = new TheLine(ResultPntOn2SLine,Standard_False);
|
||||||
|
((TheSvSurfaces *)PtrOnmySvSurfaces)->SetUseSolver(aSaveUseSolver);
|
||||||
theNewMultiLine = ApproxInt_MultiLine( temp,
|
theNewMultiLine = ApproxInt_MultiLine( temp,
|
||||||
PtrOnmySvSurfaces,
|
PtrOnmySvSurfaces,
|
||||||
nbp3d,
|
nbp3d,
|
||||||
|
@ -28,6 +28,18 @@ class gp_Vec;
|
|||||||
class gp_Vec2d;
|
class gp_Vec2d;
|
||||||
class IntSurf_PntOn2S;
|
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
|
class ApproxInt_SvSurfaces
|
||||||
{
|
{
|
||||||
@ -70,7 +82,15 @@ public:
|
|||||||
gp_Vec2d& Tg) = 0;
|
gp_Vec2d& Tg) = 0;
|
||||||
Standard_EXPORT virtual ~ApproxInt_SvSurfaces();
|
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:
|
protected:
|
||||||
@ -81,7 +101,7 @@ protected:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
Standard_Boolean myUseSolver;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
48
tests/lowalgos/intss/bug29441_1
Normal file
48
tests/lowalgos/intss/bug29441_1
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
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"
|
||||||
|
}
|
51
tests/lowalgos/intss/bug29441_2
Normal file
51
tests/lowalgos/intss/bug29441_2
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
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"
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user