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

0025818: IntTools_FaceFace throws Standard_ConstructionError with two unbounded planes

Changes:
class IntTools_FaceFace
    - method:
 void IntTools_FaceFace::Perform(const TopoDS_Face& aF1,
                                const TopoDS_Face& aF2)
The treatment of infinite planes was corrected.

Test case for issue CR25818
This commit is contained in:
pkv 2015-03-05 15:02:49 +03:00 committed by bugmaster
parent ef237d732d
commit 9a5a19e98f
2 changed files with 58 additions and 34 deletions

View File

@ -303,6 +303,12 @@ static
const TopoDS_Face& theFace, const TopoDS_Face& theFace,
const Handle(IntTools_Context)& theContext); const Handle(IntTools_Context)& theContext);
static
void CorrectPlaneBoundaries(Standard_Real& aUmin,
Standard_Real& aUmax,
Standard_Real& aVmin,
Standard_Real& aVmax);
//======================================================================= //=======================================================================
//function : //function :
//purpose : //purpose :
@ -503,7 +509,7 @@ static Standard_Boolean isTreatAnalityc(const TopoDS_Face& theF1,
//function : Perform //function : Perform
//purpose : intersect surfaces of the faces //purpose : intersect surfaces of the faces
//======================================================================= //=======================================================================
void IntTools_FaceFace::Perform(const TopoDS_Face& aF1, void IntTools_FaceFace::Perform(const TopoDS_Face& aF1,
const TopoDS_Face& aF2) const TopoDS_Face& aF2)
{ {
Standard_Boolean RestrictLine = Standard_False, hasCone = Standard_False; Standard_Boolean RestrictLine = Standard_False, hasCone = Standard_False;
@ -573,24 +579,13 @@ static Standard_Boolean isTreatAnalityc(const TopoDS_Face& theF1,
if(aType1==GeomAbs_Plane && aType2==GeomAbs_Plane) { if(aType1==GeomAbs_Plane && aType2==GeomAbs_Plane) {
Standard_Real umin, umax, vmin, vmax; Standard_Real umin, umax, vmin, vmax;
Standard_Real dU, dV;
// //
BRepTools::UVBounds(myFace1, umin, umax, vmin, vmax); BRepTools::UVBounds(myFace1, umin, umax, vmin, vmax);
dU=0.1*(umax-umin); CorrectPlaneBoundaries(umin, umax, vmin, vmax);
dV=0.1*(vmax-vmin);
umin=umin-dU;
umax=umax+dU;
vmin=vmin-dV;
vmax=vmax+dV;
myHS1->ChangeSurface().Load(S1, umin, umax, vmin, vmax); myHS1->ChangeSurface().Load(S1, umin, umax, vmin, vmax);
// //
BRepTools::UVBounds(myFace2, umin, umax, vmin, vmax); BRepTools::UVBounds(myFace2, umin, umax, vmin, vmax);
dU=0.1*(umax-umin); CorrectPlaneBoundaries(umin, umax, vmin, vmax);
dV=0.1*(vmax-vmin);
umin=umin-dU;
umax=umax+dU;
vmin=vmin-dV;
vmax=vmax+dV;
myHS2->ChangeSurface().Load(S2, umin, umax, vmin, vmax); myHS2->ChangeSurface().Load(S2, umin, umax, vmin, vmax);
// //
Standard_Real TolAng = 1.e-8; Standard_Real TolAng = 1.e-8;
@ -630,18 +625,10 @@ static Standard_Boolean isTreatAnalityc(const TopoDS_Face& theF1,
if ((aType1==GeomAbs_Plane) && isFace2Quad) if ((aType1==GeomAbs_Plane) && isFace2Quad)
{ {
Standard_Real dU, dV;
// F1
Standard_Real umin, umax, vmin, vmax; Standard_Real umin, umax, vmin, vmax;
BRepTools::UVBounds(myFace1, umin, umax, vmin, vmax); // F1
BRepTools::UVBounds(myFace1, umin, umax, vmin, vmax);
dU=0.1*(umax-umin); CorrectPlaneBoundaries(umin, umax, vmin, vmax);
dV=0.1*(vmax-vmin);
umin=umin-dU;
umax=umax+dU;
vmin=vmin-dV;
vmax=vmax+dV;
myHS1->ChangeSurface().Load(S1, umin, umax, vmin, vmax); myHS1->ChangeSurface().Load(S1, umin, umax, vmin, vmax);
// F2 // F2
BRepTools::UVBounds(myFace2, umin, umax, vmin, vmax); BRepTools::UVBounds(myFace2, umin, umax, vmin, vmax);
@ -655,21 +642,14 @@ static Standard_Boolean isTreatAnalityc(const TopoDS_Face& theF1,
} }
else if ((aType2==GeomAbs_Plane) && isFace1Quad) else if ((aType2==GeomAbs_Plane) && isFace1Quad)
{ {
Standard_Real dU, dV;
//F1
Standard_Real umin, umax, vmin, vmax; Standard_Real umin, umax, vmin, vmax;
//F1
BRepTools::UVBounds(myFace1, umin, umax, vmin, vmax); BRepTools::UVBounds(myFace1, umin, umax, vmin, vmax);
CorrectSurfaceBoundaries(myFace1, (aTolF1 + aTolF2) * 2., umin, umax, vmin, vmax); CorrectSurfaceBoundaries(myFace1, (aTolF1 + aTolF2) * 2., umin, umax, vmin, vmax);
myHS1->ChangeSurface().Load(S1, umin, umax, vmin, vmax); myHS1->ChangeSurface().Load(S1, umin, umax, vmin, vmax);
// F2 // F2
BRepTools::UVBounds(myFace2, umin, umax, vmin, vmax); BRepTools::UVBounds(myFace2, umin, umax, vmin, vmax);
dU=0.1*(umax-umin); CorrectPlaneBoundaries(umin, umax, vmin, vmax);
dV=0.1*(vmax-vmin);
umin=umin-dU;
umax=umax+dU;
vmin=vmin-dV;
vmax=vmax+dV;
myHS2->ChangeSurface().Load(S2, umin, umax, vmin, vmax); myHS2->ChangeSurface().Load(S2, umin, umax, vmin, vmax);
// //
if( aType1==GeomAbs_Cone ) { if( aType1==GeomAbs_Cone ) {
@ -4988,3 +4968,29 @@ Standard_Real MaxDistance(const Handle(Geom_Curve)& theC,
} }
return !bRet; return !bRet;
} }
//=======================================================================
//function : CorrectPlaneBoundaries
//purpose :
//=======================================================================
void CorrectPlaneBoundaries(Standard_Real& aUmin,
Standard_Real& aUmax,
Standard_Real& aVmin,
Standard_Real& aVmax)
{
if (!(Precision::IsInfinite(aUmin) ||
Precision::IsInfinite(aUmax))) {
Standard_Real dU;
//
dU=0.1*(aUmax-aUmin);
aUmin=aUmin-dU;
aUmax=aUmax+dU;
}
if (!(Precision::IsInfinite(aVmin) ||
Precision::IsInfinite(aVmax))) {
Standard_Real dV;
//
dV=0.1*(aVmax-aVmin);
aVmin=aVmin-dV;
aVmax=aVmax+dV;
}
}

18
tests/bugs/modalg_5/bug25818 Executable file
View File

@ -0,0 +1,18 @@
puts "============"
puts "OCC25818"
puts "============"
puts ""
#######################################################################
# IntTools_FaceFace throws Standard_ConstructionError with two unbounded planes
#######################################################################
plane pn1 0 0 0 0 0 1 1 0 0
plane pn2 0 0 0 1 0 0 0 1 0
mkface f1 pn1
mkface f2 pn2
bopcurves f1 f2
smallview
fit
set only_screen_axo 1