mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
0024800: Point of intersection was not found for 2d offset curve.
For fix this case in method Geom2dInt_Geom2dCurveTool::NBSamples() number of samples for 2d offset and trimmed curve is computed as max value from number of samples for other curve and number of samples for basis curve. Test case for issue CR24800
This commit is contained in:
@@ -860,3 +860,40 @@ Handle(Geom2d_BSplineCurve) Geom2dAdaptor_Curve::BSpline() const
|
||||
return *((Handle(Geom2d_BSplineCurve)*)&myCurve);
|
||||
}
|
||||
|
||||
static Standard_Integer nbPoints(const Handle(Geom2d_Curve)& theCurve)
|
||||
{
|
||||
|
||||
Standard_Integer nbs = 10;
|
||||
|
||||
if(theCurve->IsKind(STANDARD_TYPE( Geom2d_Line)) )
|
||||
nbs = 2;
|
||||
else if(theCurve->IsKind(STANDARD_TYPE( Geom2d_BezierCurve)))
|
||||
{
|
||||
nbs = 3 + (*((Handle(Geom2d_BezierCurve)*)&theCurve))->NbPoles();
|
||||
}
|
||||
else if(theCurve->IsKind(STANDARD_TYPE( Geom2d_BSplineCurve))) {
|
||||
nbs = (*((Handle(Geom2d_BSplineCurve)*)&theCurve))->NbKnots();
|
||||
nbs*= (*((Handle(Geom2d_BSplineCurve)*)&theCurve))->Degree();
|
||||
if(nbs < 2.0) nbs=2;
|
||||
}
|
||||
else if (theCurve->IsKind(STANDARD_TYPE(Geom2d_OffsetCurve)))
|
||||
{
|
||||
Handle(Geom2d_Curve) aCurve = (*((Handle(Geom2d_OffsetCurve)*)&theCurve))->BasisCurve();
|
||||
return Max(nbs, nbPoints(aCurve));
|
||||
}
|
||||
|
||||
else if (theCurve->IsKind(STANDARD_TYPE(Geom2d_TrimmedCurve)))
|
||||
{
|
||||
Handle(Geom2d_Curve) aCurve = (*((Handle(Geom2d_TrimmedCurve)*)&theCurve))->BasisCurve();
|
||||
return Max(nbs, nbPoints(aCurve));
|
||||
}
|
||||
if(nbs>300)
|
||||
nbs = 300;
|
||||
return nbs;
|
||||
|
||||
}
|
||||
|
||||
Standard_Integer Geom2dAdaptor_Curve::NbSamples() const
|
||||
{
|
||||
return nbPoints(myCurve);
|
||||
}
|
||||
|
Reference in New Issue
Block a user