From 034b4775dccd43a5493c4299b921905fae2e25be Mon Sep 17 00:00:00 2001 From: Pawel Date: Wed, 15 May 2013 17:24:43 +0200 Subject: [PATCH] 0023965: Making unnecessary copies of TopoDS_Face in Voxel_FastConverter when checking triangulation Using reference of TopoDS_Face instead of a copy. Checking if the obtained triangulation is not Null before continuing. --- src/Voxel/Voxel_FastConverter.cxx | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/Voxel/Voxel_FastConverter.cxx b/src/Voxel/Voxel_FastConverter.cxx index f04089c60b..dad9a6ca93 100755 --- a/src/Voxel/Voxel_FastConverter.cxx +++ b/src/Voxel/Voxel_FastConverter.cxx @@ -121,7 +121,7 @@ void Voxel_FastConverter::Init() TopExp_Explorer expl(myShape, TopAbs_FACE); for (; expl.More(); expl.Next()) { - TopoDS_Face F = TopoDS::Face(expl.Current()); + const TopoDS_Face & F = TopoDS::Face(expl.Current()); Handle(Poly_Triangulation) T = BRep_Tool::Triangulation(F, L); if (T.IsNull() || (T->Deflection() > myDeflection)) { @@ -141,9 +141,10 @@ void Voxel_FastConverter::Init() expl.Init(myShape, TopAbs_FACE); for (; expl.More(); expl.Next()) { - TopoDS_Face F = TopoDS::Face(expl.Current()); + const TopoDS_Face & F = TopoDS::Face(expl.Current()); Handle(Poly_Triangulation) T = BRep_Tool::Triangulation(F, L); - myNbTriangles += T->NbTriangles(); + if (T.IsNull() == Standard_False) + myNbTriangles += T->NbTriangles(); } } @@ -188,8 +189,10 @@ Standard_Boolean Voxel_FastConverter::Convert(Standard_Integer& progress, TopExp_Explorer expl(myShape, TopAbs_FACE); for (; expl.More(); expl.Next()) { - TopoDS_Face F = TopoDS::Face(expl.Current()); + const TopoDS_Face & F = TopoDS::Face(expl.Current()); Handle(Poly_Triangulation) T = BRep_Tool::Triangulation(F, L); + if (T.IsNull()) + continue; gp_Trsf trsf; Standard_Boolean transform = !L.IsIdentity();