#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <list>
+#include <cmath>
static TopoDS_Vertex findStartVertex(const TopoDS_Shape& theShape)
{
+ static const double aTol = Precision::PConfusion();
+
TopExp_Explorer anExp(theShape, TopAbs_VERTEX);
TopoDS_Vertex aStart = TopoDS::Vertex(anExp.Current());
gp_Pnt aStartPnt(BRep_Tool::Pnt(aStart));
for (anExp.Next(); anExp.More(); anExp.Next()) {
aCurrent = TopoDS::Vertex(anExp.Current());
aCurrentPnt = BRep_Tool::Pnt(aCurrent);
- if ((aCurrentPnt.X() > aStartPnt.X()) ||
- (aCurrentPnt.X() == aStartPnt.X() && aCurrentPnt.Y() > aStartPnt.Y()) ||
- (aCurrentPnt.X() == aStartPnt.X() && aCurrentPnt.Y() == aStartPnt.Y() &&
- aCurrentPnt.Z() > aStartPnt.Z())) {
+ if ((aCurrentPnt.X() > aStartPnt.X() + aTol) ||
+ (aCurrentPnt.X() > aStartPnt.X() - aTol && aCurrentPnt.Y() > aStartPnt.Y() + aTol) ||
+ (aCurrentPnt.X() > aStartPnt.X() - aTol && aCurrentPnt.Y() > aStartPnt.Y() - aTol &&
+ aCurrentPnt.Z() > aStartPnt.Z() + aTol)) {
aStart = aCurrent;
aStartPnt = aCurrentPnt;
}
if (!aStartFound) {
const TopoDS_Edge& anEdge = TopoDS::Edge(anExp.Current());
TopoDS_Vertex aV1, aV2;
- TopExp::Vertices(anEdge, aV1, aV2);
+ TopExp::Vertices(anEdge, aV1, aV2, Standard_True);
if (aV1.IsSame(aStartVertex) == Standard_True)
aStartFound = true;
else
const std::shared_ptr<GeomAPI_Dir>& theDirX,
const std::shared_ptr<GeomAPI_Dir>& theNorm,
const std::shared_ptr<GeomAPI_Shape>& theWire,
- std::list<std::shared_ptr<GeomAPI_Shape> >& theResultFaces)
+ std::list<std::shared_ptr<GeomAPI_Shape> >& theResultFaces)
{
- std::shared_ptr<GeomAPI_PlanarEdges> aWire =
+ std::shared_ptr<GeomAPI_PlanarEdges> aWire =
std::dynamic_pointer_cast<GeomAPI_PlanarEdges>(theWire);
if(aWire) {
// Filter wires, return only faces.