mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-07-05 12:15:50 +03:00
0025937: Failed Cut Edge or Face by HalfSpace.
Addressing the causes of warnings. Test cases for issue CR25937
This commit is contained in:
parent
5e18f91719
commit
f47b8d2b37
@ -480,6 +480,17 @@ void BOPAlgo_BuilderFace::PerformAreas()
|
|||||||
//
|
//
|
||||||
myAreas.Clear();
|
myAreas.Clear();
|
||||||
//
|
//
|
||||||
|
if (myLoops.IsEmpty()) {
|
||||||
|
if (myContext->IsInfiniteFace(myFace)) {
|
||||||
|
aBB.MakeFace(aFace, aS, aLoc, aTol);
|
||||||
|
if (BRep_Tool::NaturalRestriction(myFace)) {
|
||||||
|
aBB.NaturalRestriction(aFace, Standard_True);
|
||||||
|
}
|
||||||
|
myAreas.Append(aFace);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//
|
||||||
// 1. Growthes and Holes -> aDMISB: [Index/ShapeBox2D]
|
// 1. Growthes and Holes -> aDMISB: [Index/ShapeBox2D]
|
||||||
aIt1.Initialize(myLoops);
|
aIt1.Initialize(myLoops);
|
||||||
for (k=0 ; aIt1.More(); aIt1.Next(), ++k) {
|
for (k=0 ; aIt1.More(); aIt1.Next(), ++k) {
|
||||||
|
@ -463,7 +463,17 @@ void BOPAlgo_BuilderSolid::PerformLoops()
|
|||||||
// 1. Shells Usual
|
// 1. Shells Usual
|
||||||
aIt.Initialize (myShapes);
|
aIt.Initialize (myShapes);
|
||||||
for (; aIt.More(); aIt.Next()) {
|
for (; aIt.More(); aIt.Next()) {
|
||||||
const TopoDS_Shape& aF=aIt.Value();
|
const TopoDS_Face& aF=*((TopoDS_Face*)&aIt.Value());
|
||||||
|
if (myContext->IsInfiniteFace(aF)) {
|
||||||
|
TopoDS_Shell aSh;
|
||||||
|
BRep_Builder aBB;
|
||||||
|
//
|
||||||
|
aBB.MakeShell(aSh);
|
||||||
|
aBB.Add(aSh, aF);
|
||||||
|
myLoops.Append(aSh);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
//
|
||||||
if (!myShapesToAvoid.Contains(aF)) {
|
if (!myShapesToAvoid.Contains(aF)) {
|
||||||
aSSp.AddStartElement(aF);
|
aSSp.AddStartElement(aF);
|
||||||
}
|
}
|
||||||
@ -511,9 +521,11 @@ void BOPAlgo_BuilderSolid::PerformLoops()
|
|||||||
// c. add all edges that are not processed to myShapesToAvoid
|
// c. add all edges that are not processed to myShapesToAvoid
|
||||||
aIt.Initialize (myShapes);
|
aIt.Initialize (myShapes);
|
||||||
for (; aIt.More(); aIt.Next()) {
|
for (; aIt.More(); aIt.Next()) {
|
||||||
const TopoDS_Shape& aF=aIt.Value();
|
const TopoDS_Face& aF=*((TopoDS_Face*)&aIt.Value());
|
||||||
if (!aMP.Contains(aF)) {
|
if (!myContext->IsInfiniteFace(aF)) {
|
||||||
myShapesToAvoid.Add(aF);
|
if (!aMP.Contains(aF)) {
|
||||||
|
myShapesToAvoid.Add(aF);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//=================================================
|
//=================================================
|
||||||
|
@ -26,12 +26,14 @@ class Context from IntTools
|
|||||||
|
|
||||||
uses
|
uses
|
||||||
|
|
||||||
|
Box from Bnd,
|
||||||
Pnt2d from gp,
|
Pnt2d from gp,
|
||||||
Pnt from gp,
|
Pnt from gp,
|
||||||
State from TopAbs,
|
State from TopAbs,
|
||||||
Curve from Geom,
|
Curve from Geom,
|
||||||
ProjectPointOnCurve from GeomAPI,
|
ProjectPointOnCurve from GeomAPI,
|
||||||
ProjectPointOnSurf from GeomAPI,
|
ProjectPointOnSurf from GeomAPI,
|
||||||
|
Shape from TopoDS,
|
||||||
Vertex from TopoDS,
|
Vertex from TopoDS,
|
||||||
Face from TopoDS,
|
Face from TopoDS,
|
||||||
Edge from TopoDS,
|
Edge from TopoDS,
|
||||||
@ -300,6 +302,18 @@ is
|
|||||||
--- Returns false if projection algorithm failed
|
--- Returns false if projection algorithm failed
|
||||||
--- other wiese returns true.
|
--- other wiese returns true.
|
||||||
---
|
---
|
||||||
|
BndBox(me:mutable;
|
||||||
|
theS:Shape from TopoDS)
|
||||||
|
returns Box from Bnd;
|
||||||
|
---C++: return &
|
||||||
|
--- Returns a reference to boundong box
|
||||||
|
--- for given shape <theS>
|
||||||
|
---
|
||||||
|
IsInfiniteFace(me:mutable;
|
||||||
|
theFace:Face from TopoDS)
|
||||||
|
returns Boolean from Standard;
|
||||||
|
---Purpose: Returns true if the solid <theFace> has
|
||||||
|
-- infinite bounds
|
||||||
|
|
||||||
fields
|
fields
|
||||||
myAllocator : BaseAllocator from BOPCol is protected;
|
myAllocator : BaseAllocator from BOPCol is protected;
|
||||||
@ -310,6 +324,7 @@ fields
|
|||||||
myProjPTMap :DataMapOfTransientAddress from BOPCol is protected;
|
myProjPTMap :DataMapOfTransientAddress from BOPCol is protected;
|
||||||
myHatcherMap :DataMapOfShapeAddress from BOPCol is protected;
|
myHatcherMap :DataMapOfShapeAddress from BOPCol is protected;
|
||||||
myProjSDataMap:DataMapOfShapeAddress from BOPCol is protected;
|
myProjSDataMap:DataMapOfShapeAddress from BOPCol is protected;
|
||||||
|
myBndBoxDataMap:DataMapOfShapeAddress from BOPCol is protected;
|
||||||
myCreateFlag :Integer from Standard is protected;
|
myCreateFlag :Integer from Standard is protected;
|
||||||
|
|
||||||
end Context;
|
end Context;
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
|
|
||||||
#include <BRep_Tool.hxx>
|
#include <BRep_Tool.hxx>
|
||||||
#include <BRepAdaptor_Surface.hxx>
|
#include <BRepAdaptor_Surface.hxx>
|
||||||
|
#include <BRepBndLib.hxx>
|
||||||
|
|
||||||
#include <IntTools_Tools.hxx>
|
#include <IntTools_Tools.hxx>
|
||||||
#include <IntTools_FClass2d.hxx>
|
#include <IntTools_FClass2d.hxx>
|
||||||
@ -56,6 +57,7 @@ IntTools_Context::IntTools_Context()
|
|||||||
myProjPTMap(100, myAllocator),
|
myProjPTMap(100, myAllocator),
|
||||||
myHatcherMap(100, myAllocator),
|
myHatcherMap(100, myAllocator),
|
||||||
myProjSDataMap(100, myAllocator),
|
myProjSDataMap(100, myAllocator),
|
||||||
|
myBndBoxDataMap(100, myAllocator),
|
||||||
myCreateFlag(0)
|
myCreateFlag(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -74,6 +76,7 @@ IntTools_Context::IntTools_Context
|
|||||||
myProjPTMap(100, myAllocator),
|
myProjPTMap(100, myAllocator),
|
||||||
myHatcherMap(100, myAllocator),
|
myHatcherMap(100, myAllocator),
|
||||||
myProjSDataMap(100, myAllocator),
|
myProjSDataMap(100, myAllocator),
|
||||||
|
myBndBoxDataMap(100, myAllocator),
|
||||||
myCreateFlag(1)
|
myCreateFlag(1)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -158,6 +161,69 @@ IntTools_Context::~IntTools_Context()
|
|||||||
myAllocator->Free(anAdr);
|
myAllocator->Free(anAdr);
|
||||||
}
|
}
|
||||||
myProjSDataMap.Clear();
|
myProjSDataMap.Clear();
|
||||||
|
//
|
||||||
|
Bnd_Box* pBox;
|
||||||
|
aIt.Initialize(myBndBoxDataMap);
|
||||||
|
for (; aIt.More(); aIt.Next()) {
|
||||||
|
anAdr=aIt.Value();
|
||||||
|
pBox=(Bnd_Box*)anAdr;
|
||||||
|
(*pBox).~Bnd_Box();
|
||||||
|
myAllocator->Free(anAdr);
|
||||||
|
}
|
||||||
|
myBndBoxDataMap.Clear();
|
||||||
|
}
|
||||||
|
//=======================================================================
|
||||||
|
//function : BndBox
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
Bnd_Box& IntTools_Context::BndBox(const TopoDS_Shape& aS)
|
||||||
|
{
|
||||||
|
Standard_Address anAdr;
|
||||||
|
Bnd_Box* pBox;
|
||||||
|
//
|
||||||
|
if (!myBndBoxDataMap.IsBound(aS)) {
|
||||||
|
//
|
||||||
|
pBox=(Bnd_Box*)myAllocator->Allocate(sizeof(Bnd_Box));
|
||||||
|
new (pBox) Bnd_Box();
|
||||||
|
//
|
||||||
|
Bnd_Box &aBox=*pBox;
|
||||||
|
BRepBndLib::Add(aS, aBox);
|
||||||
|
//
|
||||||
|
anAdr=(Standard_Address)pBox;
|
||||||
|
myBndBoxDataMap.Bind(aS, anAdr);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
anAdr=myBndBoxDataMap.Find(aS);
|
||||||
|
pBox=(Bnd_Box*)anAdr;
|
||||||
|
}
|
||||||
|
return *pBox;
|
||||||
|
}
|
||||||
|
//=======================================================================
|
||||||
|
//function : IsInfiniteFace
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
Standard_Boolean IntTools_Context::IsInfiniteFace
|
||||||
|
(const TopoDS_Face& aFace)
|
||||||
|
{
|
||||||
|
Standard_Boolean bRet;
|
||||||
|
Standard_Integer i;
|
||||||
|
Standard_Real aX[6];
|
||||||
|
//
|
||||||
|
bRet=Standard_False;
|
||||||
|
//
|
||||||
|
if (!BRep_Tool::NaturalRestriction(aFace)) {
|
||||||
|
return bRet;
|
||||||
|
}
|
||||||
|
//
|
||||||
|
Bnd_Box& aBox=BndBox(aFace);
|
||||||
|
//
|
||||||
|
aBox.Get(aX[0], aX[1], aX[2], aX[3], aX[4], aX[5]);
|
||||||
|
//
|
||||||
|
for (i=0; (i<6) && (!bRet); ++i) {
|
||||||
|
bRet=Precision::IsInfinite(aX[i]);
|
||||||
|
}
|
||||||
|
//
|
||||||
|
return bRet;
|
||||||
}
|
}
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : FClass2d
|
//function : FClass2d
|
||||||
|
5
tests/boolean/bcut_complex/O7
Normal file → Executable file
5
tests/boolean/bcut_complex/O7
Normal file → Executable file
@ -1,8 +1,9 @@
|
|||||||
puts "TODO #22911 ALL: Error : The $command is not valid. The area is 0."
|
puts "TODO #25937 ALL: Faulty shapes in variables faulty_1"
|
||||||
|
#puts "TODO #22911 ALL: Error : The $command is not valid. The area is 0."
|
||||||
|
|
||||||
restore [locate_data_file CTO908_topo108-o.brep] obj
|
restore [locate_data_file CTO908_topo108-o.brep] obj
|
||||||
restore [locate_data_file pro12903b.rle] out
|
restore [locate_data_file pro12903b.rle] out
|
||||||
|
|
||||||
bcut result obj out
|
bcut result obj out
|
||||||
|
|
||||||
set square 0
|
set square 281453
|
||||||
|
34
tests/bugs/modalg_6/bug25937_1
Executable file
34
tests/bugs/modalg_6/bug25937_1
Executable file
@ -0,0 +1,34 @@
|
|||||||
|
puts "============"
|
||||||
|
puts "OCC25937"
|
||||||
|
puts "============"
|
||||||
|
puts ""
|
||||||
|
###############################
|
||||||
|
## Failed Cut Edge or Face by HalfSpace.
|
||||||
|
###############################
|
||||||
|
|
||||||
|
# Cut a wire by halfspace
|
||||||
|
plane h 0 0 0 1 0 0
|
||||||
|
mkface h h
|
||||||
|
halfspace h h 10 0 0
|
||||||
|
polyline a -10 -10 0 10 -10 0 10 10 0 -10 10 0 -10 -10 0
|
||||||
|
|
||||||
|
bop a h
|
||||||
|
bopcut result
|
||||||
|
|
||||||
|
set length 40.
|
||||||
|
|
||||||
|
set nbshapes_expected "
|
||||||
|
Number of shapes in shape
|
||||||
|
VERTEX : 4
|
||||||
|
EDGE : 3
|
||||||
|
WIRE : 1
|
||||||
|
FACE : 0
|
||||||
|
SHELL : 0
|
||||||
|
SOLID : 0
|
||||||
|
COMPSOLID : 0
|
||||||
|
COMPOUND : 1
|
||||||
|
SHAPE : 9
|
||||||
|
"
|
||||||
|
checknbshapes result -ref ${nbshapes_expected} -t -m "Result obtained by Cut a wire by halfspace"
|
||||||
|
|
||||||
|
set 3dviewer 1
|
36
tests/bugs/modalg_6/bug25937_2
Executable file
36
tests/bugs/modalg_6/bug25937_2
Executable file
@ -0,0 +1,36 @@
|
|||||||
|
puts "============"
|
||||||
|
puts "OCC25937"
|
||||||
|
puts "============"
|
||||||
|
puts ""
|
||||||
|
###############################
|
||||||
|
## Failed Cut Edge or Face by HalfSpace.
|
||||||
|
###############################
|
||||||
|
|
||||||
|
# Cut a face by halfspace
|
||||||
|
plane h 0 0 0 1 0 0
|
||||||
|
mkface h h
|
||||||
|
halfspace h h 10 0 0
|
||||||
|
plane a 0 0 0 0 0 1
|
||||||
|
mkface a a -10 10 -10 10
|
||||||
|
|
||||||
|
bop a h
|
||||||
|
bopcut result
|
||||||
|
|
||||||
|
set length 60.
|
||||||
|
set square 200.
|
||||||
|
|
||||||
|
set nbshapes_expected "
|
||||||
|
Number of shapes in shape
|
||||||
|
VERTEX : 4
|
||||||
|
EDGE : 4
|
||||||
|
WIRE : 1
|
||||||
|
FACE : 1
|
||||||
|
SHELL : 1
|
||||||
|
SOLID : 0
|
||||||
|
COMPSOLID : 0
|
||||||
|
COMPOUND : 1
|
||||||
|
SHAPE : 12
|
||||||
|
"
|
||||||
|
checknbshapes result -ref ${nbshapes_expected} -t -m "Result obtained by Cut a wire by halfspace"
|
||||||
|
|
||||||
|
set 3dviewer 1
|
34
tests/bugs/modalg_6/bug25937_3
Executable file
34
tests/bugs/modalg_6/bug25937_3
Executable file
@ -0,0 +1,34 @@
|
|||||||
|
puts "============"
|
||||||
|
puts "OCC25937"
|
||||||
|
puts "============"
|
||||||
|
puts ""
|
||||||
|
###############################
|
||||||
|
## Failed Cut Edge or Face by HalfSpace.
|
||||||
|
###############################
|
||||||
|
|
||||||
|
# Cut a solid by halfspace
|
||||||
|
plane h 0 0 0 1 0 0
|
||||||
|
mkface h h
|
||||||
|
halfspace h h 10 0 0
|
||||||
|
box a -10 -10 0 20 20 10
|
||||||
|
|
||||||
|
bop a h
|
||||||
|
bopcut result
|
||||||
|
|
||||||
|
set square 1000.
|
||||||
|
|
||||||
|
set nbshapes_expected "
|
||||||
|
Number of shapes in shape
|
||||||
|
VERTEX : 8
|
||||||
|
EDGE : 12
|
||||||
|
WIRE : 6
|
||||||
|
FACE : 6
|
||||||
|
SHELL : 1
|
||||||
|
SOLID : 1
|
||||||
|
COMPSOLID : 0
|
||||||
|
COMPOUND : 1
|
||||||
|
SHAPE : 35
|
||||||
|
"
|
||||||
|
checknbshapes result -ref ${nbshapes_expected} -t -m "Result obtained by Cut a wire by halfspace"
|
||||||
|
|
||||||
|
set 3dviewer 1
|
Loading…
x
Reference in New Issue
Block a user