mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-10 18:51:21 +03:00
0024359: Crash on BRepAlgoAPI_Fuse
Test case for issue CR24359
This commit is contained in:
parent
d4a2c5155a
commit
ef2d8af761
@ -133,6 +133,7 @@ static gp_Pnt2d Function_Value(const Standard_Real U,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( UCouture) {
|
if ( UCouture) {
|
||||||
|
if(S < U1 || S > U2)
|
||||||
S = ElCLib::InPeriod(S, U1, U2);
|
S = ElCLib::InPeriod(S, U1, U2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -142,8 +143,10 @@ static gp_Pnt2d Function_Value(const Standard_Real U,
|
|||||||
T = M_PI - T;
|
T = M_PI - T;
|
||||||
S = M_PI + S;
|
S = M_PI + S;
|
||||||
}
|
}
|
||||||
|
if(S > U1 || S < U2)
|
||||||
S = ElCLib::InPeriod(S, U1, U2);
|
S = ElCLib::InPeriod(S, U1, U2);
|
||||||
}
|
}
|
||||||
|
if(T < V1 || T > V2)
|
||||||
T = ElCLib::InPeriod(T, V1, V2);
|
T = ElCLib::InPeriod(T, V1, V2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -477,18 +480,60 @@ static void Function_SetUVBounds(Standard_Real& myU1,
|
|||||||
// box+sphere >>
|
// box+sphere >>
|
||||||
Standard_Real UU = 0.;
|
Standard_Real UU = 0.;
|
||||||
ElSLib::Parameters(SP, P1, U1, V1);
|
ElSLib::Parameters(SP, P1, U1, V1);
|
||||||
|
Standard_Real eps = 2.*Epsilon(1.);
|
||||||
|
Standard_Real dt = Max(Precision::PConfusion(), 0.01*(W2-W1));
|
||||||
|
if(Abs(U1) < eps)
|
||||||
|
{
|
||||||
|
//May be U1 must be equal 2*PI?
|
||||||
|
gp_Pnt Pd = myCurve->Value(W1+dt);
|
||||||
|
Standard_Real ud, vd;
|
||||||
|
ElSLib::Parameters(SP, Pd, ud, vd);
|
||||||
|
if(Abs(U1 - ud) > M_PI)
|
||||||
|
{
|
||||||
|
U1 = 2.*M_PI;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(Abs(2.*M_PI - U1) < eps)
|
||||||
|
{
|
||||||
|
//maybe U1 = 0.?
|
||||||
|
gp_Pnt Pd = myCurve->Value(W1+dt);
|
||||||
|
Standard_Real ud, vd;
|
||||||
|
ElSLib::Parameters(SP, Pd, ud, vd);
|
||||||
|
if(Abs(U1 - ud) > M_PI)
|
||||||
|
{
|
||||||
|
U1 = 0.;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//
|
||||||
ElSLib::Parameters(SP, P2, U2, V1);
|
ElSLib::Parameters(SP, P2, U2, V1);
|
||||||
|
if(Abs(U2) < eps)
|
||||||
|
{
|
||||||
|
//May be U2 must be equal 2*PI?
|
||||||
|
gp_Pnt Pd = myCurve->Value(W2-dt);
|
||||||
|
Standard_Real ud, vd;
|
||||||
|
ElSLib::Parameters(SP, Pd, ud, vd);
|
||||||
|
if(Abs(U2 - ud) > M_PI)
|
||||||
|
{
|
||||||
|
U2 = 2.*M_PI;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(Abs(2.*M_PI - U2) < eps)
|
||||||
|
{
|
||||||
|
//maybe U2 = 0.?
|
||||||
|
gp_Pnt Pd = myCurve->Value(W2-dt);
|
||||||
|
Standard_Real ud, vd;
|
||||||
|
ElSLib::Parameters(SP, Pd, ud, vd);
|
||||||
|
if(Abs(U2 - ud) > M_PI)
|
||||||
|
{
|
||||||
|
U2 = 0.;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//
|
||||||
ElSLib::Parameters(SP, P, UU, V1);
|
ElSLib::Parameters(SP, P, UU, V1);
|
||||||
Standard_Real UUmi = Min(Min(U1,UU),Min(UU,U2));
|
Standard_Real UUmi = Min(Min(U1,UU),Min(UU,U2));
|
||||||
Standard_Real UUma = Max(Max(U1,UU),Max(UU,U2));
|
Standard_Real UUma = Max(Max(U1,UU),Max(UU,U2));
|
||||||
Standard_Boolean reCalc = ((UUmi >= 0. && UUmi <= M_PI) && (UUma >= 0. && UUma <= M_PI));
|
Standard_Boolean reCalc = ((UUmi >= 0. && UUmi <= M_PI) && (UUma >= 0. && UUma <= M_PI));
|
||||||
// box+sphere <<
|
// box+sphere <<
|
||||||
|
|
||||||
ElSLib::Parameters(SP, P1, U1, V1);//*
|
|
||||||
//
|
|
||||||
Parameters(myCurve, mySurface, P1, 1, aTPC, U1, V1);
|
|
||||||
//
|
|
||||||
//
|
|
||||||
P2 = myCurve->Value(W1+M_PI/8);
|
P2 = myCurve->Value(W1+M_PI/8);
|
||||||
ElSLib::Parameters(SP,P2,U2,V2);
|
ElSLib::Parameters(SP,P2,U2,V2);
|
||||||
//
|
//
|
||||||
@ -550,35 +595,6 @@ static void Function_SetUVBounds(Standard_Real& myU1,
|
|||||||
myU2 = U+M_PI;
|
myU2 = U+M_PI;
|
||||||
VCouture = Standard_False;
|
VCouture = Standard_False;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
ElSLib::Parameters(SP,P1,U1,V1);//*
|
|
||||||
//
|
|
||||||
Parameters(myCurve, mySurface, P1, 1, aTPC, U1, V1);
|
|
||||||
//
|
|
||||||
P2 = myCurve->Value(W1+M_PI/8);
|
|
||||||
ElSLib::Parameters(SP,P2,U2,V2);
|
|
||||||
|
|
||||||
if ( Abs(U1-U2) > M_PI) { // on traverse la couture
|
|
||||||
if ( U1 > M_PI) {
|
|
||||||
myU1 = U1;
|
|
||||||
myU2 = U1+2*M_PI;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
myU2 = U1;
|
|
||||||
myU1 = U1-2*M_PI;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else { // on ne traverse pas la couture
|
|
||||||
if ( U1 > U2) {
|
|
||||||
myU2 = U1;
|
|
||||||
myU1 = U1-2*M_PI;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
myU1 = U1;
|
|
||||||
myU2 = U1+2*M_PI;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// box+sphere >>
|
// box+sphere >>
|
||||||
@ -589,9 +605,8 @@ static void Function_SetUVBounds(Standard_Real& myU1,
|
|||||||
Standard_Real U,V;
|
Standard_Real U,V;
|
||||||
ElSLib::SphereParameters(gp_Ax3(gp::XOY()),1,Center, U, V);
|
ElSLib::SphereParameters(gp_Ax3(gp::XOY()),1,Center, U, V);
|
||||||
myU1 = U-M_PI;
|
myU1 = U-M_PI;
|
||||||
myU2 = U+M_PI;
|
|
||||||
myU1 = Min(UU1,myU1);
|
myU1 = Min(UU1,myU1);
|
||||||
myU2 = Max(UU2,myU2);
|
myU2 = myU1 + 2.*M_PI;
|
||||||
}
|
}
|
||||||
// box+sphere <<
|
// box+sphere <<
|
||||||
|
|
||||||
@ -751,58 +766,6 @@ static void Function_SetUVBounds(Standard_Real& myU1,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
//=======================================================================
|
|
||||||
//function : Parameters
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
void Parameters(const Handle(Adaptor3d_HCurve)& myCurve,
|
|
||||||
const Handle(Adaptor3d_HSurface)& mySurface,
|
|
||||||
const gp_Pnt& aP1,
|
|
||||||
const Standard_Integer iFirst,
|
|
||||||
const Standard_Real aTolU,
|
|
||||||
Standard_Real& aU,
|
|
||||||
Standard_Real& aV)
|
|
||||||
{
|
|
||||||
Standard_Real aTwoPI, aU1, aV1, aU2, aV2, aRSp, aTol3D;
|
|
||||||
Standard_Real aTF, aTL, aT2, dT;
|
|
||||||
GeomAbs_SurfaceType aSType;
|
|
||||||
GeomAbs_CurveType aCType;
|
|
||||||
gp_Pnt aP2;
|
|
||||||
//
|
|
||||||
aTwoPI=2.*M_PI;
|
|
||||||
//
|
|
||||||
aSType=mySurface->GetType();
|
|
||||||
aCType=myCurve->GetType();
|
|
||||||
//
|
|
||||||
if (aSType==GeomAbs_Sphere && aCType==GeomAbs_Circle) {
|
|
||||||
gp_Sphere aSp=mySurface->Sphere();
|
|
||||||
//
|
|
||||||
aRSp=aSp.Radius();
|
|
||||||
aTol3D=aRSp*aTolU;
|
|
||||||
//
|
|
||||||
aTF = myCurve->FirstParameter();
|
|
||||||
aTL = myCurve->LastParameter ();
|
|
||||||
dT=myCurve->Resolution(aTol3D);
|
|
||||||
//
|
|
||||||
ElSLib::Parameters(aSp, aP1, aU1, aV1);
|
|
||||||
if (fabs(aU)<aTolU || fabs(aU-aTwoPI)<aTolU){
|
|
||||||
aT2=aTF+dT;
|
|
||||||
if (!iFirst) {
|
|
||||||
aT2=aTL-dT;
|
|
||||||
}
|
|
||||||
//
|
|
||||||
aP2=myCurve->Value(aT2);
|
|
||||||
ElSLib::Parameters(aSp, aP2, aU2, aV2);
|
|
||||||
//
|
|
||||||
aU1=0.;
|
|
||||||
if (aU2>M_PI) {
|
|
||||||
aU1=aTwoPI;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
aU=aU1;
|
|
||||||
aV=aV1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//
|
//
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//classn : ProjLib_Function
|
//classn : ProjLib_Function
|
||||||
|
76
tests/bugs/modalg_5/bug24359
Executable file
76
tests/bugs/modalg_5/bug24359
Executable file
@ -0,0 +1,76 @@
|
|||||||
|
puts "================"
|
||||||
|
puts "OCC24359"
|
||||||
|
puts "================"
|
||||||
|
puts ""
|
||||||
|
#######################################################
|
||||||
|
# Crash on BRepAlgoAPI_Fuse
|
||||||
|
#######################################################
|
||||||
|
|
||||||
|
psphere s01 2; ttranslate s01 1 1 1
|
||||||
|
psphere s02 2; ttranslate s02 1 1 2
|
||||||
|
psphere s03 2; ttranslate s03 1 1 3
|
||||||
|
psphere s04 2; ttranslate s04 1 2 1
|
||||||
|
psphere s05 2; ttranslate s05 1 2 2
|
||||||
|
psphere s06 2; ttranslate s06 1 2 3
|
||||||
|
psphere s07 2; ttranslate s07 1 3 1
|
||||||
|
psphere s08 2; ttranslate s08 1 3 2
|
||||||
|
psphere s09 2; ttranslate s09 1 3 3
|
||||||
|
psphere s10 2; ttranslate s10 2 1 1
|
||||||
|
psphere s11 2; ttranslate s11 2 1 2
|
||||||
|
psphere s12 2; ttranslate s12 2 1 3
|
||||||
|
psphere s13 2; ttranslate s13 2 2 1
|
||||||
|
psphere s14 2; ttranslate s14 2 2 2
|
||||||
|
psphere s15 2; ttranslate s15 2 2 3
|
||||||
|
psphere s16 2; ttranslate s16 2 3 1
|
||||||
|
psphere s17 2; ttranslate s17 2 3 2
|
||||||
|
psphere s18 2; ttranslate s18 2 3 3
|
||||||
|
psphere s19 2; ttranslate s19 3 1 1
|
||||||
|
psphere s20 2; ttranslate s20 3 1 2
|
||||||
|
psphere s21 2; ttranslate s21 3 1 3
|
||||||
|
psphere s22 2; ttranslate s22 3 2 1
|
||||||
|
psphere s23 2; ttranslate s23 3 2 2
|
||||||
|
psphere s24 2; ttranslate s24 3 2 3
|
||||||
|
psphere s25 2; ttranslate s25 3 3 1
|
||||||
|
psphere s26 2; ttranslate s26 3 3 2
|
||||||
|
psphere s27 2; ttranslate s27 3 3 3
|
||||||
|
|
||||||
|
bop s01 s02; bopfuse s
|
||||||
|
bop s s03; bopfuse s
|
||||||
|
bop s s04; bopfuse s
|
||||||
|
bop s s05; bopfuse s
|
||||||
|
bop s s06; bopfuse s
|
||||||
|
bop s s07; bopfuse s
|
||||||
|
bop s s08; bopfuse s
|
||||||
|
bop s s09; bopfuse s
|
||||||
|
bop s s10; bopfuse s
|
||||||
|
bop s s11; bopfuse s
|
||||||
|
bop s s12; bopfuse s
|
||||||
|
bop s s13; bopfuse s
|
||||||
|
bop s s14; bopfuse s
|
||||||
|
bop s s15; bopfuse s
|
||||||
|
bop s s16; bopfuse s
|
||||||
|
bop s s17; bopfuse s
|
||||||
|
bop s s18; bopfuse s
|
||||||
|
bop s s19; bopfuse s
|
||||||
|
bop s s20; bopfuse s
|
||||||
|
bop s s21; bopfuse s
|
||||||
|
bop s s22; bopfuse s
|
||||||
|
bop s s23; bopfuse s
|
||||||
|
bop s s24; bopfuse s
|
||||||
|
bop s s25; bopfuse s
|
||||||
|
bop s s26; bopfuse s
|
||||||
|
bop s s27; bopfuse result
|
||||||
|
|
||||||
|
set nb_v_good 60
|
||||||
|
set nb_e_good 105
|
||||||
|
set nb_w_good 29
|
||||||
|
set nb_f_good 29
|
||||||
|
set nb_sh_good 1
|
||||||
|
set nb_sol_good 1
|
||||||
|
set nb_compsol_good 0
|
||||||
|
set nb_compound_good 1
|
||||||
|
set nb_shape_good 226
|
||||||
|
|
||||||
|
set square 150.187
|
||||||
|
|
||||||
|
set 2dviewer 1
|
Loading…
x
Reference in New Issue
Block a user