1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-14 13:30:48 +03:00

0030647: Geom2dGcc_Circ2d2TanRad not giving all the solutions

Method for calculation of correct number of sampling points is added for
Adaptor2d_OffsetCurve.
Now number of sampling points correspond with similar method for
Geom2dAdaptor_Curve for curve type GeomAbs_OffsetCurve
Test case added
This commit is contained in:
ifv
2019-04-15 12:47:08 +03:00
committed by bugmaster
parent f9b30c0db3
commit 833034f301
3 changed files with 63 additions and 1 deletions

View File

@@ -458,7 +458,7 @@ GeomAbs_CurveType Adaptor2d_OffsetCurve::GetType() const {
return GeomAbs_Circle;
default:
return GeomAbs_OtherCurve;
return GeomAbs_OffsetCurve;
}
}
@@ -650,3 +650,34 @@ Handle(Geom2d_BSplineCurve) Adaptor2d_OffsetCurve::BSpline() const
"Adaptor2d_OffsetCurve::BSpline() - wrong curve type");
return myCurve->BSpline();
}
static Standard_Integer nbPoints(const Handle(Adaptor2d_HCurve2d)& theCurve)
{
Standard_Integer nbs = 20;
if (theCurve->GetType() == GeomAbs_Line)
nbs = 2;
else if (theCurve->GetType() == GeomAbs_BezierCurve)
{
nbs = 3 + theCurve->NbPoles();
}
else if (theCurve->GetType() == GeomAbs_BSplineCurve) {
nbs = theCurve->NbKnots();
nbs *= theCurve->Degree();
}
if (nbs > 200)
nbs = 200;
return nbs;
}
//=======================================================================
//function : NbSamples
//purpose :
//=======================================================================
Standard_Integer Adaptor2d_OffsetCurve::NbSamples() const
{
return nbPoints(myCurve);
}

View File

@@ -174,6 +174,7 @@ public:
Standard_EXPORT Handle(Geom2d_BSplineCurve) BSpline() const Standard_OVERRIDE;
Standard_EXPORT Standard_Integer NbSamples() const Standard_OVERRIDE;