1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-14 13:30:48 +03:00

0027063: BRepGProps raises exception on edge with no curves

Method BRepGProp::LinearProperties() is corrected to treat not geometric edges (their length is zero). To avoid wrong working of command nexplode global properties are calculated as point properties of vertexes. Small value Epsilon(1.) is used as density of points. This prevents exception on shapes that contain such edges, e.g. copy of a wire containing degenerated edge.

Method BRep_Tool::IsGeometric() is optimized to avoid nested iteration for check of 3D curve for Null.
Small bug is fixed in GProp_PGProps.cxx
This commit is contained in:
ifv
2013-12-10 15:40:40 +04:00
committed by abv
parent 5747059b21
commit a4ed7309ff
4 changed files with 32 additions and 9 deletions

View File

@@ -17,6 +17,7 @@
#include <BRepGProp_Sinert.hxx>
#include <BRepGProp_Vinert.hxx>
#include <BRepGProp_VinertGK.hxx>
#include <GProp_PGProps.hxx>
#include <BRepGProp_Face.hxx>
#include <BRepGProp_Domain.hxx>
#include <TopoDS.hxx>
@@ -47,12 +48,27 @@ void BRepGProp::LinearProperties(const TopoDS_Shape& S, GProp_GProps& SProps){
SProps = GProp_GProps(P);
BRepAdaptor_Curve BAC;
// Standard_Integer n,i;
Standard_Real eps = Epsilon(1.);
TopExp_Explorer ex;
for (ex.Init(S,TopAbs_EDGE); ex.More(); ex.Next()) {
BAC.Initialize(TopoDS::Edge(ex.Current()));
BRepGProp_Cinert CG(BAC,P);
SProps.Add(CG);
const TopoDS_Edge& aE = TopoDS::Edge(ex.Current());
if(!BRep_Tool::IsGeometric(aE))
{
GProp_PGProps aPProps;
TopoDS_Iterator anIter(aE);
for(; anIter.More(); anIter.Next())
{
const TopoDS_Vertex& aV = TopoDS::Vertex(anIter.Value());
aPProps.AddPoint(BRep_Tool::Pnt(aV), eps);
}
SProps.Add(aPProps);
}
else
{
BAC.Initialize(aE);
BRepGProp_Cinert CG(BAC,P);
SProps.Add(CG);
}
}
}