mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-14 13:30:48 +03:00
0031926: Shape Healing - ShapeAnalysis::OuterWire() considers next iteration element always to be a wire causing skipping of primal one
ShapeAnalysis::OuterWire(): fixed missed logic when TopoDS_Iterator notifies about more objects to iterate, but there are only vertices and no additional wires at all.
This commit is contained in:
@@ -229,36 +229,31 @@ Standard_Boolean ShapeAnalysis::IsOuterBound(const TopoDS_Face& face)
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : OuterBound
|
||||
//purpose : replacement of bad BRepTools::OuterBound(), to be merged
|
||||
// - skips internal vertices in face, if any, without exception
|
||||
// - returns positively oriented wire rather than greater one
|
||||
//function : OuterWire
|
||||
//purpose : Returns positively oriented wire in the face.
|
||||
// If there is no one - returns the last wire of the face.
|
||||
//=======================================================================
|
||||
|
||||
TopoDS_Wire ShapeAnalysis::OuterWire(const TopoDS_Face& face)
|
||||
TopoDS_Wire ShapeAnalysis::OuterWire(const TopoDS_Face& theFace)
|
||||
{
|
||||
TopoDS_Face F = face;
|
||||
F.Orientation(TopAbs_FORWARD);
|
||||
TopoDS_Face aF = theFace;
|
||||
aF.Orientation (TopAbs_FORWARD);
|
||||
|
||||
BRep_Builder B;
|
||||
TopoDS_Iterator anIt (F, Standard_False);
|
||||
TopExp_Explorer anIt (aF, TopAbs_WIRE);
|
||||
while (anIt.More())
|
||||
{
|
||||
TopoDS_Shape aWire = anIt.Value();
|
||||
TopoDS_Wire aWire = TopoDS::Wire (anIt.Value());
|
||||
anIt.Next();
|
||||
|
||||
// skip possible internal vertices in face
|
||||
if (aWire.ShapeType() != TopAbs_WIRE)
|
||||
continue;
|
||||
|
||||
// if current wire is the last one, return it without analysis
|
||||
if (! anIt.More())
|
||||
return TopoDS::Wire (aWire);
|
||||
if (!anIt.More())
|
||||
return aWire;
|
||||
|
||||
TopoDS_Shape aTestFace = F.EmptyCopied();
|
||||
B.Add (aTestFace, aWire);
|
||||
if (ShapeAnalysis::IsOuterBound (TopoDS::Face (aTestFace)))
|
||||
return TopoDS::Wire (aWire);
|
||||
// Check if the wire has positive area
|
||||
Handle(ShapeExtend_WireData) aSEWD = new ShapeExtend_WireData (aWire);
|
||||
Standard_Real anArea2d = ShapeAnalysis::TotCross2D (aSEWD, aF);
|
||||
if (anArea2d >= 0.)
|
||||
return aWire;
|
||||
}
|
||||
return TopoDS_Wire();
|
||||
}
|
||||
|
@@ -51,12 +51,9 @@ public:
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
//! Returns the outer wire on the face <Face>.
|
||||
//! This is replacement of the method BRepTools::OuterWire
|
||||
//! until it works badly.
|
||||
//! Returns the first wire oriented as outer according to
|
||||
//! FClass2d_Classifier. If none, last wire is returned.
|
||||
Standard_EXPORT static TopoDS_Wire OuterWire (const TopoDS_Face& face);
|
||||
//! Returns positively oriented wire in the face.
|
||||
//! If there is no such wire - returns the last wire of the face.
|
||||
Standard_EXPORT static TopoDS_Wire OuterWire (const TopoDS_Face& theFace);
|
||||
|
||||
//! Returns a total area of 2d wire
|
||||
Standard_EXPORT static Standard_Real TotCross2D (const Handle(ShapeExtend_WireData)& sewd, const TopoDS_Face& aFace);
|
||||
|
Reference in New Issue
Block a user