mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-10 18:51:21 +03:00
0027991: Modeling Algorithms - BRepGProp_Face crashes on face without geometric surface
BRepGProps now ignores faces without geometric surface to avoid access violation. BRepExtrema_DistShapeShape::DistanceMapMap() now skips comparison between void bounding boxes. BRepBndLib::Add() now ignores useTriangulation flag for faces without geometric surfaces, and uses triangulation if any for updating of the box.
This commit is contained in:
parent
ee5befae97
commit
4d19a2c5e7
@ -80,16 +80,15 @@ void BRepBndLib::Add(const TopoDS_Shape& S, Bnd_Box& B, Standard_Boolean useTria
|
|||||||
|
|
||||||
// Add the faces
|
// Add the faces
|
||||||
BRepAdaptor_Surface BS;
|
BRepAdaptor_Surface BS;
|
||||||
Handle(Geom_Surface) GS;
|
TopLoc_Location l, aDummyLoc;
|
||||||
Handle(Poly_Triangulation) T;
|
|
||||||
TopLoc_Location l;
|
|
||||||
Standard_Integer i, nbNodes;
|
Standard_Integer i, nbNodes;
|
||||||
BRepAdaptor_Curve BC;
|
BRepAdaptor_Curve BC;
|
||||||
|
|
||||||
for (ex.Init(S,TopAbs_FACE); ex.More(); ex.Next()) {
|
for (ex.Init(S,TopAbs_FACE); ex.More(); ex.Next()) {
|
||||||
const TopoDS_Face& F = TopoDS::Face(ex.Current());
|
const TopoDS_Face& F = TopoDS::Face(ex.Current());
|
||||||
T = BRep_Tool::Triangulation(F, l);
|
const Handle(Poly_Triangulation)& T = BRep_Tool::Triangulation(F, l);
|
||||||
if (useTriangulation && !T.IsNull())
|
const Handle(Geom_Surface)& GS = BRep_Tool::Surface (F, aDummyLoc);
|
||||||
|
if ((useTriangulation || GS.IsNull()) && !T.IsNull())
|
||||||
{
|
{
|
||||||
nbNodes = T->NbNodes();
|
nbNodes = T->NbNodes();
|
||||||
const TColgp_Array1OfPnt& Nodes = T->Nodes();
|
const TColgp_Array1OfPnt& Nodes = T->Nodes();
|
||||||
@ -101,7 +100,6 @@ void BRepBndLib::Add(const TopoDS_Shape& S, Bnd_Box& B, Standard_Boolean useTria
|
|||||||
B.Enlarge(T->Deflection() + BRep_Tool::Tolerance(F));
|
B.Enlarge(T->Deflection() + BRep_Tool::Tolerance(F));
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
GS = BRep_Tool::Surface(F, l);
|
|
||||||
if (!GS.IsNull()) {
|
if (!GS.IsNull()) {
|
||||||
BS.Initialize(F, Standard_False);
|
BS.Initialize(F, Standard_False);
|
||||||
if (BS.GetType() != GeomAbs_Plane) {
|
if (BS.GetType() != GeomAbs_Plane) {
|
||||||
@ -130,7 +128,7 @@ void BRepBndLib::Add(const TopoDS_Shape& S, Bnd_Box& B, Standard_Boolean useTria
|
|||||||
// Add the edges not in faces
|
// Add the edges not in faces
|
||||||
Handle(TColStd_HArray1OfInteger) HIndices;
|
Handle(TColStd_HArray1OfInteger) HIndices;
|
||||||
Handle(Poly_PolygonOnTriangulation) Poly;
|
Handle(Poly_PolygonOnTriangulation) Poly;
|
||||||
|
Handle(Poly_Triangulation) T;
|
||||||
for (ex.Init(S,TopAbs_EDGE,TopAbs_FACE); ex.More(); ex.Next())
|
for (ex.Init(S,TopAbs_EDGE,TopAbs_FACE); ex.More(); ex.Next())
|
||||||
{
|
{
|
||||||
const TopoDS_Edge& E = TopoDS::Edge(ex.Current());
|
const TopoDS_Edge& E = TopoDS::Edge(ex.Current());
|
||||||
|
@ -117,7 +117,15 @@ void BRepExtrema_DistShapeShape::DistanceMapMap (const TopTools_IndexedMapOfShap
|
|||||||
{
|
{
|
||||||
for (Standard_Integer anIdx2 = 1; anIdx2 <= aCount2; ++anIdx2)
|
for (Standard_Integer anIdx2 = 1; anIdx2 <= aCount2; ++anIdx2)
|
||||||
{
|
{
|
||||||
const Standard_Real aDist = theLBox1.Value (anIdx1).Distance (theLBox2.Value (anIdx2));
|
const Bnd_Box& aBox1 = theLBox1.Value (anIdx1);
|
||||||
|
const Bnd_Box& aBox2 = theLBox2.Value (anIdx2);
|
||||||
|
if (aBox1.IsVoid()
|
||||||
|
|| aBox2.IsVoid())
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
const Standard_Real aDist = aBox1.Distance (aBox2);
|
||||||
if (aDist < myDistRef - myEps || fabs (aDist - myDistRef) < myEps)
|
if (aDist < myDistRef - myEps || fabs (aDist - myDistRef) < myEps)
|
||||||
{
|
{
|
||||||
aPairList.Append (BRepExtrema_CheckPair (anIdx1, anIdx2, aDist));
|
aPairList.Append (BRepExtrema_CheckPair (anIdx1, anIdx2, aDist));
|
||||||
|
@ -91,6 +91,7 @@ static Standard_Real surfaceProperties(const TopoDS_Shape& S, GProp_GProps& Prop
|
|||||||
BRepGProp_Face BF;
|
BRepGProp_Face BF;
|
||||||
BRepGProp_Domain BD;
|
BRepGProp_Domain BD;
|
||||||
TopTools_MapOfShape aFMap;
|
TopTools_MapOfShape aFMap;
|
||||||
|
TopLoc_Location aLocDummy;
|
||||||
|
|
||||||
for (ex.Init(S,TopAbs_FACE), i = 1; ex.More(); ex.Next(), i++) {
|
for (ex.Init(S,TopAbs_FACE), i = 1; ex.More(); ex.Next(), i++) {
|
||||||
const TopoDS_Face& F = TopoDS::Face(ex.Current());
|
const TopoDS_Face& F = TopoDS::Face(ex.Current());
|
||||||
@ -98,6 +99,16 @@ static Standard_Real surfaceProperties(const TopoDS_Shape& S, GProp_GProps& Prop
|
|||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
const Handle(Geom_Surface)& aSurf = BRep_Tool::Surface (F, aLocDummy);
|
||||||
|
if (aSurf.IsNull())
|
||||||
|
{
|
||||||
|
// skip faces without geometry
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
BF.Load(F);
|
BF.Load(F);
|
||||||
TopoDS_Iterator aWIter(F);
|
TopoDS_Iterator aWIter(F);
|
||||||
Standard_Boolean IsNatRestr = !aWIter.More();
|
Standard_Boolean IsNatRestr = !aWIter.More();
|
||||||
|
@ -7,6 +7,10 @@ pload MODELING VISUALIZATION
|
|||||||
restore [locate_data_file bug27821_nullsurf.brep] s
|
restore [locate_data_file bug27821_nullsurf.brep] s
|
||||||
explode s F
|
explode s F
|
||||||
|
|
||||||
|
# check that sprops does not crash on NULL surface
|
||||||
|
sprops s
|
||||||
|
|
||||||
|
# check that AIS_Shape does not crash on NULL surface
|
||||||
vclear
|
vclear
|
||||||
vinit View1
|
vinit View1
|
||||||
vaxo
|
vaxo
|
||||||
|
Loading…
x
Reference in New Issue
Block a user