mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-04 13:13:25 +03:00
0027773: Empty result of section operation between line and offset of a circle
In Edge/Edge intersection the Resolution for the Offset Curve based on the elementary curve (Line/Circle/Ellipse) is computed using this basis curve.
This commit is contained in:
@@ -21,9 +21,11 @@
|
||||
#include <ElCLib.hxx>
|
||||
#include <Geom_BezierCurve.hxx>
|
||||
#include <Geom_BSplineCurve.hxx>
|
||||
#include <Geom_Line.hxx>
|
||||
#include <Geom_Circle.hxx>
|
||||
#include <Geom_Curve.hxx>
|
||||
#include <Geom_Ellipse.hxx>
|
||||
#include <Geom_OffsetCurve.hxx>
|
||||
#include <GeomAPI_ProjectPointOnCurve.hxx>
|
||||
#include <gp_Dir.hxx>
|
||||
#include <gp_Lin.hxx>
|
||||
@@ -1354,7 +1356,7 @@ Standard_Integer TypeToInteger(const GeomAbs_CurveType theCType)
|
||||
Standard_Real ResolutionCoeff(const BRepAdaptor_Curve& theBAC,
|
||||
const IntTools_Range& theRange)
|
||||
{
|
||||
Standard_Real aResCoeff;
|
||||
Standard_Real aResCoeff = 0.;
|
||||
//
|
||||
const Handle(Geom_Curve)& aCurve = theBAC.Curve().Curve();
|
||||
const GeomAbs_CurveType aCurveType = theBAC.GetType();
|
||||
@@ -1366,9 +1368,26 @@ Standard_Real ResolutionCoeff(const BRepAdaptor_Curve& theBAC,
|
||||
case GeomAbs_Ellipse :
|
||||
aResCoeff = 1. / Handle(Geom_Ellipse)::DownCast (aCurve)->MajorRadius();
|
||||
break;
|
||||
case GeomAbs_OffsetCurve : {
|
||||
const Handle(Geom_OffsetCurve)& anOffsetCurve = Handle(Geom_OffsetCurve)::DownCast(aCurve);
|
||||
const Handle(Geom_Curve)& aBasisCurve = anOffsetCurve->BasisCurve();
|
||||
const GeomAbs_CurveType aBCType = GeomAdaptor_Curve(aBasisCurve).GetType();
|
||||
if (aBCType == GeomAbs_Line) {
|
||||
break;
|
||||
}
|
||||
else if (aBCType == GeomAbs_Circle) {
|
||||
aResCoeff = 1. / (2 * (anOffsetCurve->Offset() +
|
||||
Handle(Geom_Circle)::DownCast (aBasisCurve)->Circ().Radius()));
|
||||
break;
|
||||
}
|
||||
else if (aBCType == GeomAbs_Ellipse) {
|
||||
aResCoeff = 1. / (anOffsetCurve->Offset() +
|
||||
Handle(Geom_Ellipse)::DownCast (aBasisCurve)->MajorRadius());
|
||||
break;
|
||||
}
|
||||
}
|
||||
case GeomAbs_Hyperbola :
|
||||
case GeomAbs_Parabola :
|
||||
case GeomAbs_OffsetCurve :
|
||||
case GeomAbs_OtherCurve :{
|
||||
Standard_Real k, kMin, aDist, aDt, aT1, aT2, aT;
|
||||
Standard_Integer aNbP, i;
|
||||
@@ -1396,7 +1415,6 @@ Standard_Real ResolutionCoeff(const BRepAdaptor_Curve& theBAC,
|
||||
break;
|
||||
}
|
||||
default:
|
||||
aResCoeff = 0.;
|
||||
break;
|
||||
}
|
||||
//
|
||||
@@ -1429,6 +1447,20 @@ Standard_Real Resolution(const Handle(Geom_Curve)& theCurve,
|
||||
case GeomAbs_BSplineCurve:
|
||||
Handle(Geom_BSplineCurve)::DownCast (theCurve)->Resolution(theR3D, aRes);
|
||||
break;
|
||||
case GeomAbs_OffsetCurve: {
|
||||
const Handle(Geom_Curve)& aBasisCurve =
|
||||
Handle(Geom_OffsetCurve)::DownCast(theCurve)->BasisCurve();
|
||||
const GeomAbs_CurveType aBCType = GeomAdaptor_Curve(aBasisCurve).GetType();
|
||||
if (aBCType == GeomAbs_Line) {
|
||||
aRes = theR3D;
|
||||
break;
|
||||
}
|
||||
else if (aBCType == GeomAbs_Circle) {
|
||||
Standard_Real aDt = theResCoeff * theR3D;
|
||||
aRes = (aDt <= 1.) ? 2*ASin(aDt) : 2*M_PI;
|
||||
break;
|
||||
}
|
||||
}
|
||||
default:
|
||||
aRes = theResCoeff * theR3D;
|
||||
break;
|
||||
|
Reference in New Issue
Block a user