mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-21 10:13:43 +03:00
More correction in the algorithm of merging edges, applying more strict requirement to fluctuation of built curve from initial vertices.
This commit is contained in:
parent
fbc3f28c6e
commit
07af2e5c9b
@ -552,17 +552,26 @@ static TopoDS_Face createCylFaceFromArea(const TopoDS_Compound& theFaces,
|
|||||||
//function : updateVertexOnCirc
|
//function : updateVertexOnCirc
|
||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
static void updateVertexOnCirc(const TopoDS_Vertex& theV,
|
static Standard_Boolean updateVertexOnCirc(const TopoDS_Vertex& theV,
|
||||||
const gp_Circ& theCirc,
|
const gp_Circ& theCirc,
|
||||||
Standard_Real& thePar)
|
Standard_Real theMaxDist,
|
||||||
|
Standard_Real& thePar)
|
||||||
{
|
{
|
||||||
Standard_Real aTol = BRep_Tool::Tolerance(theV);
|
Standard_Real aTol = BRep_Tool::Tolerance(theV);
|
||||||
gp_Pnt aP = BRep_Tool::Pnt(theV);
|
gp_Pnt aP = BRep_Tool::Pnt(theV);
|
||||||
thePar = ElCLib::Parameter(theCirc, aP);
|
thePar = ElCLib::Parameter(theCirc, aP);
|
||||||
gp_Pnt aProj = ElCLib::Value(thePar, theCirc);
|
gp_Pnt aProj = ElCLib::Value(thePar, theCirc);
|
||||||
Standard_Real aDist = aProj.SquareDistance(aP);
|
Standard_Real aDist = aProj.SquareDistance(aP);
|
||||||
|
Standard_Boolean isOK = Standard_False;
|
||||||
if (aDist > aTol*aTol)
|
if (aDist > aTol*aTol)
|
||||||
BRep_Builder().UpdateVertex(theV, sqrt(aDist)*1.001);
|
{
|
||||||
|
if (aDist < theMaxDist*theMaxDist)
|
||||||
|
{
|
||||||
|
BRep_Builder().UpdateVertex(theV, sqrt(aDist)*1.001);
|
||||||
|
isOK = Standard_True;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return isOK;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@ -670,23 +679,27 @@ static TopoDS_Edge createCurveEdge(const TopTools_ListOfShape& theChain,
|
|||||||
aCircDir.Reverse();
|
aCircDir.Reverse();
|
||||||
gp_Circ aCirc(gp_Ax2(aCenter, aCircDir, aXDir), aRadius);
|
gp_Circ aCirc(gp_Ax2(aCenter, aCircDir, aXDir), aRadius);
|
||||||
Handle(Geom_Circle) aCurve = new Geom_Circle(aCirc);
|
Handle(Geom_Circle) aCurve = new Geom_Circle(aCirc);
|
||||||
// update vertices tolerance
|
// update vertices tolerance, but not more than on a value aTol,
|
||||||
|
// otherwise skip building a circle, and build bspline.
|
||||||
Standard_Real aPar;
|
Standard_Real aPar;
|
||||||
updateVertexOnCirc(aVF, aCirc, aPar);
|
if (updateVertexOnCirc(aVF, aCirc, aTol, aPar))
|
||||||
if (isClosed)
|
|
||||||
{
|
{
|
||||||
// full circle
|
if (isClosed)
|
||||||
aNewEdge = BRepBuilderAPI_MakeEdge(aCurve, aVF, aVL, 0, M_PI*2.);
|
{
|
||||||
}
|
// full circle
|
||||||
else
|
aNewEdge = BRepBuilderAPI_MakeEdge(aCurve, aVF, aVL, 0, M_PI*2.);
|
||||||
{
|
}
|
||||||
// an arc
|
else
|
||||||
updateVertexOnCirc(aVL, aCirc, aPar);
|
{
|
||||||
aNewEdge = BRepBuilderAPI_MakeEdge(aCurve, aVF, aVL, 0., aPar);
|
// an arc
|
||||||
|
if (updateVertexOnCirc(aVL, aCirc, aTol, aPar))
|
||||||
|
aNewEdge = BRepBuilderAPI_MakeEdge(aCurve, aVF, aVL, 0., aPar);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
if (aNewEdge.IsNull())
|
||||||
{
|
{
|
||||||
|
// not a circle, try building bspline
|
||||||
gp_Pnt aPnts1[3];
|
gp_Pnt aPnts1[3];
|
||||||
const gp_Pnt* pPnts = &aPnts(1);
|
const gp_Pnt* pPnts = &aPnts(1);
|
||||||
Standard_Integer np = aPnts.Length();
|
Standard_Integer np = aPnts.Length();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user