1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

0025656: Specification of semantic of Closed flag of an edge

1. Using of the "Closed" flag was unified:
  a) this flag is applicable for TopoDS_Wire and TopoDS_Shell only, because these entities may hedge an area in 2D space or a volume in 3D space correspondingly;
  b) other types of TopoDS shapes are passing over this flag;
  c) changing of this flag should be controlled by high-level algorithms (not BRep_Builder).
2. Implemented verification of the closedness of edges. An edge is closed if and only if its first and last vertices are the same.
3. Test cases were changed according to new behavior.
This commit is contained in:
azv
2014-12-30 07:37:51 +03:00
committed by bugmaster
parent a195430212
commit da72a17c80
43 changed files with 87 additions and 238 deletions

View File

@@ -563,7 +563,6 @@ void BRep_Builder::MakeEdge(TopoDS_Edge& E) const
{
TopoDS_LockedShape::Raise("BRep_Builder::MakeEdge");
}
TE->Closed(Standard_False);
MakeShape(E,TE);
}
@@ -586,7 +585,6 @@ void BRep_Builder::UpdateEdge(const TopoDS_Edge& E,
const TopLoc_Location l = L.Predivided(E.Location());
UpdateCurves(TE->ChangeCurves(),C,l);
if (!C.IsNull()) TE->Closed(C->IsClosed());
TE->UpdateTolerance(Tol);
TE->Modified(Standard_True);
@@ -665,8 +663,6 @@ void BRep_Builder::UpdateEdge(const TopoDS_Edge& E,
const TopLoc_Location l = L.Predivided(E.Location());
UpdateCurves(TE->ChangeCurves(),C1,C2,S,l);
if (!C1.IsNull() && !C2.IsNull())
TE->Closed(C1->IsClosed() && C2->IsClosed());
TE->UpdateTolerance(Tol);
TE->Modified(Standard_True);
@@ -695,9 +691,7 @@ void BRep_Builder::UpdateEdge(const TopoDS_Edge& E,
const TopLoc_Location l = L.Predivided(E.Location());
UpdateCurves(TE->ChangeCurves(),C1,C2,S,l,Pf,Pl);
if (!C1.IsNull() && !C2.IsNull())
TE->Closed(C1->IsClosed() && C2->IsClosed());
TE->UpdateTolerance(Tol);
TE->Modified(Standard_True);
}
@@ -768,14 +762,14 @@ void BRep_Builder::UpdateEdge(const TopoDS_Edge& E,
while (itcr.More())
{
if (itcr.Value()->IsPolygonOnTriangulation(T,l))
{
{
// cr is used to keep a reference on the curve representation
// this avoid deleting it as its content may be referenced by T
cr = itcr.Value();
lcr.Remove(itcr);
isModified = Standard_True;
break;
}
}
itcr.Next();
}
@@ -1093,23 +1087,8 @@ void BRep_Builder::Range(const TopoDS_Edge& E,
while (itcr.More()) {
GC = Handle(BRep_GCurve)::DownCast(itcr.Value());
if (!GC.IsNull()) {
if (!Only3d || GC->IsCurve3D())
GC->SetRange(First,Last);
if (GC->IsCurve3D()) {
// Set the closedness flag to the correct value.
Handle(Geom_Curve) C = GC->Curve3D();
//fixing a bug PRO18577 to avoid infinite values of First and Last
if ( !C.IsNull() &&
!Precision::IsNegativeInfinite(First) &&
!Precision::IsPositiveInfinite(Last) ) {
Standard_Boolean closed =
C->Value(First).IsEqual(C->Value(Last),BRep_Tool::Tolerance(E));
TE->Closed(closed);
}
}
}
if (!GC.IsNull() && (!Only3d || GC->IsCurve3D()))
GC->SetRange(First,Last);
itcr.Next();
}
@@ -1141,20 +1120,10 @@ void BRep_Builder::Range(const TopoDS_Edge& E,
while (itcr.More()) {
GC = Handle(BRep_GCurve)::DownCast(itcr.Value());
if (!GC.IsNull()) {
if (GC->IsCurveOnSurface(S,l)) {
GC->SetRange(First,Last);
// Set the closedness flag to the correct value.
Handle(Geom2d_Curve) PC = GC->PCurve();
gp_Pnt2d P1 = PC->Value(First);
gp_Pnt2d P2 = PC->Value(Last);
gp_Pnt PP1 = S->Value(P1.X(),P1.Y());
gp_Pnt PP2 = S->Value(P2.X(),P2.Y());
Standard_Boolean closed = PP1.IsEqual(PP2,BRep_Tool::Tolerance(E));
TE->Closed(closed);
break;
}
if (!GC.IsNull() && GC->IsCurveOnSurface(S,l))
{
GC->SetRange(First,Last);
break;
}
itcr.Next();
}

View File

@@ -49,14 +49,15 @@ is
-----------------------------------------------------------
-----------------------------------------------------------
-- Solid --
-- Shape --
-----------------------------------------------------------
-----------------------------------------------------------
IsClosed (myclass; S : Shape from TopoDS) returns Boolean from Standard;
---Purpose: If S is Solid or Shell, returns True if it has no free boundaries (edges).
-- If S is Wire, returns True if it has no free ends (vertices).
-- (Internal and External sub-shepes are ignored in this check.)
-- For other shape types returns S.Closed().
---Purpose: If S is Shell, returns True if it has no free boundaries (edges).
-- If S is Wire, returns True if it has no free ends (vertices).
-- (Internal and External sub-shepes are ignored in these checks)
-- If S is Edge, returns True if its vertices are the same.
-- For other shape types returns S.Closed().
-----------------------------------------------------------
-----------------------------------------------------------

View File

@@ -1455,7 +1455,7 @@ gp_Pnt2d BRep_Tool::Parameters(const TopoDS_Vertex& V,
//=======================================================================
Standard_Boolean BRep_Tool::IsClosed (const TopoDS_Shape& theShape)
{
if (theShape.ShapeType() == TopAbs_SHELL || theShape.ShapeType() == TopAbs_SOLID)
if (theShape.ShapeType() == TopAbs_SHELL)
{
NCollection_Map<TopoDS_Shape, TopTools_ShapeMapHasher> aMap (101, new NCollection_IncAllocator);
TopExp_Explorer exp (theShape.Oriented(TopAbs_FORWARD), TopAbs_EDGE);
@@ -1487,6 +1487,12 @@ Standard_Boolean BRep_Tool::IsClosed (const TopoDS_Shape& theShape)
}
return hasBound && aMap.IsEmpty();
}
else if (theShape.ShapeType() == TopAbs_EDGE)
{
TopoDS_Vertex aVFirst, aVLast;
TopExp::Vertices(TopoDS::Edge(theShape), aVFirst, aVLast);
return !aVFirst.IsNull() && aVFirst.IsSame(aVLast);
}
return theShape.Closed();
}