mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
0030272: Modeling Algorithms - Incorrect work of gproject
-fix TolU/V for approximation; -fix cutting tool for approximation; -add method Adaptor3d_HSurfaceTool::IsSurfG1. -add test bugs/moddata_3/bug30272
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
#include <Adaptor3d_CurveOnSurface.hxx>
|
||||
#include <Adaptor3d_Curve.hxx>
|
||||
#include <Adaptor3d_CurveOnSurface.hxx>
|
||||
#include <Adaptor3d_HSurfaceTool.hxx>
|
||||
#include <Adaptor3d_Surface.hxx>
|
||||
#include <AdvApprox_ApproxAFunction.hxx>
|
||||
#include <AdvApprox_DichoCutting.hxx>
|
||||
@@ -373,6 +374,14 @@ void Approx_CurveOnSurface::Perform(const Standard_Integer theMaxSegments,
|
||||
|
||||
if(theOnly3d && theOnly2d) throw Standard_ConstructionError();
|
||||
|
||||
GeomAbs_Shape aContinuity = theContinuity;
|
||||
if (aContinuity == GeomAbs_G1)
|
||||
aContinuity = GeomAbs_C1;
|
||||
else if (aContinuity == GeomAbs_G2)
|
||||
aContinuity = GeomAbs_C2;
|
||||
else if (aContinuity > GeomAbs_C2)
|
||||
aContinuity = GeomAbs_C2; //Restriction of AdvApprox_ApproxAFunction
|
||||
|
||||
Handle( Adaptor2d_Curve2d ) TrimmedC2D = myC2D->Trim( myFirst, myLast, Precision::PConfusion() );
|
||||
|
||||
Standard_Boolean isU, isForward;
|
||||
@@ -410,8 +419,24 @@ void Approx_CurveOnSurface::Perform(const Standard_Integer theMaxSegments,
|
||||
|
||||
Standard_Real TolU, TolV;
|
||||
|
||||
TolU = mySurf->UResolution(myTol)/2;
|
||||
TolV = mySurf->VResolution(myTol)/2;
|
||||
TolU = mySurf->UResolution(myTol) / 2.;
|
||||
TolV = mySurf->VResolution(myTol) / 2.;
|
||||
|
||||
if (mySurf->UContinuity() == GeomAbs_C0)
|
||||
{
|
||||
if (!Adaptor3d_HSurfaceTool::IsSurfG1(mySurf, Standard_True, Precision::Angular()))
|
||||
TolU = Min(1.e-3, 1.e3 * TolU);
|
||||
if (!Adaptor3d_HSurfaceTool::IsSurfG1(mySurf, Standard_True, Precision::Confusion()))
|
||||
TolU = Min(1.e-3, 1.e2 * TolU);
|
||||
}
|
||||
|
||||
if (mySurf->VContinuity() == GeomAbs_C0)
|
||||
{
|
||||
if (!Adaptor3d_HSurfaceTool::IsSurfG1(mySurf, Standard_False, Precision::Angular()))
|
||||
TolV = Min(1.e-3, 1.e3 * TolV);
|
||||
if (!Adaptor3d_HSurfaceTool::IsSurfG1(mySurf, Standard_False, Precision::Confusion()))
|
||||
TolV = Min(1.e-3, 1.e2 * TolV);
|
||||
}
|
||||
|
||||
OneDTol->SetValue(1,TolU);
|
||||
OneDTol->SetValue(2,TolV);
|
||||
@@ -423,20 +448,44 @@ void Approx_CurveOnSurface::Perform(const Standard_Integer theMaxSegments,
|
||||
ThreeDTol->Init(myTol/2);
|
||||
}
|
||||
|
||||
AdvApprox_Cutting* CutTool;
|
||||
|
||||
if (aContinuity <= myC2D->Continuity() &&
|
||||
aContinuity <= mySurf->UContinuity() &&
|
||||
aContinuity <= mySurf->VContinuity())
|
||||
{
|
||||
CutTool = new AdvApprox_DichoCutting();
|
||||
}
|
||||
else if (aContinuity == GeomAbs_C1)
|
||||
{
|
||||
Standard_Integer NbInterv_C1 = HCOnS->NbIntervals(GeomAbs_C1);
|
||||
TColStd_Array1OfReal CutPnts_C1(1, NbInterv_C1 + 1);
|
||||
HCOnS->Intervals(CutPnts_C1, GeomAbs_C1);
|
||||
Standard_Integer NbInterv_C2 = HCOnS->NbIntervals(GeomAbs_C2);
|
||||
TColStd_Array1OfReal CutPnts_C2(1, NbInterv_C2 + 1);
|
||||
HCOnS->Intervals(CutPnts_C2, GeomAbs_C2);
|
||||
|
||||
CutTool = new AdvApprox_PrefAndRec (CutPnts_C1, CutPnts_C2);
|
||||
}
|
||||
else
|
||||
{
|
||||
Standard_Integer NbInterv_C2 = HCOnS->NbIntervals(GeomAbs_C2);
|
||||
TColStd_Array1OfReal CutPnts_C2(1, NbInterv_C2 + 1);
|
||||
HCOnS->Intervals(CutPnts_C2, GeomAbs_C2);
|
||||
Standard_Integer NbInterv_C3 = HCOnS->NbIntervals(GeomAbs_C3);
|
||||
TColStd_Array1OfReal CutPnts_C3(1, NbInterv_C3 + 1);
|
||||
HCOnS->Intervals(CutPnts_C3, GeomAbs_C3);
|
||||
|
||||
CutTool = new AdvApprox_PrefAndRec (CutPnts_C2, CutPnts_C3);
|
||||
}
|
||||
|
||||
Standard_Integer NbInterv_C2 = HCOnS->NbIntervals(GeomAbs_C2);
|
||||
TColStd_Array1OfReal CutPnts_C2(1, NbInterv_C2 + 1);
|
||||
HCOnS->Intervals(CutPnts_C2, GeomAbs_C2);
|
||||
Standard_Integer NbInterv_C3 = HCOnS->NbIntervals(GeomAbs_C3);
|
||||
TColStd_Array1OfReal CutPnts_C3(1, NbInterv_C3 + 1);
|
||||
HCOnS->Intervals(CutPnts_C3, GeomAbs_C3);
|
||||
|
||||
AdvApprox_PrefAndRec CutTool(CutPnts_C2,CutPnts_C3);
|
||||
AdvApprox_ApproxAFunction aApprox (Num1DSS, Num2DSS, Num3DSS,
|
||||
OneDTol, TwoDTolNul, ThreeDTol,
|
||||
myFirst, myLast, theContinuity,
|
||||
myFirst, myLast, aContinuity,
|
||||
theMaxDegree, theMaxSegments,
|
||||
*EvalPtr, CutTool);
|
||||
*EvalPtr, *CutTool);
|
||||
|
||||
delete CutTool;
|
||||
|
||||
myIsDone = aApprox.IsDone();
|
||||
myHasResult = aApprox.HasResult();
|
||||
|
Reference in New Issue
Block a user