Performance Ph2

This commit is contained in:
WandererFan
2016-10-02 20:43:24 -04:00
committed by Yorik van Havre
parent ca2af6ec45
commit e0ca83d5cc
9 changed files with 352 additions and 186 deletions

View File

@@ -44,6 +44,8 @@
#include <TopTools_IndexedMapOfShape.hxx>
#include <TopExp.hxx>
#include <TopExp_Explorer.hxx>
#include <BRepGProp.hxx>
#include <GProp_GProps.hxx>
#endif
@@ -118,11 +120,21 @@ bool DrawUtil::isSamePoint(TopoDS_Vertex v1, TopoDS_Vertex v2)
return result;
}
bool DrawUtil::isZeroEdge(TopoDS_Edge& e)
bool DrawUtil::isZeroEdge(TopoDS_Edge e)
{
TopoDS_Vertex vStart = TopExp::FirstVertex(e);
TopoDS_Vertex vEnd = TopExp::LastVertex(e);
return isSamePoint(vStart,vEnd);
bool result = isSamePoint(vStart,vEnd);
if (result) {
//closed edge will have same V's but non-zero length
GProp_GProps props;
BRepGProp::LinearProperties(e, props);
double len = props.Mass();
if (len > Precision::Confusion()) {
result = false;
}
}
return result;
}
//============================