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.
// Add the faces
BRepAdaptor_Surface BS;
// Add the faces
BRepAdaptor_Surface BS;
- Handle(Geom_Surface) GS;
- Handle(Poly_Triangulation) T;
- TopLoc_Location l;
+ TopLoc_Location l, aDummyLoc;
Standard_Integer i, nbNodes;
BRepAdaptor_Curve BC;
for (ex.Init(S,TopAbs_FACE); ex.More(); ex.Next()) {
const TopoDS_Face& F = TopoDS::Face(ex.Current());
Standard_Integer i, nbNodes;
BRepAdaptor_Curve BC;
for (ex.Init(S,TopAbs_FACE); ex.More(); ex.Next()) {
const TopoDS_Face& F = TopoDS::Face(ex.Current());
- T = BRep_Tool::Triangulation(F, l);
- if (useTriangulation && !T.IsNull())
+ const Handle(Poly_Triangulation)& T = BRep_Tool::Triangulation(F, l);
+ const Handle(Geom_Surface)& GS = BRep_Tool::Surface (F, aDummyLoc);
+ if ((useTriangulation || GS.IsNull()) && !T.IsNull())
{
nbNodes = T->NbNodes();
const TColgp_Array1OfPnt& Nodes = T->Nodes();
{
nbNodes = T->NbNodes();
const TColgp_Array1OfPnt& Nodes = T->Nodes();
B.Enlarge(T->Deflection() + BRep_Tool::Tolerance(F));
} else
{
B.Enlarge(T->Deflection() + BRep_Tool::Tolerance(F));
} else
{
- GS = BRep_Tool::Surface(F, l);
if (!GS.IsNull()) {
BS.Initialize(F, Standard_False);
if (BS.GetType() != GeomAbs_Plane) {
if (!GS.IsNull()) {
BS.Initialize(F, Standard_False);
if (BS.GetType() != GeomAbs_Plane) {
// Add the edges not in faces
Handle(TColStd_HArray1OfInteger) HIndices;
Handle(Poly_PolygonOnTriangulation) Poly;
// Add the edges not in faces
Handle(TColStd_HArray1OfInteger) HIndices;
Handle(Poly_PolygonOnTriangulation) Poly;
+ Handle(Poly_Triangulation) T;
for (ex.Init(S,TopAbs_EDGE,TopAbs_FACE); ex.More(); ex.Next())
{
const TopoDS_Edge& E = TopoDS::Edge(ex.Current());
for (ex.Init(S,TopAbs_EDGE,TopAbs_FACE); ex.More(); ex.Next())
{
const TopoDS_Edge& E = TopoDS::Edge(ex.Current());
{
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)
{
aPairList.Append (BRepExtrema_CheckPair (anIdx1, anIdx2, aDist));
if (aDist < myDistRef - myEps || fabs (aDist - myDistRef) < myEps)
{
aPairList.Append (BRepExtrema_CheckPair (anIdx1, anIdx2, aDist));
BRepGProp_Face BF;
BRepGProp_Domain BD;
TopTools_MapOfShape aFMap;
BRepGProp_Face BF;
BRepGProp_Domain BD;
TopTools_MapOfShape aFMap;
+ TopLoc_Location aLocDummy;
for (ex.Init(S,TopAbs_FACE), i = 1; ex.More(); ex.Next(), i++) {
const TopoDS_Face& F = TopoDS::Face(ex.Current());
for (ex.Init(S,TopAbs_FACE), i = 1; ex.More(); ex.Next(), i++) {
const TopoDS_Face& F = TopoDS::Face(ex.Current());
+
+ {
+ const Handle(Geom_Surface)& aSurf = BRep_Tool::Surface (F, aLocDummy);
+ if (aSurf.IsNull())
+ {
+ // skip faces without geometry
+ continue;
+ }
+ }
+
BF.Load(F);
TopoDS_Iterator aWIter(F);
Standard_Boolean IsNatRestr = !aWIter.More();
BF.Load(F);
TopoDS_Iterator aWIter(F);
Standard_Boolean IsNatRestr = !aWIter.More();
restore [locate_data_file bug27821_nullsurf.brep] s
explode s F
restore [locate_data_file bug27821_nullsurf.brep] s
explode s F
+# check that sprops does not crash on NULL surface
+sprops s
+
+# check that AIS_Shape does not crash on NULL surface