1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-04 18:06:22 +03:00

0025248: Curve-Surface intersection algorithm raises exception

All necessary comments are into the program code.

Test case for issue CR25248
This commit is contained in:
nbv 2014-09-25 15:24:55 +04:00 committed by bugmaster
parent d538d7a221
commit b89b1e0816
3 changed files with 142 additions and 98 deletions

View File

@ -115,7 +115,10 @@ is Create returns Tool from Intf;
fields nbSeg : Integer from Standard; fields nbSeg : Integer from Standard;
beginOnCurve : Real from Standard [6]; beginOnCurve : Real from Standard [6];
endOnCurve : Real from Standard [6]; endOnCurve : Real from Standard [6];
-- Code of every side of BndBox.
bord : Integer from Standard [12]; bord : Integer from Standard [12];
xint : Real from Standard [12]; xint : Real from Standard [12];
yint : Real from Standard [12]; yint : Real from Standard [12];
zint : Real from Standard [12]; zint : Real from Standard [12];

View File

@ -726,25 +726,6 @@ void Intf_Tool::HyprBox(const gp_Hypr& theHypr,
} }
boxHypr.Update(Xmin, Ymin, Zmin, Xmax, Ymax, Zmax); boxHypr.Update(Xmin, Ymin, Zmin, Xmax, Ymax, Zmax);
// //
Standard_Integer npj, npk;
Standard_Real parmin;
for (npi=0; npi<nbPi; npi++) {
npk=npi;
for (npj=npi+1; npj<nbPi; npj++) {
if (parint[npj]<parint[npk]) {
npk=npj;
}
}
if (npk!=npi) {
parmin=parint[npk];
parint[npk]=parint[npi];
parint[npi]=parmin;
npj=bord[npk];
bord[npk]=bord[npi];
bord[npi]=npj;
}
}
//
gp_Pnt Pn; gp_Pnt Pn;
gp_Vec Tan; gp_Vec Tan;
Standard_Real sinan=0; Standard_Real sinan=0;
@ -851,7 +832,7 @@ Standard_Integer Intf_Tool::Inters3d(const gp_Hypr& theCurv,
if (!Domain.IsOpenXmin()) { if (!Domain.IsOpenXmin()) {
IntAna_IntConicQuad Inters1(theCurv, IntAna_IntConicQuad Inters1(theCurv,
gp_Pln(1., 0., 0., xmin), gp_Pln(1., 0., 0., -xmin),
Precision::Angular()); Precision::Angular());
if (Inters1.IsDone()) { if (Inters1.IsDone()) {
if (!Inters1.IsInQuadric()) { if (!Inters1.IsInQuadric()) {
@ -872,7 +853,7 @@ Standard_Integer Intf_Tool::Inters3d(const gp_Hypr& theCurv,
if (!Domain.IsOpenYmin()) { if (!Domain.IsOpenYmin()) {
IntAna_IntConicQuad Inters1(theCurv, IntAna_IntConicQuad Inters1(theCurv,
gp_Pln( 0., 1., 0., ymin), gp_Pln( 0., 1., 0., -ymin),
Precision::Angular()); Precision::Angular());
if (Inters1.IsDone()) { if (Inters1.IsDone()) {
if (!Inters1.IsInQuadric()) { if (!Inters1.IsInQuadric()) {
@ -893,7 +874,7 @@ Standard_Integer Intf_Tool::Inters3d(const gp_Hypr& theCurv,
if (!Domain.IsOpenZmin()) { if (!Domain.IsOpenZmin()) {
IntAna_IntConicQuad Inters1(theCurv, IntAna_IntConicQuad Inters1(theCurv,
gp_Pln( 0., 0., 1., zmin), gp_Pln( 0., 0., 1., -zmin),
Precision::Angular()); Precision::Angular());
if (Inters1.IsDone()) { if (Inters1.IsDone()) {
if (!Inters1.IsInQuadric()) { if (!Inters1.IsInQuadric()) {
@ -974,7 +955,55 @@ Standard_Integer Intf_Tool::Inters3d(const gp_Hypr& theCurv,
} }
} }
} }
return nbpi;
Standard_Integer aNbDiffPoints = nbpi;
//Sort parint and check if parint contains several
//matched values. If that is true they will be deleted.
for(Standard_Integer i = nbpi - 1; i > 0 ; i--)
{
for(Standard_Integer j = 0; j < i; j++)
{
if(parint[i] <= parint[j])
{
Standard_Real aTemp = parint[i];
parint[i] = parint[j];
parint[j] = aTemp;
aTemp = zint[i];
zint[i] = zint[j];
zint[j] = aTemp;
aTemp = yint[i];
yint[i] = yint[j];
yint[j] = aTemp;
aTemp = xint[i];
xint[i] = xint[j];
xint[j] = aTemp;
aTemp = bord[i];
bord[i] = bord[j];
bord[j] = RealToInt(aTemp);
}
if((i < nbpi - 1) && IsEqual(parint[i], parint[i+1]))
{
for(Standard_Integer k = i + 1; k < aNbDiffPoints; k++)
{
parint[k-1] = parint[k];
zint[k-1] = zint[k];
yint[k-1] = yint[k];
xint[k-1] = xint[k];
bord[k-1] = bord[k];
}
aNbDiffPoints--;
}
}
}
return aNbDiffPoints;
} }

12
tests/bugs/modalg_5/bug25248 Executable file
View File

@ -0,0 +1,12 @@
puts "========="
puts "CR25248"
puts "========="
puts ""
###############################
## Curve-Surface intersection algorithm raises exception
###############################
restore [locate_data_file bug25248_c.draw] c
restore [locate_data_file bug25111_s2.draw] s
intersect i c s