1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-04 13:13:25 +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

@@ -304,7 +304,6 @@ TopoDS_Face BRepFill::Face(const TopoDS_Edge& Edge1,
TopoDS_Edge Edge3, Edge4;
Iso = Surf->UIso(f1);
// Tol = Max(BT.Tolerance(V1f), BT.Tolerance(V2f));
Tol = Max(BRep_Tool::Tolerance(V1f), BRep_Tool::Tolerance(V2f));
if (Iso->Value(f2).Distance(Iso->Value(l2)) > Tol) {
B.MakeEdge(Edge3,Iso,Precision::Confusion());
@@ -324,7 +323,6 @@ TopoDS_Face BRepFill::Face(const TopoDS_Edge& Edge1,
}
else {
Iso = Surf->UIso(l1);
// Tol = Max(BT.Tolerance(V1l), BT.Tolerance(V2l));
Tol = Max(BRep_Tool::Tolerance(V1l), BRep_Tool::Tolerance(V2l));
if (Iso->Value(l2).Distance(Iso->Value(f2)) > Tol) {
B.MakeEdge(Edge4,Iso,Precision::Confusion());
@@ -436,7 +434,8 @@ TopoDS_Shell BRepFill::Shell(const TopoDS_Wire& Wire1,
Edge1 = TopoDS::Edge(ex1.Current());
Edge2 = TopoDS::Edge(ex2.Current());
Standard_Boolean Periodic = Edge1.Closed() && Edge2.Closed();
Standard_Boolean Periodic =
BRep_Tool::IsClosed(Edge1) && BRep_Tool::IsClosed(Edge2);
ex1.Next();
ex2.Next();

View File

@@ -3218,7 +3218,7 @@ void CutEdge (const TopoDS_Edge& E,
CT2d = new Geom2d_TrimmedCurve(C2d,f,l);
if (CT2d->BasisCurve()->IsKind(STANDARD_TYPE(Geom2d_Circle)) &&
E.Closed()) {
BRep_Tool::IsClosed(E)) {
//---------------------------
// Cut closed circle.
//---------------------------

View File

@@ -681,7 +681,7 @@ void BRepFill_Filling::Build()
Handle(Geom2d_Curve) aCurveOnPlate = CurvesOnPlate->Value(i);
TopoDS_Edge NewEdge = TopoDS::Edge(anEdge.EmptyCopied());
NewEdge.Closed(anEdge.Closed());
TopoDS_Vertex V1, V2;
TopExp::Vertices(anEdge, V1, V2, Standard_True); //with orientation
BB.UpdateVertex(V1, dmax);

View File

@@ -620,8 +620,8 @@ void BRepFill_Generator::Perform()
Edge2 = TopoDS::Edge(ex2.Current());
}
Standard_Boolean Periodic
= (Edge1.Closed() || degen1) && (Edge2.Closed() || degen2);
Standard_Boolean Periodic = (BRep_Tool::IsClosed(Edge1) || degen1) &&
(BRep_Tool::IsClosed(Edge2) || degen2);
// ATTENTION : a non-punctual wire should not
// contain a punctual edge
if (!wPoint1) ex1.Next();
@@ -648,13 +648,7 @@ void BRepFill_Generator::Perform()
Vf_toMap = V1f;
Vl_toMap = V1l;
}
if(Periodic) {
Standard_Boolean E1IsReallyClosed = BRepTools::Compare(V1f,V1l);
Standard_Boolean E2IsReallyClosed = BRepTools::Compare(V2f,V2l);
Periodic
= (E1IsReallyClosed || degen1) && (E2IsReallyClosed || degen2);
}
// processing of KPart
Standard_Integer IType = DetectKPart(Edge1,Edge2);
if (IType==0) {

View File

@@ -573,7 +573,7 @@ void BRepFill_NSections::Init(const TColStd_SequenceOfReal & P,
Last = aux;
C = CBis;
}
if ((ii>1) || (!E.Closed()) ) { // Cut C
if ((ii>1) || (!BRep_Tool::IsClosed(E)) ) { // Cut C
Handle(Geom_TrimmedCurve) TC =
new (Geom_TrimmedCurve) (C,First, Last);
C = TC;

View File

@@ -251,9 +251,7 @@ static Standard_Boolean KPartCircle
C = Ct->BasisCurve();
}
TopoDS_Vertex V1,V2;
TopExp::Vertices(E,V1,V2);
if ((C->IsKind(STANDARD_TYPE(Geom_Circle)) && V1.IsSame(V2)) || //closed circle
if ((C->IsKind(STANDARD_TYPE(Geom_Circle)) && BRep_Tool::IsClosed(E)) || //closed circle
IsOpenResult)
{
Standard_Real anOffset = myOffset;

View File

@@ -556,18 +556,18 @@ TopoDS_Shape BRepFill_Pipe::MakeShape(const TopoDS_Shape& S,
B.MakeShell(TopoDS::Shell(result));
B.MakeWire(W);
B.Add(W, S);
W.Closed(S.Closed());
W.Closed(BRep_Tool::IsClosed(S));
TheS = W;
if (!FirstShape.IsNull()) {
B.MakeWire(W);
B.Add(W, FirstShape);
W.Closed(FirstShape.Closed());
W.Closed(BRep_Tool::IsClosed(FirstShape));
TheFirst = W;
}
if (!LastShape.IsNull()) {
B.MakeWire(W);
B.Add(W, LastShape);
W.Closed(LastShape.Closed());
W.Closed(BRep_Tool::IsClosed(LastShape));
TheLast = W;
}
result.Closed (BRep_Tool::IsClosed (result));

View File

@@ -46,7 +46,6 @@ BRepFill_Section::BRepFill_Section(const TopoDS_Shape& Profile,
BB.Add( DegEdge, aVertex.Oriented(TopAbs_FORWARD) );
BB.Add( DegEdge, aVertex.Oriented(TopAbs_REVERSED) );
BB.Degenerated( DegEdge, Standard_True );
DegEdge.Closed( Standard_True );
BB.MakeWire( wire );
BB.Add( wire, DegEdge );

View File

@@ -149,23 +149,12 @@ void BRepFill_ShapeLaw::Init(const Standard_Boolean Build)
C = CBis;
}
Standard_Boolean IsReallyClosed = E.Closed();
//IFV - some checking when closed flag is wrong
if(IsReallyClosed) {
TopoDS_Vertex V1, V2;
TopExp::Vertices(E, V1, V2);
if(V1.IsNull() || V2.IsNull()) {
IsReallyClosed = Standard_False;
}
else {
IsReallyClosed = V1.IsSame(V2);
}
}
if (IsReallyClosed &&
Standard_Boolean IsClosed = BRep_Tool::IsClosed(E);
if (IsClosed &&
Abs(C->FirstParameter() - First) > Precision::PConfusion())
IsReallyClosed = Standard_False; //trimmed curve differs
IsClosed = Standard_False; //trimmed curve differs
if ((ii>1) || !IsReallyClosed ) { // Trim C
if ((ii>1) || !IsClosed ) { // Trim C
Handle(Geom_TrimmedCurve) TC = new Geom_TrimmedCurve(C,First, Last);
C = TC;
}