TopoDS_Iterator exW(face);
for (; exW.More(); exW.Next()) {
- const TopoDS_Shape& aWire = exW.Value();
+ TopoDS_Shape aWire = exW.Value();
if (aWire.ShapeType() != TopAbs_WIRE)
continue;
+ Standard_Boolean aFirstEdge = Standard_True;
+ Standard_Integer aPrevPointInd;
+ aWire.Orientation (TopAbs_FORWARD);
TopoDS_Iterator ex(aWire);
for(; ex.More(); ex.Next()) {
const TopoDS_Edge& edge = TopoDS::Edge(ex.Value());
aLSeq.Append(l1);
aCSeq.Append(C);
aShSeq.Append(edge);
- Add(edge, face, gFace, C, theAncestors, defedge, f1, l1);
+ Add(edge, face, gFace, C, theAncestors, defedge, f1, l1, aTolU, aTolV, aPrevPointInd, aFirstEdge);
myAngle = savangle;
}
}
}
}
-
+ Standard_Boolean aFirstEdge = Standard_True;
+ Standard_Integer aPrevPointInd;
for( j1 = 1; j1 <= aShSeq.Length(); j1++)
{
const TopoDS_Edge& edge = TopoDS::Edge(aShSeq.Value(j1));
defedge = Max(defedge, eps);
myMapdefle.Bind(edge, defedge);
const Handle(Geom2d_Curve)& C = aCSeq.Value(j1);
- Add(edge, face, gFace, C, theAncestors, defedge, aFSeq.Value(j1), aLSeq.Value(j1));
+ Add(edge, face, gFace, C, theAncestors, defedge, aFSeq.Value(j1), aLSeq.Value(j1), aTolU, aTolV, aPrevPointInd, aFirstEdge);
}
classifier.Nullify();
const TopTools_IndexedDataMapOfShapeListOfShape& theAncestors,
const Standard_Real theDefEdge,
const Standard_Real theFirst,
- const Standard_Real theLast)
+ const Standard_Real theLast,
+ const Standard_Real theTolX,
+ const Standard_Real theTolY,
+ Standard_Integer& thePrevPointInd,
+ Standard_Boolean& theFirstEdge)
{
const TopAbs_Orientation orEdge = theEdge.Orientation();
if (orEdge == TopAbs_EXTERNAL) return;
}
theUV = BRepMesh_FastDiscretFace::FindUV(pBegin, uvFirst, ipf, theGFace, mindist, myLocation2d);
BRepMesh_Vertex vf(theUV, ipf, BRepMesh_Frontier);
- Standard_Integer ivf = myStructure->AddNode(vf);
// Process last vertex
Standard_Integer ipl;
}
theUV = BRepMesh_FastDiscretFace::FindUV(pEnd, uvLast, ipl, theGFace, mindist, myLocation2d);
BRepMesh_Vertex vl(theUV, ipl, BRepMesh_Frontier);
+
+ if (!theFirstEdge)
+ {
+ const BRepMesh_Vertex& aPrevVert = myStructure->GetNode (thePrevPointInd);
+ const BRepMesh_Vertex& aFirstVert = myStructure->GetNode (myFirstPointInd);
+ gp_Pnt aFirstPoint = myLocation3d.Find (aFirstVert.Location3d());
+
+ if (orEdge == TopAbs_FORWARD)
+ {
+ if (Abs (uvFirst.X() - aPrevVert.Coord().X()) > theTolX ||
+ Abs (uvFirst.Y() - aPrevVert.Coord().Y()) > theTolY)
+ {
+ vf.Initialize ((uvFirst.Coord() + aPrevVert.Coord())/2, ipf, BRepMesh_Frontier);
+ myStructure->MoveNode (thePrevPointInd, vf);
+ }
+ if ((Abs (uvLast.X() - aFirstVert.Coord().X()) > theTolX ||
+ Abs (uvLast.Y() - aFirstVert.Coord().Y()) > theTolY) &&
+ aFirstPoint.IsEqual (BRep_Tool::Pnt (pEnd), Precision::Confusion()))
+ {
+ vl.Initialize ((uvLast.Coord() + aFirstVert.Coord())/2, ipl, BRepMesh_Frontier);
+ myStructure->MoveNode (myFirstPointInd, vl);
+ }
+ }
+ if (orEdge == TopAbs_REVERSED)
+ {
+ if (Abs (uvLast.X() - aPrevVert.Coord().X()) > theTolX ||
+ Abs (uvLast.Y() - aPrevVert.Coord().Y()) > theTolY)
+ {
+ vl.Initialize ((uvLast.Coord() + aPrevVert.Coord())/2, ipl, BRepMesh_Frontier);
+ myStructure->MoveNode (thePrevPointInd, vl);
+ }
+ if ((Abs (uvFirst.X() - aFirstVert.Coord().X()) > theTolX ||
+ Abs (uvFirst.Y() - aFirstVert.Coord().Y()) > theTolY) &&
+ aFirstPoint.IsEqual (BRep_Tool::Pnt (pBegin), Precision::Confusion()))
+ {
+ vf.Initialize ((uvFirst.Coord() + aFirstVert.Coord())/2, ipf, BRepMesh_Frontier);
+ myStructure->MoveNode (myFirstPointInd, vf);
+ }
+ }
+ }
+
+ Standard_Integer ivf = myStructure->AddNode(vf);
Standard_Integer ivl= myStructure->AddNode(vl);
+ if (orEdge == TopAbs_FORWARD)
+ {
+ thePrevPointInd = ivl;
+ if (theFirstEdge)
+ myFirstPointInd = ivf;
+ }
+ if (orEdge == TopAbs_REVERSED)
+ {
+ thePrevPointInd = ivf;
+ if (theFirstEdge)
+ myFirstPointInd = ivl;
+ }
+
Standard_Integer isvf = myVemap.FindIndex(ivf);
if (isvf == 0) isvf = myVemap.Add(ivf);
Standard_Integer isvl = myVemap.FindIndex(ivl);
pair1.Append(P1);
myInternaledges.Bind(theEdge, pair1);
}
+ theFirstEdge = Standard_False;
}
gp_Pnt p3d1, p3d2;
Standard_Real tol1=::Precision::Confusion(), tol2=::Precision::Confusion(); //SK
+ Standard_Real pf, pl;
+ gp_Vec2d v1, v2;
+ Handle(Geom2d_Curve) c2d1, c2d2;
+ sae.PCurve (E1, face, c2d1, pf, pl, Standard_True);
+ c2d1->D1 (pl, p2d1, v1);
+ sae.PCurve (E2, face, c2d2, pf, pl, Standard_True);
+ c2d2->D1 (pf, p2d2, v2);
+
//=============
//:s2 abv 21 Apr 99: Speculation: try bending pcurves
Standard_Real bendtol1, bendtol2;
if ( ! doAddLong && inctol < MaxTolerance() &&
! myAnalyzer->Surface()->IsDegenerated ( p2d1, p2d2, 2.*tol, 10. ) ) { //:p7
if ( ! bendc1.IsNull() && ! bendc2.IsNull() &&
- bendtol1 < inctol && bendtol2 < inctol ) doBend = Standard_True;
+ bendtol1 < inctol && bendtol2 < inctol &&
+ ! (c2d1->IsKind (STANDARD_TYPE (Geom2d_Line)) && c2d2->IsKind (STANDARD_TYPE (Geom2d_Line)) &&
+ Abs (Abs (v1.Angle (v2)) - M_PI) < Precision::Angular()) ) doBend = Standard_True;
else doIncrease = Standard_True;
}
else
// else try to increase tol up to MaxTol
else if ( inctol > tol && inctol < MaxTolerance() ) {
if ( ! bendc1.IsNull() && ! bendc2.IsNull() &&
- bendtol1 < inctol && bendtol2 < inctol ) doBend = Standard_True;
+ bendtol1 < inctol && bendtol2 < inctol &&
+ ! (c2d1->IsKind (STANDARD_TYPE (Geom2d_Line)) && c2d2->IsKind (STANDARD_TYPE (Geom2d_Line)) &&
+ Abs (Abs (v1.Angle (v2)) - M_PI) < Precision::Angular()) ) doBend = Standard_True;
else doIncrease = Standard_True;
}