From 6a537593a1a0e3a2cbd5f19cb24bbb6b031d4281 Mon Sep 17 00:00:00 2001 From: nbv Date: Thu, 26 Oct 2017 17:32:37 +0300 Subject: [PATCH] Geom_RectangularTrimmedSurface --- src/AIS/AIS.cxx | 2 +- src/BOPTools/BOPTools_AlgoTools3D.cxx | 67 +- src/BRepBndLib/BRepBndLib.cxx | 4 +- src/BRepFeat/BRepFeat.cxx | 4 +- src/BRepLib/BRepLib_MakeFace.cxx | 4 +- src/BRepOffset/BRepOffset_Tool.cxx | 19 +- src/BRepToIGES/BRepToIGES_BRWire.cxx | 4 +- src/BRepTools/BRepTools.cxx | 4 +- .../BRepTools_NurbsConvertModification.cxx | 14 +- src/BinTools/BinTools_SurfaceSet.cxx | 4 +- src/BndLib/BndLib_AddSurface.cxx | 4 +- src/ChFi3d/ChFi3d_Builder_0.cxx | 16 +- src/ChFi3d/ChFi3d_Builder_C1.cxx | 9 +- src/DBRep/DBRep_DrawableShape.cxx | 14 +- src/DrawTrSurf/DrawTrSurf_BSplineSurface.cxx | 4 +- src/Geom/Geom_BSplineSurface.hxx | 4 +- src/Geom/Geom_BSplineSurface_1.cxx | 4 +- src/Geom/Geom_BezierSurface.cxx | 4 +- src/Geom/Geom_BezierSurface.hxx | 4 +- src/Geom/Geom_ConicalSurface.cxx | 4 +- src/Geom/Geom_ConicalSurface.hxx | 4 +- src/Geom/Geom_CylindricalSurface.cxx | 4 +- src/Geom/Geom_CylindricalSurface.hxx | 4 +- src/Geom/Geom_OffsetSurface.cxx | 8 +- src/Geom/Geom_OffsetSurface.hxx | 4 +- src/Geom/Geom_OsculatingSurface.cxx | 12 +- src/Geom/Geom_Plane.cxx | 4 +- src/Geom/Geom_Plane.hxx | 4 +- src/Geom/Geom_RectangularTrimmedSurface.cxx | 16 +- src/Geom/Geom_RectangularTrimmedSurface.hxx | 4 +- src/Geom/Geom_SphericalSurface.cxx | 4 +- src/Geom/Geom_SphericalSurface.hxx | 4 +- src/Geom/Geom_Surface.cxx | 4 +- src/Geom/Geom_Surface.hxx | 4 +- src/Geom/Geom_SurfaceOfLinearExtrusion.cxx | 13 +- src/Geom/Geom_SurfaceOfLinearExtrusion.hxx | 7 +- src/Geom/Geom_SurfaceOfRevolution.cxx | 16 +- src/Geom/Geom_SurfaceOfRevolution.hxx | 7 +- src/Geom/Geom_ToroidalSurface.cxx | 4 +- src/Geom/Geom_ToroidalSurface.hxx | 4 +- src/GeomAdaptor/GeomAdaptor_Surface.cxx | 12 +- src/GeomConvert/GeomConvert_1.cxx | 24 +- .../GeomEvaluator_OffsetSurface.cxx | 4 +- src/GeomFill/GeomFill_NSections.cxx | 16 +- src/GeomFill/GeomFill_Sweep.cxx | 4 +- src/GeomInt/GeomInt_IntSS_1.cxx | 4 +- src/GeomLib/GeomLib.cxx | 8 +- src/GeomLib/GeomLib_DenominatorMultiplier.cxx | 4 +- src/GeomPlate/GeomPlate_Surface.cxx | 4 +- src/GeomPlate/GeomPlate_Surface.hxx | 4 +- src/GeomToIGES/GeomToIGES_GeomSurface.cxx | 8 +- .../GeomToStep_MakeBoundedSurface.cxx | 2 +- src/GeomTools/GeomTools_SurfaceSet.cxx | 4 +- src/IntTools/IntTools_FaceFace.cxx | 9 +- src/LocOpe/LocOpe_Generator.cxx | 2 +- src/LocOpe/LocOpe_SplitDrafts.cxx | 2 +- src/LocOpe/LocOpe_WiresOnShape.cxx | 8 +- src/QABugs/QABugs_10.cxx | 4 +- src/SWDRAW/SWDRAW_ShapeUpgrade.cxx | 8 +- src/ShapeAnalysis/ShapeAnalysis_Surface.cxx | 1302 ++++++++--------- .../ShapeConstruct_ProjectCurveOnSurface.cxx | 14 +- .../ShapeCustom_BSplineRestriction.cxx | 8 +- src/ShapeCustom/ShapeCustom_Surface.cxx | 8 +- .../ShapeExtend_CompositeSurface.cxx | 4 +- .../ShapeExtend_CompositeSurface.hxx | 4 +- src/ShapeFix/ShapeFix_ComposeShell.cxx | 2 +- src/ShapeFix/ShapeFix_EdgeProjAux.cxx | 4 +- src/ShapeFix/ShapeFix_Face.cxx | 4 +- src/ShapeFix/ShapeFix_Wire.cxx | 8 +- .../ShapePersistent_Geom_Surface.cxx | 4 +- src/ShapeUpgrade/ShapeUpgrade_FaceDivide.cxx | 4 +- .../ShapeUpgrade_SplitSurface.cxx | 4 +- .../StepToTopoDS_TranslateEdgeLoop.cxx | 2 +- .../TopOpeBRepBuild_CorrectFace2d.cxx | 4 +- .../TopOpeBRepBuild_GridSS.cxx | 2 +- .../TopOpeBRepBuild_Section.cxx | 8 +- src/TopOpeBRepDS/TopOpeBRepDS_BuildTool.cxx | 4 +- src/TopOpeBRepTool/TopOpeBRepTool_2d.cxx | 2 +- .../TopOpeBRepTool_CurveTool.cxx | 8 +- .../TopOpeBRepTool_GEOMETRY.cxx | 4 +- .../TopOpeBRepTool_ShapeTool.cxx | 12 +- src/TopOpeBRepTool/TopOpeBRepTool_TOOL.cxx | 8 +- 82 files changed, 926 insertions(+), 953 deletions(-) diff --git a/src/AIS/AIS.cxx b/src/AIS/AIS.cxx index 60b6067de3..0ea55e63a2 100644 --- a/src/AIS/AIS.cxx +++ b/src/AIS/AIS.cxx @@ -1222,7 +1222,7 @@ void AIS::InitLengthBetweenCurvilinearFaces (const TopoDS_Face& theFirstFace, BRepTopAdaptor_FClass2d aClassifier (theSecondFace, Precision::Confusion()); TopAbs_State aState = - aClassifier.Perform (gp_Pnt2d (aPU, aPV), theSecondSurf->IsUPeriodic() || theSecondSurf->IsVPeriodic()); + aClassifier.Perform (gp_Pnt2d (aPU, aPV), theSecondSurf->IsUPeriodic111() || theSecondSurf->IsVPeriodic111()); if (aState == TopAbs_OUT || aState == TopAbs_UNKNOWN) { diff --git a/src/BOPTools/BOPTools_AlgoTools3D.cxx b/src/BOPTools/BOPTools_AlgoTools3D.cxx index 06653d1605..34621348e8 100644 --- a/src/BOPTools/BOPTools_AlgoTools3D.cxx +++ b/src/BOPTools/BOPTools_AlgoTools3D.cxx @@ -75,8 +75,8 @@ static void BOPTools_AlgoTools3D::DoSplitSEAMOnFace (const TopoDS_Edge& aSplit, const TopoDS_Face& aF) { - Standard_Boolean bIsUPeriodic, bIsVPeriodic, bIsLeft; - Standard_Real aTol, a, b, anUPeriod, anVPeriod, aT, anU, dU, anU1; + Standard_Boolean bIsLeft; + Standard_Real aTol, a, b, aT, anU, dU, anU1; Standard_Real aScPr, anV, dV, anV1; Standard_Real aUmin, aUmax, aVmin, aVmax; gp_Pnt2d aP2D; @@ -97,58 +97,19 @@ void BOPTools_AlgoTools3D::DoSplitSEAMOnFace (const TopoDS_Edge& aSplit, // aS->Bounds(aUmin, aUmax, aVmin, aVmax); // - bIsUPeriodic=aS->IsUPeriodic(); - bIsVPeriodic=aS->IsVPeriodic(); - // - anUPeriod = bIsUPeriodic ? aS->UPeriod() : 0.; - anVPeriod = bIsVPeriodic ? aS->VPeriod() : 0.; + const Standard_Boolean bIsUPeriodic = aS->IsUPeriodic111(), + bIsVPeriodic = aS->IsVPeriodic111(); + + const Standard_Real anUPeriod = bIsUPeriodic ? aS->UPeriod() : 0., + anVPeriod = bIsVPeriodic ? aS->VPeriod() : 0.; + + const Standard_Boolean bIsUClosed = aS->IsUClosed(), + bIsVClosed = aS->IsVClosed(); // - if (!bIsUPeriodic && !bIsVPeriodic) { - Standard_Boolean bIsUClosed, bIsVClosed; - Handle(Geom_BSplineSurface) aBS; - Handle(Geom_BezierSurface) aBZ; - Handle(Geom_RectangularTrimmedSurface) aRTS; - // - bIsUClosed=Standard_False; - bIsVClosed=Standard_False; - aBS=Handle(Geom_BSplineSurface)::DownCast(aS); - aBZ=Handle(Geom_BezierSurface) ::DownCast(aS); - aRTS=Handle(Geom_RectangularTrimmedSurface)::DownCast(aS); - // - if (!aBS.IsNull()) { - bIsUClosed=aBS->IsUClosed(); - bIsVClosed=aBS->IsVClosed(); - } - else if (!aBZ.IsNull()) { - bIsUClosed=aBZ->IsUClosed(); - bIsVClosed=aBZ->IsVClosed(); - } - else if (!aRTS.IsNull()) { - Handle(Geom_Surface) aSB; - // - aSB=aRTS->BasisSurface(); - bIsUPeriodic=aSB->IsUPeriodic(); - bIsVPeriodic=aSB->IsVPeriodic(); - // - if (!(bIsUPeriodic || bIsVPeriodic)) { - return; - } - anUPeriod = bIsUPeriodic ? aSB->UPeriod() : 0.; - anVPeriod = bIsVPeriodic ? aSB->VPeriod() : 0.; - } - // - if (aRTS.IsNull()) { - if (!bIsUClosed && !bIsVClosed) { - return; - } - // - if (bIsUClosed) { - anUPeriod=aUmax-aUmin; - } - if (bIsVClosed) { - anVPeriod=aVmax-aVmin; - } - } + if ((!bIsUPeriodic || !bIsUClosed) && + (!bIsVPeriodic || !bIsVClosed)) + { + return; } // //--------------------------------------------------- diff --git a/src/BRepBndLib/BRepBndLib.cxx b/src/BRepBndLib/BRepBndLib.cxx index 6aa8c2dd49..5048879e96 100644 --- a/src/BRepBndLib/BRepBndLib.cxx +++ b/src/BRepBndLib/BRepBndLib.cxx @@ -588,7 +588,7 @@ void FindExactUVBounds(const TopoDS_Face FF, Handle(Geom_Surface) aS = BRep_Tool::Surface(FF, aLoc); Standard_Real aUmin, aUmax, aVmin, aVmax; aS->Bounds(aUmin, aUmax, aVmin, aVmax); - if(!aS->IsUPeriodic()) + if(!aS->IsUPeriodic111()) { umin = Max(aUmin, umin); umax = Min(aUmax, umax); @@ -603,7 +603,7 @@ void FindExactUVBounds(const TopoDS_Face FF, } } // - if(!aS->IsVPeriodic()) + if(!aS->IsVPeriodic111()) { vmin = Max(aVmin, vmin); vmax = Min(aVmax, vmax); diff --git a/src/BRepFeat/BRepFeat.cxx b/src/BRepFeat/BRepFeat.cxx index 09e7ec8858..fed3f27a79 100644 --- a/src/BRepFeat/BRepFeat.cxx +++ b/src/BRepFeat/BRepFeat.cxx @@ -442,12 +442,12 @@ Standard_Boolean BRepFeat::IsInside(const TopoDS_Face& F1, // Standard_Real periodu, periodv; BRepTools::UVBounds(F2,umin,umax,vmin,vmax); - if (S->IsUPeriodic()) { + if (S->IsUPeriodic111()) { flagu = 1; uperiod = S->UPeriod(); } - if (S->IsVPeriodic()) { + if (S->IsVPeriodic111()) { flagv = 1; vperiod = S->VPeriod(); } diff --git a/src/BRepLib/BRepLib_MakeFace.cxx b/src/BRepLib/BRepLib_MakeFace.cxx index 8046062ce5..921f3de060 100644 --- a/src/BRepLib/BRepLib_MakeFace.cxx +++ b/src/BRepLib/BRepLib_MakeFace.cxx @@ -537,7 +537,7 @@ void BRepLib_MakeFace::Init(const Handle(Geom_Surface)& SS, } } - if (S->IsUPeriodic()) { + if (S->IsUPeriodic111()) { ElCLib::AdjustPeriodic(umin,umax,epsilon,UMin,UMax); } else if (UMin > UMax) { @@ -550,7 +550,7 @@ void BRepLib_MakeFace::Init(const Handle(Geom_Surface)& SS, } } - if (S->IsVPeriodic()) { + if (S->IsVPeriodic111()) { ElCLib::AdjustPeriodic(vmin,vmax,epsilon,VMin,VMax); } else if (VMin > VMax) { diff --git a/src/BRepOffset/BRepOffset_Tool.cxx b/src/BRepOffset/BRepOffset_Tool.cxx index 3e7b99e96e..17b3c70f9a 100644 --- a/src/BRepOffset/BRepOffset_Tool.cxx +++ b/src/BRepOffset/BRepOffset_Tool.cxx @@ -252,19 +252,16 @@ static void PutInBounds (const TopoDS_Face& F, BRep_Tool::Range(E,f,l); TopLoc_Location L; // Recup S avec la location pour eviter la copie. - Handle (Geom_Surface) S = BRep_Tool::Surface(F,L); + const Handle (Geom_Surface) &S = BRep_Tool::Surface(F,L); - if (S->IsInstance(STANDARD_TYPE(Geom_RectangularTrimmedSurface))) { - S = Handle(Geom_RectangularTrimmedSurface)::DownCast (S)->BasisSurface(); - } //--------------- // Recadre en U. //--------------- - if (!S->IsUPeriodic() && !S->IsVPeriodic()) return; + if (!S->IsUPeriodic111() && !S->IsVPeriodic111()) return; FindPeriod (F,umin,umax,vmin,vmax); - if (S->IsUPeriodic()) { + if (S->IsUPeriodic111()) { Standard_Real period = S->UPeriod(); Standard_Real eps = period*1.e-6; gp_Pnt2d Pf = C2d->Value(f); @@ -298,7 +295,7 @@ static void PutInBounds (const TopoDS_Face& F, //------------------ // Recadre en V. //------------------ - if (S->IsVPeriodic()) { + if (S->IsVPeriodic111()) { Standard_Real period = S->VPeriod(); Standard_Real eps = period*1.e-6; gp_Pnt2d Pf = C2d->Value(f); @@ -433,7 +430,7 @@ static void BuildPCurves (const TopoDS_Edge& E, C2d = BRep_Tool::CurveOnSurface( theEdge, theFace, f, l ); C2d = new Geom2d_TrimmedCurve( C2d, U1, U2 ); - if (theSurf->IsUPeriodic() || theSurf->IsVPeriodic()) + if (theSurf->IsUPeriodic111() || theSurf->IsVPeriodic111()) PutInBounds( F, E, C2d ); BRep_Builder B; @@ -3079,7 +3076,7 @@ Standard_Boolean BRepOffset_Tool::EnLargeFace Standard_Real UF1,VF1,UF2,VF2; Standard_Boolean SurfaceChange = Standard_False; - if (S->IsUPeriodic() || S->IsVPeriodic()) { + if (S->IsUPeriodic111() || S->IsVPeriodic111()) { // Calcul serre pour que les bornes ne couvre pas plus d une periode CompactUVBounds(F,UF1,UF2,VF1,VF2); } @@ -3115,7 +3112,7 @@ Standard_Boolean BRepOffset_Tool::EnLargeFace VV1 = Max(VS1,VV1); VV2 = Min(VS2,VV2); } - if (S->IsUPeriodic()) { + if (S->IsUPeriodic111()) { Standard_Real Period = S->UPeriod(); Standard_Real Delta = Period - (UF2 - UF1); Standard_Real alpha = 0.1; @@ -3124,7 +3121,7 @@ Standard_Boolean BRepOffset_Tool::EnLargeFace UU2 = UU1 + Period; } } - if (S->IsVPeriodic()) { + if (S->IsVPeriodic111()) { Standard_Real Period = S->VPeriod(); Standard_Real Delta = Period - (VF2 - VF1); Standard_Real alpha = 0.1; diff --git a/src/BRepToIGES/BRepToIGES_BRWire.cxx b/src/BRepToIGES/BRepToIGES_BRWire.cxx index 595a3619d7..8600ec3e12 100644 --- a/src/BRepToIGES/BRepToIGES_BRWire.cxx +++ b/src/BRepToIGES/BRepToIGES_BRWire.cxx @@ -387,10 +387,10 @@ Handle(IGESData_IGESEntity) BRepToIGES_BRWire ::TransferEdge (const TopoDS_Edge& Standard_Real uShift = 0., vShift = 0.; Standard_Real U0, U1, V0, V1; Surf->Bounds(U0, U1, V0, V1); - if (aBSpline->IsUPeriodic() && Abs(Ufirst - U0) > Precision::PConfusion()) { + if (aBSpline->IsUPeriodic111() && Abs(Ufirst - U0) > Precision::PConfusion()) { uShift = ShapeAnalysis::AdjustToPeriod(Ufirst, U0, U1); } - if (aBSpline->IsVPeriodic() && Abs(Vfirst - V0) > Precision::PConfusion()) { + if (aBSpline->IsVPeriodic111() && Abs(Vfirst - V0) > Precision::PConfusion()) { vShift = ShapeAnalysis::AdjustToPeriod(Vfirst, V0, V1); } if (Abs(uShift) > Precision::PConfusion() || Abs(vShift) > Precision::PConfusion()) { diff --git a/src/BRepTools/BRepTools.cxx b/src/BRepTools/BRepTools.cxx index 1a9f43b55b..2443649aff 100644 --- a/src/BRepTools/BRepTools.cxx +++ b/src/BRepTools/BRepTools.cxx @@ -238,7 +238,7 @@ void BRepTools::AddUVBounds(const TopoDS_Face& aF, } // - if(!aS->IsUPeriodic()) + if(!aS->IsUPeriodic111()) { Standard_Boolean isUPeriodic = Standard_False; @@ -319,7 +319,7 @@ void BRepTools::AddUVBounds(const TopoDS_Face& aF, } } - if(!aS->IsVPeriodic()) + if(!aS->IsVPeriodic111()) { Standard_Boolean isVPeriodic = Standard_False; diff --git a/src/BRepTools/BRepTools_NurbsConvertModification.cxx b/src/BRepTools/BRepTools_NurbsConvertModification.cxx index 10103f5678..50e8c82ef1 100644 --- a/src/BRepTools/BRepTools_NurbsConvertModification.cxx +++ b/src/BRepTools/BRepTools_NurbsConvertModification.cxx @@ -131,7 +131,7 @@ Standard_Boolean BRepTools_NurbsConvertModification::NewSurface BRepTools::UVBounds(F,curvU1,curvU2,curvV1,curvV2); Tol = BRep_Tool::Tolerance(F); Standard_Real TolPar = 0.1*Tol; - Standard_Boolean IsUp = S->IsUPeriodic(), IsVp = S->IsVPeriodic(); + Standard_Boolean IsUp = S->IsUPeriodic111(), IsVp = S->IsVPeriodic111(); //OCC466(apo)-> U1 = curvU1; U2 = curvU2; V1 = curvV1; V2 = curvV2; @@ -223,10 +223,10 @@ Standard_Boolean BRepTools_NurbsConvertModification::NewSurface // on recadre les bornes de S sinon les anciennes PCurves sont aux fraises // - if (Abs(curvU1-surfU1) > UTol && !BS->IsUPeriodic()) { + if (Abs(curvU1-surfU1) > UTol && !BS->IsUPeriodic111()) { GeomLib_ChangeUBounds(BS, U1,U2) ; } - if (Abs(curvV1-surfV1) > VTol && !BS->IsVPeriodic()) { + if (Abs(curvV1-surfV1) > VTol && !BS->IsVPeriodic111()) { GeomLib_ChangeVBounds(BS, V1, V2) ; } @@ -435,7 +435,7 @@ Standard_Boolean BRepTools_NurbsConvertModification::NewCurve2d //Uinf -= 1e-9; Usup += 1e-9; Vinf -= 1e-9; Vsup += 1e-9; u = (Usup - Uinf)*0.1; v = (Vsup - Vinf)*0.1; - if(S->IsUPeriodic()) { + if(S->IsUPeriodic111()) { Standard_Real uperiod = S->UPeriod(); if(uperiod < (Usup+2*u-Uinf)) { if(uperiod <= (Usup-Uinf)) { @@ -446,7 +446,7 @@ Standard_Boolean BRepTools_NurbsConvertModification::NewCurve2d } } } - if(S->IsVPeriodic()) { + if(S->IsVPeriodic111()) { Standard_Real vperiod = S->VPeriod(); if(vperiod < (Vsup+2*v-Vinf)) { if(vperiod <= (Vsup-Vinf)) { @@ -589,7 +589,7 @@ Standard_Boolean BRepTools_NurbsConvertModification::NewCurve2d //Uinf -= 1e-9; Usup += 1e-9; Vinf -= 1e-9; Vsup += 1e-9; u = (Usup - Uinf)*0.1; v = (Vsup - Vinf)*0.1; - if(S->IsUPeriodic()) { + if(S->IsUPeriodic111()) { Standard_Real uperiod = S->UPeriod(); if(uperiod < (Usup+2*u-Uinf)) { if(uperiod <= (Usup-Uinf)) @@ -598,7 +598,7 @@ Standard_Boolean BRepTools_NurbsConvertModification::NewCurve2d u = (uperiod-(Usup-Uinf))*0.5; } } - if(S->IsVPeriodic()) { + if(S->IsVPeriodic111()) { Standard_Real vperiod = S->VPeriod(); if(vperiod < (Vsup+2*v-Vinf)) { if(vperiod <= (Vsup-Vinf)) diff --git a/src/BinTools/BinTools_SurfaceSet.cxx b/src/BinTools/BinTools_SurfaceSet.cxx index c43fe79f79..a44091a71c 100644 --- a/src/BinTools/BinTools_SurfaceSet.cxx +++ b/src/BinTools/BinTools_SurfaceSet.cxx @@ -300,8 +300,8 @@ static Standard_OStream& operator <<(Standard_OStream& OS, const Handle(Geom_BSp OS << (Standard_Byte)BSPLINE; Standard_Boolean urational = S->IsURational() ? 1:0; Standard_Boolean vrational = S->IsVRational() ? 1:0; - Standard_Boolean uperiodic = S->IsUPeriodic() ? 1:0; - Standard_Boolean vperiodic = S->IsVPeriodic() ? 1:0; + Standard_Boolean uperiodic = S->IsUPeriodic111() ? 1:0; + Standard_Boolean vperiodic = S->IsVPeriodic111() ? 1:0; BinTools::PutBool(OS, urational); BinTools::PutBool(OS, vrational); BinTools::PutBool(OS, uperiodic); diff --git a/src/BndLib/BndLib_AddSurface.cxx b/src/BndLib/BndLib_AddSurface.cxx index d55bddd3d6..09d1bb16ab 100644 --- a/src/BndLib/BndLib_AddSurface.cxx +++ b/src/BndLib/BndLib_AddSurface.cxx @@ -399,7 +399,7 @@ void BndLib_AddSurface::Add(const Adaptor3d_Surface& S, Standard_Integer anUFlatKnotsCount = S.BSpline()->NbUPoles() + S.BSpline()->UDegree() + 1; Standard_Integer aShift = 1; - if (S.BSpline()->IsUPeriodic()) + if (S.BSpline()->IsUPeriodic111()) { TColStd_Array1OfInteger aMults(1, S.BSpline()->NbUKnots()); S.BSpline()->UMultiplicities(aMults); @@ -425,7 +425,7 @@ void BndLib_AddSurface::Add(const Adaptor3d_Surface& S, Standard_Integer anVFlatKnotsCount = S.BSpline()->NbVPoles() + S.BSpline()->VDegree() + 1; Standard_Integer aShift = 1; - if (S.BSpline()->IsVPeriodic()) + if (S.BSpline()->IsVPeriodic111()) { TColStd_Array1OfInteger aMults(1, S.BSpline()->NbVKnots()); S.BSpline()->VMultiplicities(aMults); diff --git a/src/ChFi3d/ChFi3d_Builder_0.cxx b/src/ChFi3d/ChFi3d_Builder_0.cxx index 3fc897e213..1119041637 100644 --- a/src/ChFi3d/ChFi3d_Builder_0.cxx +++ b/src/ChFi3d/ChFi3d_Builder_0.cxx @@ -585,17 +585,14 @@ void ChFi3d_BoundSrf(GeomAdaptor_Surface& S, const Standard_Boolean checknaturalbounds) { Standard_Real umin = uumin, umax = uumax, vmin = vvmin, vmax = vvmax; - Handle(Geom_Surface) surface = S.Surface(); - Handle(Geom_RectangularTrimmedSurface) - trs = Handle(Geom_RectangularTrimmedSurface)::DownCast(surface); - if(!trs.IsNull()) surface = trs->BasisSurface(); + const Handle(Geom_Surface) &surface = S.Surface(); Standard_Real u1,u2,v1,v2; surface->Bounds(u1,u2,v1,v2); Standard_Real peru=0, perv=0; - if(surface->IsUPeriodic()) { + if(surface->IsUPeriodic111()) { peru = surface->UPeriod(); } - if(surface->IsVPeriodic()) { + if(surface->IsVPeriodic111()) { perv = surface->VPeriod(); } Standard_Real Stepu = umax - umin; @@ -2983,9 +2980,6 @@ Handle(Geom_Surface) trsfsurf(const Handle(Adaptor3d_HSurface)& HS, else if(!hgs.IsNull()) { res = hgs->ChangeSurface().Surface(); } - Handle(Geom_RectangularTrimmedSurface) - tr = Handle(Geom_RectangularTrimmedSurface)::DownCast(res); - if(!tr.IsNull()) res = tr->BasisSurface(); Standard_Real U1 = HS->FirstUParameter(), U2 = HS->LastUParameter(); Standard_Real V1 = HS->FirstVParameter(), V2 = HS->LastVParameter(); @@ -2993,11 +2987,11 @@ Handle(Geom_Surface) trsfsurf(const Handle(Adaptor3d_HSurface)& HS, // Protection against Construction Errors Standard_Real u1, u2, v1, v2; res->Bounds( u1, u2, v1, v2); - if (!res->IsUPeriodic()) { + if (!res->IsUPeriodic111()) { if (U1 < u1) U1 = u1; if (U2 > u2) U2 = u2; } - if (!res->IsVPeriodic()) { + if (!res->IsVPeriodic111()) { if (V1 < v1) V1 = v1; if (V2 > v2) V2 = v2; } diff --git a/src/ChFi3d/ChFi3d_Builder_C1.cxx b/src/ChFi3d/ChFi3d_Builder_C1.cxx index db524a4269..a51a6d6148 100644 --- a/src/ChFi3d/ChFi3d_Builder_C1.cxx +++ b/src/ChFi3d/ChFi3d_Builder_C1.cxx @@ -484,11 +484,8 @@ static void ChFi3d_Recale(BRepAdaptor_Surface& Bs, gp_Pnt2d& p2, const Standard_Boolean refon1) { - Handle(Geom_Surface) surf = Bs.ChangeSurface().Surface(); - Handle(Geom_RectangularTrimmedSurface) - ts = Handle(Geom_RectangularTrimmedSurface)::DownCast(surf); - if (!ts.IsNull()) surf = ts->BasisSurface(); - if (surf->IsUPeriodic()) { + const Handle(Geom_Surface) &surf = Bs.ChangeSurface().Surface(); + if (surf->IsUPeriodic111()) { Standard_Real u1 = p1.X(), u2 = p2.X(); Standard_Real uper = surf->UPeriod(); if (fabs(u2-u1) > 0.5*uper) { @@ -499,7 +496,7 @@ static void ChFi3d_Recale(BRepAdaptor_Surface& Bs, } p1.SetX(u1); p2.SetX(u2); } - if (surf->IsVPeriodic()) { + if (surf->IsVPeriodic111()) { Standard_Real v1 = p1.Y(), v2 = p2.Y(); Standard_Real vper = surf->VPeriod(); if (fabs(v2-v1) > 0.5*vper) { diff --git a/src/DBRep/DBRep_DrawableShape.cxx b/src/DBRep/DBRep_DrawableShape.cxx index 24b28a7585..9603debb2f 100644 --- a/src/DBRep/DBRep_DrawableShape.cxx +++ b/src/DBRep/DBRep_DrawableShape.cxx @@ -35,6 +35,7 @@ #include #include #include +#include #include #include #include @@ -390,18 +391,23 @@ void DBRep_DrawableShape::DrawOn(Draw_Display& dis) const if (!aSurf.IsNull()) { Standard_Boolean restriction = Standard_False; - if(aSurf->IsUPeriodic() || aSurf->IsVPeriodic()) { + if(aSurf->IsUPeriodic111() || aSurf->IsVPeriodic111()) { + Handle(Geom_Surface) aBS = aSurf; + if (aSurf->IsKind(STANDARD_TYPE(Geom_RectangularTrimmedSurface))) + { + aBS = Handle(Geom_RectangularTrimmedSurface)::DownCast(aSurf)->BasisSurface(); + } Standard_Real SU1 = 0., SU2 = 0., SV1 = 0., SV2 = 0.; Standard_Real FU1 = 0., FU2 = 0., FV1 = 0., FV2 = 0.; - aSurf->Bounds(SU1,SU2,SV1,SV2); + aBS->Bounds(SU1, SU2, SV1, SV2); BRepTools::UVBounds (F->Face(),FU1,FU2,FV1,FV2); - if(aSurf->IsUPeriodic()) { + if(aSurf->IsUPeriodic111()) { if(FU1 < SU1 || FU1 > SU2) restriction = Standard_True; if(!restriction && (FU2 < SU1 || FU2 > SU2)) restriction = Standard_True; } - if(!restriction && aSurf->IsVPeriodic()) { + if(!restriction && aSurf->IsVPeriodic111()) { if(FV1 < SV1 || FV1 > SV2) restriction = Standard_True; if(!restriction && (FV2 < SV1 || FV2 > SV2)) diff --git a/src/DrawTrSurf/DrawTrSurf_BSplineSurface.cxx b/src/DrawTrSurf/DrawTrSurf_BSplineSurface.cxx index d265ff020b..c9ebfa1ff5 100644 --- a/src/DrawTrSurf/DrawTrSurf_BSplineSurface.cxx +++ b/src/DrawTrSurf/DrawTrSurf_BSplineSurface.cxx @@ -108,7 +108,7 @@ void DrawTrSurf_BSplineSurface::DrawOn (Draw_Display& dis) const { for (i = 2; i <= NbUPoles; i++) { dis.DrawTo(SPoles(i, j)); } - if (S->IsUPeriodic()) + if (S->IsUPeriodic111() && S->IsUClosed()) dis.DrawTo(SPoles(1,j)); } for (i = 1; i <= NbUPoles; i++) { @@ -116,7 +116,7 @@ void DrawTrSurf_BSplineSurface::DrawOn (Draw_Display& dis) const { for (j = 2; j <= NbVPoles; j++) { dis.DrawTo(SPoles(i, j)); } - if (S->IsVPeriodic()) + if (S->IsVPeriodic111() && S->IsVClosed()) dis.DrawTo(SPoles(i,1)); } } diff --git a/src/Geom/Geom_BSplineSurface.hxx b/src/Geom/Geom_BSplineSurface.hxx index 9a54bf071d..8af6702afc 100644 --- a/src/Geom/Geom_BSplineSurface.hxx +++ b/src/Geom/Geom_BSplineSurface.hxx @@ -801,7 +801,7 @@ public: //! Returns True if the surface is closed in the U direction //! and if the B-spline has been turned into a periodic surface //! using the function SetUPeriodic. - Standard_EXPORT Standard_Boolean IsUPeriodic() const Standard_OVERRIDE; + Standard_EXPORT Standard_Boolean IsUPeriodic111() const Standard_OVERRIDE; //! Returns False if for each row of weights all the weights @@ -817,7 +817,7 @@ public: //! Returns True if the surface is closed in the V direction //! and if the B-spline has been turned into a periodic //! surface using the function SetVPeriodic. - Standard_EXPORT Standard_Boolean IsVPeriodic() const Standard_OVERRIDE; + Standard_EXPORT Standard_Boolean IsVPeriodic111() const Standard_OVERRIDE; //! Returns False if for each column of weights all the weights diff --git a/src/Geom/Geom_BSplineSurface_1.cxx b/src/Geom/Geom_BSplineSurface_1.cxx index db99bfcdd8..51d4056099 100644 --- a/src/Geom/Geom_BSplineSurface_1.cxx +++ b/src/Geom/Geom_BSplineSurface_1.cxx @@ -1261,7 +1261,7 @@ Standard_Boolean Geom_BSplineSurface::IsVClosed () const //purpose : //======================================================================= -Standard_Boolean Geom_BSplineSurface::IsUPeriodic () const +Standard_Boolean Geom_BSplineSurface::IsUPeriodic111 () const { return uperiodic; } @@ -1271,7 +1271,7 @@ Standard_Boolean Geom_BSplineSurface::IsUPeriodic () const //purpose : //======================================================================= -Standard_Boolean Geom_BSplineSurface::IsVPeriodic () const +Standard_Boolean Geom_BSplineSurface::IsVPeriodic111 () const { return vperiodic; } diff --git a/src/Geom/Geom_BezierSurface.cxx b/src/Geom/Geom_BezierSurface.cxx index c6ede954d4..5b6d17aa80 100644 --- a/src/Geom/Geom_BezierSurface.cxx +++ b/src/Geom/Geom_BezierSurface.cxx @@ -1839,7 +1839,7 @@ Standard_Boolean Geom_BezierSurface::IsVClosed () const //purpose : //======================================================================= -Standard_Boolean Geom_BezierSurface::IsUPeriodic () const +Standard_Boolean Geom_BezierSurface::IsUPeriodic111 () const { return Standard_False; } @@ -1849,7 +1849,7 @@ Standard_Boolean Geom_BezierSurface::IsUPeriodic () const //purpose : //======================================================================= -Standard_Boolean Geom_BezierSurface::IsVPeriodic () const +Standard_Boolean Geom_BezierSurface::IsVPeriodic111 () const { return Standard_False; } diff --git a/src/Geom/Geom_BezierSurface.hxx b/src/Geom/Geom_BezierSurface.hxx index 0519edf9bc..1e2c3b6cf4 100644 --- a/src/Geom/Geom_BezierSurface.hxx +++ b/src/Geom/Geom_BezierSurface.hxx @@ -537,10 +537,10 @@ public: Standard_EXPORT Standard_Boolean IsCNv (const Standard_Integer N) const Standard_OVERRIDE; //! Returns False. - Standard_EXPORT Standard_Boolean IsUPeriodic() const Standard_OVERRIDE; + Standard_EXPORT Standard_Boolean IsUPeriodic111() const Standard_OVERRIDE; //! Returns False. - Standard_EXPORT Standard_Boolean IsVPeriodic() const Standard_OVERRIDE; + Standard_EXPORT Standard_Boolean IsVPeriodic111() const Standard_OVERRIDE; //! Returns False if the weights are identical in the U direction, diff --git a/src/Geom/Geom_ConicalSurface.cxx b/src/Geom/Geom_ConicalSurface.cxx index 5dd0e7029b..13f533a870 100644 --- a/src/Geom/Geom_ConicalSurface.cxx +++ b/src/Geom/Geom_ConicalSurface.cxx @@ -164,7 +164,7 @@ Standard_Boolean Geom_ConicalSurface::IsVClosed () const //purpose : //======================================================================= -Standard_Boolean Geom_ConicalSurface::IsUPeriodic () const +Standard_Boolean Geom_ConicalSurface::IsUPeriodic111 () const { return Standard_True; } //======================================================================= @@ -172,7 +172,7 @@ Standard_Boolean Geom_ConicalSurface::IsUPeriodic () const //purpose : //======================================================================= -Standard_Boolean Geom_ConicalSurface::IsVPeriodic () const +Standard_Boolean Geom_ConicalSurface::IsVPeriodic111 () const { return Standard_False; } //======================================================================= diff --git a/src/Geom/Geom_ConicalSurface.hxx b/src/Geom/Geom_ConicalSurface.hxx index 5db22203b8..a93d192cc7 100644 --- a/src/Geom/Geom_ConicalSurface.hxx +++ b/src/Geom/Geom_ConicalSurface.hxx @@ -220,10 +220,10 @@ public: Standard_EXPORT Standard_Boolean IsVClosed() const Standard_OVERRIDE; //! Returns True. - Standard_EXPORT Standard_Boolean IsUPeriodic() const Standard_OVERRIDE; + Standard_EXPORT Standard_Boolean IsUPeriodic111() const Standard_OVERRIDE; //! Returns False. - Standard_EXPORT Standard_Boolean IsVPeriodic() const Standard_OVERRIDE; + Standard_EXPORT Standard_Boolean IsVPeriodic111() const Standard_OVERRIDE; //! Builds the U isoparametric line of this cone. The //! origin of this line is on the reference plane of this diff --git a/src/Geom/Geom_CylindricalSurface.cxx b/src/Geom/Geom_CylindricalSurface.cxx index dd500cb319..03ef89dfb3 100644 --- a/src/Geom/Geom_CylindricalSurface.cxx +++ b/src/Geom/Geom_CylindricalSurface.cxx @@ -140,14 +140,14 @@ Standard_Boolean Geom_CylindricalSurface::IsVClosed () const { return Stan //purpose : //======================================================================= -Standard_Boolean Geom_CylindricalSurface::IsUPeriodic () const { return Standard_True; } +Standard_Boolean Geom_CylindricalSurface::IsUPeriodic111 () const { return Standard_True; } //======================================================================= //function : IsVPeriodic //purpose : //======================================================================= -Standard_Boolean Geom_CylindricalSurface::IsVPeriodic () const { return Standard_False; } +Standard_Boolean Geom_CylindricalSurface::IsVPeriodic111 () const { return Standard_False; } //======================================================================= //function : SetCylinder diff --git a/src/Geom/Geom_CylindricalSurface.hxx b/src/Geom/Geom_CylindricalSurface.hxx index 8f4ae4dabc..a581e58ffc 100644 --- a/src/Geom/Geom_CylindricalSurface.hxx +++ b/src/Geom/Geom_CylindricalSurface.hxx @@ -159,10 +159,10 @@ public: Standard_EXPORT Standard_Boolean IsVClosed() const Standard_OVERRIDE; //! Returns True. - Standard_EXPORT Standard_Boolean IsUPeriodic() const Standard_OVERRIDE; + Standard_EXPORT Standard_Boolean IsUPeriodic111() const Standard_OVERRIDE; //! Returns False. - Standard_EXPORT Standard_Boolean IsVPeriodic() const Standard_OVERRIDE; + Standard_EXPORT Standard_Boolean IsVPeriodic111() const Standard_OVERRIDE; //! The UIso curve is a Line. The location point of this line is diff --git a/src/Geom/Geom_OffsetSurface.cxx b/src/Geom/Geom_OffsetSurface.cxx index 207deca32d..94c6dae89b 100644 --- a/src/Geom/Geom_OffsetSurface.cxx +++ b/src/Geom/Geom_OffsetSurface.cxx @@ -637,9 +637,9 @@ Standard_Boolean Geom_OffsetSurface::IsCNv (const Standard_Integer N) const //purpose : //======================================================================= -Standard_Boolean Geom_OffsetSurface::IsUPeriodic () const +Standard_Boolean Geom_OffsetSurface::IsUPeriodic111 () const { - return basisSurf->IsUPeriodic(); + return basisSurf->IsUPeriodic111(); } //======================================================================= @@ -657,9 +657,9 @@ Standard_Real Geom_OffsetSurface::UPeriod() const //purpose : //======================================================================= -Standard_Boolean Geom_OffsetSurface::IsVPeriodic () const +Standard_Boolean Geom_OffsetSurface::IsVPeriodic111 () const { - return basisSurf->IsVPeriodic(); + return basisSurf->IsVPeriodic111(); } //======================================================================= diff --git a/src/Geom/Geom_OffsetSurface.hxx b/src/Geom/Geom_OffsetSurface.hxx index c568f3abac..c88864f73d 100644 --- a/src/Geom/Geom_OffsetSurface.hxx +++ b/src/Geom/Geom_OffsetSurface.hxx @@ -209,7 +209,7 @@ public: //! Returns true if this offset surface is periodic in the u //! parametric direction, i.e. if the basis //! surface of this offset surface is periodic in this direction. - Standard_EXPORT Standard_Boolean IsUPeriodic() const Standard_OVERRIDE; + Standard_EXPORT Standard_Boolean IsUPeriodic111() const Standard_OVERRIDE; //! Returns the period of this offset surface in the u //! parametric direction respectively, i.e. the period of the @@ -221,7 +221,7 @@ public: //! Returns true if this offset surface is periodic in the v //! parametric direction, i.e. if the basis //! surface of this offset surface is periodic in this direction. - Standard_EXPORT Standard_Boolean IsVPeriodic() const Standard_OVERRIDE; + Standard_EXPORT Standard_Boolean IsVPeriodic111() const Standard_OVERRIDE; //! Returns the period of this offset surface in the v //! parametric direction respectively, i.e. the period of the diff --git a/src/Geom/Geom_OsculatingSurface.cxx b/src/Geom/Geom_OsculatingSurface.cxx index ed380b8684..55f3bf5c70 100644 --- a/src/Geom/Geom_OsculatingSurface.cxx +++ b/src/Geom/Geom_OsculatingSurface.cxx @@ -105,8 +105,8 @@ void Geom_OsculatingSurface::Init(const Handle(Geom_Surface)& BS, UMults,VMults, BzS->UDegree(), BzS->VDegree(), - BzS->IsUPeriodic(), - BzS->IsVPeriodic()); + BzS->IsUPeriodic111(), + BzS->IsVPeriodic111()); } else { @@ -538,14 +538,14 @@ Standard_Boolean Geom_OsculatingSurface::BuildOsculatingSurface Standard_Integer aUfKnotsLength = BS->NbUPoles() + BS->UDegree() + 1; Standard_Integer aVfKnotsLength = BS->NbVPoles() + BS->VDegree() + 1; - if(BS->IsUPeriodic()) + if(BS->IsUPeriodic111()) { TColStd_Array1OfInteger aMults(1, BS->NbUKnots()); BS->UMultiplicities(aMults); aUfKnotsLength = BSplCLib::KnotSequenceLength(aMults, BS->UDegree(), Standard_True); } - if(BS->IsVPeriodic()) + if(BS->IsVPeriodic111()) { TColStd_Array1OfInteger aMults(1, BS->NbVKnots()); BS->VMultiplicities(aMults); @@ -582,8 +582,8 @@ Standard_Boolean Geom_OsculatingSurface::BuildOsculatingSurface vcacheparameter, uspanlength, vspanlength, - BS->IsUPeriodic(), - BS->IsVPeriodic(), + BS->IsUPeriodic111(), + BS->IsVPeriodic111(), BS->UDegree(), BS->VDegree(), ULocalIndex, diff --git a/src/Geom/Geom_Plane.cxx b/src/Geom/Geom_Plane.cxx index 65188e4f4c..6f2c6c7ce1 100644 --- a/src/Geom/Geom_Plane.cxx +++ b/src/Geom/Geom_Plane.cxx @@ -207,7 +207,7 @@ Standard_Boolean Geom_Plane::IsVClosed () const { //purpose : //======================================================================= -Standard_Boolean Geom_Plane::IsUPeriodic () const { +Standard_Boolean Geom_Plane::IsUPeriodic111 () const { return Standard_False; } @@ -217,7 +217,7 @@ Standard_Boolean Geom_Plane::IsUPeriodic () const { //purpose : //======================================================================= -Standard_Boolean Geom_Plane::IsVPeriodic () const { +Standard_Boolean Geom_Plane::IsVPeriodic111 () const { return Standard_False; } diff --git a/src/Geom/Geom_Plane.hxx b/src/Geom/Geom_Plane.hxx index 07caac2445..8cb95ab14d 100644 --- a/src/Geom/Geom_Plane.hxx +++ b/src/Geom/Geom_Plane.hxx @@ -168,10 +168,10 @@ public: Standard_EXPORT Standard_Boolean IsVClosed() const Standard_OVERRIDE; //! return False. - Standard_EXPORT Standard_Boolean IsUPeriodic() const Standard_OVERRIDE; + Standard_EXPORT Standard_Boolean IsUPeriodic111() const Standard_OVERRIDE; //! return False. - Standard_EXPORT Standard_Boolean IsVPeriodic() const Standard_OVERRIDE; + Standard_EXPORT Standard_Boolean IsVPeriodic111() const Standard_OVERRIDE; //! Computes the U isoparametric curve. diff --git a/src/Geom/Geom_RectangularTrimmedSurface.cxx b/src/Geom/Geom_RectangularTrimmedSurface.cxx index eec0b8aeca..8e394a579f 100644 --- a/src/Geom/Geom_RectangularTrimmedSurface.cxx +++ b/src/Geom/Geom_RectangularTrimmedSurface.cxx @@ -237,7 +237,7 @@ void Geom_RectangularTrimmedSurface::SetTrim(const Standard_Real U1, if ( U1 == U2) throw Standard_ConstructionError("Geom_RectangularTrimmedSurface::U1==U2"); - if (basisSurf->IsUPeriodic()) { + if (IsUPeriodic111()) { UsameSense = USense; // set uTrim1 in the range Udeb , Ufin @@ -277,7 +277,7 @@ void Geom_RectangularTrimmedSurface::SetTrim(const Standard_Real U1, if ( V1 == V2) throw Standard_ConstructionError("Geom_RectangularTrimmedSurface::V1==V2"); - if (basisSurf->IsVPeriodic()) { + if (IsVPeriodic111()) { VsameSense = VSense; // set vTrim1 in the range Vdeb , Vfin @@ -559,11 +559,9 @@ void Geom_RectangularTrimmedSurface::Transform (const Trsf& T) // 24/11/98: pmn : Compare la periode a la longeur de l'intervalle //======================================================================= -Standard_Boolean Geom_RectangularTrimmedSurface::IsUPeriodic () const +Standard_Boolean Geom_RectangularTrimmedSurface::IsUPeriodic111 () const { - if (basisSurf->IsUPeriodic() && !isutrimmed) - return Standard_True; - return Standard_False; + return basisSurf->IsUPeriodic111(); } @@ -583,11 +581,9 @@ Standard_Real Geom_RectangularTrimmedSurface::UPeriod() const //purpose : //======================================================================= -Standard_Boolean Geom_RectangularTrimmedSurface::IsVPeriodic () const +Standard_Boolean Geom_RectangularTrimmedSurface::IsVPeriodic111 () const { - if (basisSurf->IsVPeriodic() && !isvtrimmed) - return Standard_True; - return Standard_False; + return basisSurf->IsVPeriodic111(); } diff --git a/src/Geom/Geom_RectangularTrimmedSurface.hxx b/src/Geom/Geom_RectangularTrimmedSurface.hxx index 857797370b..ed0e4a3942 100644 --- a/src/Geom/Geom_RectangularTrimmedSurface.hxx +++ b/src/Geom/Geom_RectangularTrimmedSurface.hxx @@ -207,7 +207,7 @@ public: //! Returns true if this patch is periodic and not trimmed in the given //! parametric direction. - Standard_EXPORT Standard_Boolean IsUPeriodic() const Standard_OVERRIDE; + Standard_EXPORT Standard_Boolean IsUPeriodic111() const Standard_OVERRIDE; //! Returns the period of this patch in the u //! parametric direction. @@ -217,7 +217,7 @@ public: //! Returns true if this patch is periodic and not trimmed in the given //! parametric direction. - Standard_EXPORT Standard_Boolean IsVPeriodic() const Standard_OVERRIDE; + Standard_EXPORT Standard_Boolean IsVPeriodic111() const Standard_OVERRIDE; //! Returns the period of this patch in the v //! parametric direction. diff --git a/src/Geom/Geom_SphericalSurface.cxx b/src/Geom/Geom_SphericalSurface.cxx index a373e59b7a..54415f1b1c 100644 --- a/src/Geom/Geom_SphericalSurface.cxx +++ b/src/Geom/Geom_SphericalSurface.cxx @@ -143,7 +143,7 @@ Standard_Boolean Geom_SphericalSurface::IsVClosed () const //purpose : //======================================================================= -Standard_Boolean Geom_SphericalSurface::IsUPeriodic () const +Standard_Boolean Geom_SphericalSurface::IsUPeriodic111 () const { return Standard_True; } //======================================================================= @@ -151,7 +151,7 @@ Standard_Boolean Geom_SphericalSurface::IsUPeriodic () const //purpose : //======================================================================= -Standard_Boolean Geom_SphericalSurface::IsVPeriodic () const +Standard_Boolean Geom_SphericalSurface::IsVPeriodic111 () const { return Standard_False; } //======================================================================= diff --git a/src/Geom/Geom_SphericalSurface.hxx b/src/Geom/Geom_SphericalSurface.hxx index 827a468673..a4af4cb955 100644 --- a/src/Geom/Geom_SphericalSurface.hxx +++ b/src/Geom/Geom_SphericalSurface.hxx @@ -159,10 +159,10 @@ public: Standard_EXPORT Standard_Boolean IsVClosed() const Standard_OVERRIDE; //! Returns True. - Standard_EXPORT Standard_Boolean IsUPeriodic() const Standard_OVERRIDE; + Standard_EXPORT Standard_Boolean IsUPeriodic111() const Standard_OVERRIDE; //! Returns False. - Standard_EXPORT Standard_Boolean IsVPeriodic() const Standard_OVERRIDE; + Standard_EXPORT Standard_Boolean IsVPeriodic111() const Standard_OVERRIDE; //! Computes the U isoparametric curve. //! The U isoparametric curves of the surface are defined by the diff --git a/src/Geom/Geom_Surface.cxx b/src/Geom/Geom_Surface.cxx index d01f1a9979..60fed7b81f 100644 --- a/src/Geom/Geom_Surface.cxx +++ b/src/Geom/Geom_Surface.cxx @@ -87,7 +87,7 @@ gp_GTrsf2d Geom_Surface::ParametricTransformation(const gp_Trsf&) const Standard_Real Geom_Surface::UPeriod() const { Standard_NoSuchObject_Raise_if - ( !IsUPeriodic(),"Geom_Surface::UPeriod"); + ( !IsUPeriodic111(),"Geom_Surface::UPeriod"); Standard_Real U1, U2, V1, V2; Bounds(U1,U2,V1,V2); @@ -103,7 +103,7 @@ Standard_Real Geom_Surface::UPeriod() const Standard_Real Geom_Surface::VPeriod() const { Standard_NoSuchObject_Raise_if - ( !IsVPeriodic(),"Geom_Surface::VPeriod"); + ( !IsVPeriodic111(),"Geom_Surface::VPeriod"); Standard_Real U1, U2, V1, V2; Bounds(U1,U2,V1,V2); diff --git a/src/Geom/Geom_Surface.hxx b/src/Geom/Geom_Surface.hxx index 187c3b47d9..ff573e155f 100644 --- a/src/Geom/Geom_Surface.hxx +++ b/src/Geom/Geom_Surface.hxx @@ -183,7 +183,7 @@ public: //! v) (or the points P (u, v) and P (u, v + //! T)) is less than or equal to gp::Resolution(). //! Note: T is the parametric period in the u parametric direction. - Standard_EXPORT virtual Standard_Boolean IsUPeriodic() const = 0; + Standard_EXPORT virtual Standard_Boolean IsUPeriodic111() const = 0; //! Returns the period of this surface in the u //! parametric direction. @@ -198,7 +198,7 @@ public: //! v) (or the points P (u, v) and P (u, v + //! T)) is less than or equal to gp::Resolution(). //! Note: T is the parametric period in the v parametric direction. - Standard_EXPORT virtual Standard_Boolean IsVPeriodic() const = 0; + Standard_EXPORT virtual Standard_Boolean IsVPeriodic111() const = 0; //! Returns the period of this surface in the v parametric direction. //! raises if the surface is not vperiodic. diff --git a/src/Geom/Geom_SurfaceOfLinearExtrusion.cxx b/src/Geom/Geom_SurfaceOfLinearExtrusion.cxx index 3babe76114..c71c40cb8b 100644 --- a/src/Geom/Geom_SurfaceOfLinearExtrusion.cxx +++ b/src/Geom/Geom_SurfaceOfLinearExtrusion.cxx @@ -333,11 +333,20 @@ Standard_Boolean Geom_SurfaceOfLinearExtrusion::IsUClosed () const { //purpose : //======================================================================= -Standard_Boolean Geom_SurfaceOfLinearExtrusion::IsUPeriodic () const { +Standard_Boolean Geom_SurfaceOfLinearExtrusion::IsUPeriodic111 () const { return basisCurve->IsPeriodic111 (); } +//======================================================================= +//function : UPeriod +//purpose : +//======================================================================= +Standard_Real Geom_SurfaceOfLinearExtrusion::UPeriod() const +{ + return basisCurve->Period(); +} + //======================================================================= //function : IsVClosed //purpose : @@ -353,7 +362,7 @@ Standard_Boolean Geom_SurfaceOfLinearExtrusion::IsVClosed () const { //purpose : //======================================================================= -Standard_Boolean Geom_SurfaceOfLinearExtrusion::IsVPeriodic () const { +Standard_Boolean Geom_SurfaceOfLinearExtrusion::IsVPeriodic111 () const { return Standard_False; } diff --git a/src/Geom/Geom_SurfaceOfLinearExtrusion.hxx b/src/Geom/Geom_SurfaceOfLinearExtrusion.hxx index e0fb9d2f2f..5104092054 100644 --- a/src/Geom/Geom_SurfaceOfLinearExtrusion.hxx +++ b/src/Geom/Geom_SurfaceOfLinearExtrusion.hxx @@ -155,11 +155,14 @@ public: //! IsUPeriodic returns true if the "basis curve" of this //! surface of linear extrusion is periodic. - Standard_EXPORT Standard_Boolean IsUPeriodic() const Standard_OVERRIDE; + Standard_EXPORT Standard_Boolean IsUPeriodic111() const Standard_OVERRIDE; //! IsVPeriodic always returns false. - Standard_EXPORT Standard_Boolean IsVPeriodic() const Standard_OVERRIDE; + Standard_EXPORT Standard_Boolean IsVPeriodic111() const Standard_OVERRIDE; + //! Returns the period of this surface in the u parametric direction. + virtual Standard_Real UPeriod() const Standard_OVERRIDE; + //! Computes the U isoparametric curve of this surface //! of linear extrusion. This is the line parallel to the //! direction of extrusion, passing through the point of diff --git a/src/Geom/Geom_SurfaceOfRevolution.cxx b/src/Geom/Geom_SurfaceOfRevolution.cxx index 1fd41da8e8..fa41110c06 100644 --- a/src/Geom/Geom_SurfaceOfRevolution.cxx +++ b/src/Geom/Geom_SurfaceOfRevolution.cxx @@ -151,7 +151,7 @@ const gp_Pnt& Geom_SurfaceOfRevolution::Location () const { //purpose : //======================================================================= -Standard_Boolean Geom_SurfaceOfRevolution::IsUPeriodic () const { +Standard_Boolean Geom_SurfaceOfRevolution::IsUPeriodic111 () const { return Standard_True; } @@ -213,12 +213,20 @@ Standard_Boolean Geom_SurfaceOfRevolution::IsVClosed () const //function : IsVPeriodic //purpose : //======================================================================= +Standard_Boolean Geom_SurfaceOfRevolution::IsVPeriodic111() const +{ -Standard_Boolean Geom_SurfaceOfRevolution::IsVPeriodic () const { - - return basisCurve->IsPeriodic111(); + return (basisCurve->IsPeriodic111() && basisCurve->IsClosed()); } +//======================================================================= +//function : VPeriod +//purpose : +//======================================================================= +Standard_Real Geom_SurfaceOfRevolution::VPeriod() const +{ + return basisCurve->Period(); +} //======================================================================= //function : SetAxis diff --git a/src/Geom/Geom_SurfaceOfRevolution.hxx b/src/Geom/Geom_SurfaceOfRevolution.hxx index e83528e732..976fcef9ff 100644 --- a/src/Geom/Geom_SurfaceOfRevolution.hxx +++ b/src/Geom/Geom_SurfaceOfRevolution.hxx @@ -244,12 +244,15 @@ public: Standard_EXPORT Standard_Boolean IsCNv (const Standard_Integer N) const Standard_OVERRIDE; //! Returns True. - Standard_EXPORT Standard_Boolean IsUPeriodic() const Standard_OVERRIDE; + Standard_EXPORT Standard_Boolean IsUPeriodic111() const Standard_OVERRIDE; //! IsVPeriodic returns true if the meridian of this //! surface of revolution is periodic. - Standard_EXPORT Standard_Boolean IsVPeriodic() const Standard_OVERRIDE; + Standard_EXPORT Standard_Boolean IsVPeriodic111() const Standard_OVERRIDE; + //! Returns the period of this surface in the v parametric direction. + Standard_EXPORT virtual Standard_Real VPeriod() const Standard_OVERRIDE; + //! Computes the U isoparametric curve of this surface //! of revolution. It is the curve obtained by rotating the //! meridian through an angle U about the axis of revolution. diff --git a/src/Geom/Geom_ToroidalSurface.cxx b/src/Geom/Geom_ToroidalSurface.cxx index 2cba526d8d..cfec96844a 100644 --- a/src/Geom/Geom_ToroidalSurface.cxx +++ b/src/Geom/Geom_ToroidalSurface.cxx @@ -168,7 +168,7 @@ Standard_Boolean Geom_ToroidalSurface::IsVClosed () const { //purpose : //======================================================================= -Standard_Boolean Geom_ToroidalSurface::IsUPeriodic () const { +Standard_Boolean Geom_ToroidalSurface::IsUPeriodic111 () const { return Standard_True; } @@ -178,7 +178,7 @@ Standard_Boolean Geom_ToroidalSurface::IsUPeriodic () const { //purpose : //======================================================================= -Standard_Boolean Geom_ToroidalSurface::IsVPeriodic () const { +Standard_Boolean Geom_ToroidalSurface::IsVPeriodic111 () const { return Standard_True; } diff --git a/src/Geom/Geom_ToroidalSurface.hxx b/src/Geom/Geom_ToroidalSurface.hxx index 6c22fcafdb..6692c85f8c 100644 --- a/src/Geom/Geom_ToroidalSurface.hxx +++ b/src/Geom/Geom_ToroidalSurface.hxx @@ -183,10 +183,10 @@ public: Standard_EXPORT Standard_Boolean IsVClosed() const Standard_OVERRIDE; //! Returns True. - Standard_EXPORT Standard_Boolean IsUPeriodic() const Standard_OVERRIDE; + Standard_EXPORT Standard_Boolean IsUPeriodic111() const Standard_OVERRIDE; //! Returns True. - Standard_EXPORT Standard_Boolean IsVPeriodic() const Standard_OVERRIDE; + Standard_EXPORT Standard_Boolean IsVPeriodic111() const Standard_OVERRIDE; //! Computes the U isoparametric curve. //! diff --git a/src/GeomAdaptor/GeomAdaptor_Surface.cxx b/src/GeomAdaptor/GeomAdaptor_Surface.cxx index 621220dae0..7ba0b0c371 100644 --- a/src/GeomAdaptor/GeomAdaptor_Surface.cxx +++ b/src/GeomAdaptor/GeomAdaptor_Surface.cxx @@ -588,7 +588,7 @@ Standard_Boolean GeomAdaptor_Surface::IsUClosed() const Standard_Real U1,U2,V1,V2; mySurface->Bounds(U1,U2,V1,V2); - if (mySurface->IsUPeriodic()) + if (mySurface->IsUPeriodic111()) return (Abs(Abs(U1-U2)-Abs(myUFirst-myULast))Bounds(U1,U2,V1,V2); - if (mySurface->IsVPeriodic()) + if (mySurface->IsVPeriodic111()) return (Abs(Abs(V1-V2)-Abs(myVFirst-myVLast))IsUPeriodic()); + return (mySurface->IsUPeriodic111()); } //======================================================================= @@ -642,7 +642,7 @@ Standard_Real GeomAdaptor_Surface::UPeriod() const Standard_Boolean GeomAdaptor_Surface::IsVPeriodic() const { - return (mySurface->IsVPeriodic()); + return (mySurface->IsVPeriodic111()); } //======================================================================= @@ -683,8 +683,8 @@ void GeomAdaptor_Surface::RebuildCache(const Standard_Real theU, // Create cache for B-spline if (mySurfaceCache.IsNull()) mySurfaceCache = new BSplSLib_Cache( - myBSplineSurface->UDegree(), myBSplineSurface->IsUPeriodic(), myBSplineSurface->UKnotSequence(), - myBSplineSurface->VDegree(), myBSplineSurface->IsVPeriodic(), myBSplineSurface->VKnotSequence(), + myBSplineSurface->UDegree(), myBSplineSurface->IsUPeriodic111(), myBSplineSurface->UKnotSequence(), + myBSplineSurface->VDegree(), myBSplineSurface->IsVPeriodic111(), myBSplineSurface->VKnotSequence(), myBSplineSurface->Weights()); mySurfaceCache->BuildCache (theU, theV, myBSplineSurface->UKnotSequence(), myBSplineSurface->VKnotSequence(), myBSplineSurface->Poles(), myBSplineSurface->Weights()); diff --git a/src/GeomConvert/GeomConvert_1.cxx b/src/GeomConvert/GeomConvert_1.cxx index 7207022b37..8c928aaa90 100644 --- a/src/GeomConvert/GeomConvert_1.cxx +++ b/src/GeomConvert/GeomConvert_1.cxx @@ -145,13 +145,13 @@ Handle(Geom_BSplineSurface) GeomConvert::SplitBSplineSurface S1->Segment(S1->UKnot(FirstUK),S1->UKnot(LastUK), S1->VKnot(FirstVK),S1->VKnot(LastVK)); - if (S->IsUPeriodic()) { + if (S->IsUPeriodic111()) { if (!SameUOrientation) S1->UReverse(); } else { if (FromUK1 > ToUK2) S1->UReverse(); } - if (S->IsVPeriodic()) { + if (S->IsVPeriodic111()) { if (!SameVOrientation) S1->VReverse(); } else { @@ -191,7 +191,7 @@ Handle(Geom_BSplineSurface) GeomConvert::SplitBSplineSurface S1->VKnot(S1->FirstVKnotIndex()), S1->VKnot(S1->LastVKnotIndex())); - if (S->IsUPeriodic()) { + if (S->IsUPeriodic111()) { if (!SameOrientation) S1->UReverse(); } else { @@ -213,7 +213,7 @@ Handle(Geom_BSplineSurface) GeomConvert::SplitBSplineSurface S1->VKnot(LastVK)); - if (S->IsVPeriodic()) { + if (S->IsVPeriodic111()) { if (!SameOrientation) S1->VReverse(); } else { @@ -250,13 +250,13 @@ Handle(Geom_BSplineSurface) GeomConvert::SplitBSplineSurface NewSurface->Segment(FirstU, LastU, FirstV, LastV); - if (S->IsUPeriodic()) { + if (S->IsUPeriodic111()) { if (!SameUOrientation) NewSurface->UReverse(); } else { if (FromU1 > ToU2) NewSurface->UReverse(); } - if (S->IsVPeriodic()) { + if (S->IsVPeriodic111()) { if (!SameVOrientation) NewSurface->VReverse(); } else { @@ -293,7 +293,7 @@ Handle(Geom_BSplineSurface) GeomConvert::SplitBSplineSurface NewSurface->Segment(FirstU, LastU, FirstV, LastV); - if (S->IsUPeriodic()) { + if (S->IsUPeriodic111()) { if (!SameOrientation) NewSurface->UReverse(); } else { @@ -309,7 +309,7 @@ Handle(Geom_BSplineSurface) GeomConvert::SplitBSplineSurface NewSurface->Segment(FirstU, LastU, FirstV, LastV); - if (S->IsUPeriodic()) { + if (S->IsUPeriodic111()) { if (!SameOrientation) NewSurface->UReverse(); } else { @@ -506,7 +506,7 @@ Handle(Geom_BSplineSurface) GeomConvert::SurfaceToBSplineSurface Standard_Integer nbUSpans; Standard_Real AlfaU; - if (Strim->IsUPeriodic()) { + if (Strim->IsUPeriodic111()) { NbUKnots = 4; nbUSpans = 3; AlfaU = M_PI / 3.; @@ -660,20 +660,20 @@ Handle(Geom_BSplineSurface) GeomConvert::SurfaceToBSplineSurface Handle(Geom_BSplineSurface)::DownCast(Surf->Copy()); Standard_Real umin, umax, vmin, vmax; BS->Bounds(umin, umax, vmin, vmax); - if (!BS->IsUPeriodic()) { + if (!BS->IsUPeriodic111()) { if (U1 < umin) U1 = umin; if (U2 > umax) U2 = umax; } - if (!BS->IsVPeriodic()) { + if (!BS->IsVPeriodic111()) { if (V1 < vmin) V1 = vmin; if (V2 > vmax) V2 = vmax; } - if (BS->IsUPeriodic() || BS->IsVPeriodic()) + if (BS->IsUPeriodic111() || BS->IsVPeriodic111()) BS->CheckAndSegment (U1, U2, V1, V2); else BS->Segment (U1, U2, V1, V2); diff --git a/src/GeomEvaluator/GeomEvaluator_OffsetSurface.cxx b/src/GeomEvaluator/GeomEvaluator_OffsetSurface.cxx index 6943c9231e..a4e5ebdc35 100644 --- a/src/GeomEvaluator/GeomEvaluator_OffsetSurface.cxx +++ b/src/GeomEvaluator/GeomEvaluator_OffsetSurface.cxx @@ -52,8 +52,8 @@ static Standard_Boolean shiftPoint (const Standard_Real theUStart, const Standar if (! theSurf.IsNull()) { theSurf->Bounds (aUMin, aUMax, aVMin, aVMax); - isUPeriodic = theSurf->IsUPeriodic(); - isVPeriodic = theSurf->IsVPeriodic(); + isUPeriodic = theSurf->IsUPeriodic111(); + isVPeriodic = theSurf->IsVPeriodic111(); } else { diff --git a/src/GeomFill/GeomFill_NSections.cxx b/src/GeomFill/GeomFill_NSections.cxx index 07a69e3c66..214302a71c 100644 --- a/src/GeomFill/GeomFill_NSections.cxx +++ b/src/GeomFill/GeomFill_NSections.cxx @@ -328,13 +328,13 @@ GeomFill_NSections::GeomFill_NSections(const TColGeom_SequenceOfCurve& NC, Standard_Integer dimResult = mySurface->NbUPoles() * gap; Handle(Geom_BSplineSurface) surf_deper; - if (mySurface->IsVPeriodic()) { + if (mySurface->IsVPeriodic111()) { surf_deper = Handle(Geom_BSplineSurface)::DownCast(mySurface->Copy()); surf_deper->SetVNotPeriodic(); dimResult = surf_deper->NbUPoles() * gap; } TColStd_Array1OfReal Result(1,dimResult); - if (mySurface->IsVPeriodic()) { + if (mySurface->IsVPeriodic111()) { ResultEval(surf_deper,V,derivative_request,Result); } else { @@ -369,7 +369,7 @@ GeomFill_NSections::GeomFill_NSections(const TColGeom_SequenceOfCurve& NC, // verif par diff finies sous debug sauf pour les surfaces periodiques #ifdef OCCT_DEBUG - if (!mySurface->IsVPeriodic()) { + if (!mySurface->IsVPeriodic111()) { Standard_Real pas = 1.e-6, wTol = 1.e-4, pTol = 1.e-3; Standard_Real V1,V2; Standard_Boolean ok1,ok2; @@ -421,13 +421,13 @@ GeomFill_NSections::GeomFill_NSections(const TColGeom_SequenceOfCurve& NC, Standard_Integer dimResult = mySurface->NbUPoles() * gap; Handle(Geom_BSplineSurface) surf_deper; - if (mySurface->IsVPeriodic()) { + if (mySurface->IsVPeriodic111()) { surf_deper = Handle(Geom_BSplineSurface)::DownCast(mySurface->Copy()); surf_deper->SetVNotPeriodic(); dimResult = surf_deper->NbUPoles() * gap; } TColStd_Array1OfReal Result(1,dimResult); - if (mySurface->IsVPeriodic()) { + if (mySurface->IsVPeriodic111()) { ResultEval(surf_deper,V,derivative_request,Result); } else { @@ -463,7 +463,7 @@ GeomFill_NSections::GeomFill_NSections(const TColGeom_SequenceOfCurve& NC, // verif par diff finies sous debug sauf pour les surfaces periodiques #ifdef OCCT_DEBUG - if (!mySurface->IsVPeriodic()) { + if (!mySurface->IsVPeriodic111()) { Standard_Real V1,V2; Standard_Boolean ok1,ok2; Standard_Real pas = 1.e-6, wTol = 1.e-4, pTol = 1.e-3; @@ -691,7 +691,7 @@ GeomFill_NSections::GeomFill_NSections(const TColGeom_SequenceOfCurve& NC, Standard_Boolean GeomFill_NSections::IsUPeriodic() const { if (!mySurface.IsNull()) - return mySurface->IsUPeriodic(); + return mySurface->IsUPeriodic111(); return Standard_False; } @@ -702,7 +702,7 @@ GeomFill_NSections::GeomFill_NSections(const TColGeom_SequenceOfCurve& NC, Standard_Boolean GeomFill_NSections::IsVPeriodic() const { if (!mySurface.IsNull()) - return mySurface->IsVPeriodic(); + return mySurface->IsVPeriodic111(); return Standard_False; } diff --git a/src/GeomFill/GeomFill_Sweep.cxx b/src/GeomFill/GeomFill_Sweep.cxx index d37105dd82..5f0f8f8100 100644 --- a/src/GeomFill/GeomFill_Sweep.cxx +++ b/src/GeomFill/GeomFill_Sweep.cxx @@ -1035,11 +1035,11 @@ static Standard_Boolean IsSweepParallelSpine (const Handle(GeomFill_LocationLaw) (S,UFirst, ULast, Standard_True); #ifdef OCCT_DEBUG - if (isUPeriodic && !mySurface->IsUPeriodic()) + if (isUPeriodic && !mySurface->IsUPeriodic111()) cout<<"Pb de periodicite en U" << endl; if (isUPeriodic && !mySurface->IsUClosed()) cout<<"Pb de fermeture en U" << endl; - if (isVPeriodic && !mySurface->IsVPeriodic()) + if (isVPeriodic && !mySurface->IsVPeriodic111()) cout << "Pb de periodicite en V" << endl; if (isVPeriodic && !mySurface->IsVClosed()) cout<<"Pb de fermeture en V" << endl; diff --git a/src/GeomInt/GeomInt_IntSS_1.cxx b/src/GeomInt/GeomInt_IntSS_1.cxx index e2c93ea7f0..79ee0910e0 100644 --- a/src/GeomInt/GeomInt_IntSS_1.cxx +++ b/src/GeomInt/GeomInt_IntSS_1.cxx @@ -54,7 +54,7 @@ //======================================================================= static void AdjustUPeriodic (const Handle(Geom_Surface)& aS, const Handle(Geom2d_Curve)& aC2D) { - if (aC2D.IsNull() || !aS->IsUPeriodic()) + if (aC2D.IsNull() || !aS->IsUPeriodic111()) return; // const Standard_Real aEps=Precision::PConfusion();//1.e-9 @@ -1154,7 +1154,7 @@ void GeomInt_IntSS::BuildPCurves (Standard_Real f, } } // - if (S->IsUPeriodic() && !C2d.IsNull()) { + if (S->IsUPeriodic111() && !C2d.IsNull()) { // Recadre dans le domaine UV de la face Standard_Real aTm, U0, aEps, period, du, U0x; Standard_Boolean bAdjust; diff --git a/src/GeomLib/GeomLib.cxx b/src/GeomLib/GeomLib.cxx index 210483eb2a..14cb82f708 100644 --- a/src/GeomLib/GeomLib.cxx +++ b/src/GeomLib/GeomLib.cxx @@ -1486,7 +1486,7 @@ void GeomLib::ExtendSurfByLength(Handle(Geom_BoundedSurface)& Surface, BS->IncreaseDegree(BS->UDegree(),Continuity+1); // si BS etait periodique dans le sens de l'extension, elle ne le sera plus - if ( (InU&&(BS->IsUPeriodic())) || (!InU&&(BS->IsVPeriodic())) ) { + if ( (InU&&(BS->IsUPeriodic111())) || (!InU&&(BS->IsVPeriodic111())) ) { Standard_Real U0,U1,V0,V1; BS->Bounds(U0,U1,V0,V1); BS->Segment(U0,U1,V0,V1); @@ -1829,8 +1829,8 @@ void GeomLib::ExtendSurfByLength(Handle(Geom_BoundedSurface)& Surface, UKnots,VKnots, UMults,VMults, UDeg,VDeg, - BS->IsUPeriodic(), - BS->IsVPeriodic()); + BS->IsUPeriodic111(), + BS->IsVPeriodic111()); Surface = Res; } @@ -1983,7 +1983,7 @@ static Standard_Boolean CanBeTreated(Handle(Geom_BSplineSurface)& BSurf) Standard_Real lambda; //proportionnality coefficient Standard_Boolean AlreadyTreated=Standard_True; - if (!BSurf->IsURational()||(BSurf->IsUPeriodic())) + if (!BSurf->IsURational()||(BSurf->IsUPeriodic111())) return Standard_False; else { lambda=(BSurf->Weight(1,1)/BSurf->Weight(BSurf->NbUPoles(),1)); diff --git a/src/GeomLib/GeomLib_DenominatorMultiplier.cxx b/src/GeomLib/GeomLib_DenominatorMultiplier.cxx index ec55f88408..6d7030ba70 100644 --- a/src/GeomLib/GeomLib_DenominatorMultiplier.cxx +++ b/src/GeomLib/GeomLib_DenominatorMultiplier.cxx @@ -82,7 +82,7 @@ Standard_Real GeomLib_DenominatorMultiplier::Value(const Standard_Real UParamet &surface_u_mults,&surface_v_mults, udegree,vdegree, mySurface->IsURational(),mySurface->IsVRational(), - mySurface->IsUPeriodic(),mySurface->IsVPeriodic(), + mySurface->IsUPeriodic111(),mySurface->IsVPeriodic111(), N,Nu,Nv, Dumaxv, dDduumaxv, @@ -95,7 +95,7 @@ Standard_Real GeomLib_DenominatorMultiplier::Value(const Standard_Real UParamet &surface_u_mults,&surface_v_mults, udegree,vdegree, mySurface->IsURational(),mySurface->IsVRational(), - mySurface->IsUPeriodic(),mySurface->IsVPeriodic(), + mySurface->IsUPeriodic111(),mySurface->IsVPeriodic111(), N,Nu,Nv, Duminv, dDduuminv, diff --git a/src/GeomPlate/GeomPlate_Surface.cxx b/src/GeomPlate/GeomPlate_Surface.cxx index 89f8219728..5ec25bd741 100644 --- a/src/GeomPlate/GeomPlate_Surface.cxx +++ b/src/GeomPlate/GeomPlate_Surface.cxx @@ -157,7 +157,7 @@ Standard_Boolean GeomPlate_Surface::IsVClosed() const //purpose : //======================================================================= -Standard_Boolean GeomPlate_Surface::IsUPeriodic() const +Standard_Boolean GeomPlate_Surface::IsUPeriodic111() const { return Standard_False; } @@ -179,7 +179,7 @@ Standard_Real GeomPlate_Surface::UPeriod() const //purpose : //======================================================================= -Standard_Boolean GeomPlate_Surface::IsVPeriodic() const +Standard_Boolean GeomPlate_Surface::IsVPeriodic111() const { return Standard_False; } diff --git a/src/GeomPlate/GeomPlate_Surface.hxx b/src/GeomPlate/GeomPlate_Surface.hxx index 86dc118282..e807fe2d6d 100644 --- a/src/GeomPlate/GeomPlate_Surface.hxx +++ b/src/GeomPlate/GeomPlate_Surface.hxx @@ -158,7 +158,7 @@ public: //! P (U, V) and the point P (U + T, V) is lower or equal //! to Resolution from package gp. T is the parametric period //! and must be a constant. - Standard_EXPORT Standard_Boolean IsUPeriodic() const Standard_OVERRIDE; + Standard_EXPORT Standard_Boolean IsUPeriodic111() const Standard_OVERRIDE; //! returns the Uperiod. //! raises if the surface is not uperiodic. @@ -174,7 +174,7 @@ public: //! P (U, V) and the point P (U + T, V) is lower or equal //! to Resolution from package gp. T is the parametric period //! and must be a constant. - Standard_EXPORT Standard_Boolean IsVPeriodic() const Standard_OVERRIDE; + Standard_EXPORT Standard_Boolean IsVPeriodic111() const Standard_OVERRIDE; //! returns the Vperiod. //! raises if the surface is not vperiodic. diff --git a/src/GeomToIGES/GeomToIGES_GeomSurface.cxx b/src/GeomToIGES/GeomToIGES_GeomSurface.cxx index 64e80f923e..6c5d5219b5 100644 --- a/src/GeomToIGES/GeomToIGES_GeomSurface.cxx +++ b/src/GeomToIGES/GeomToIGES_GeomSurface.cxx @@ -233,8 +233,8 @@ Handle(IGESData_IGESEntity) GeomToIGES_GeomSurface::TransferSurface(const Handle Handle(IGESGeom_BSplineSurface) BSpline = new IGESGeom_BSplineSurface; Handle(Geom_BSplineSurface) mysurface; - Standard_Boolean PeriodU = start->IsUPeriodic(); - Standard_Boolean PeriodV = start->IsVPeriodic(); + Standard_Boolean PeriodU = start->IsUPeriodic111(); + Standard_Boolean PeriodV = start->IsVPeriodic111(); mysurface = Handle(Geom_BSplineSurface)::DownCast(start->Copy()); Standard_Real Umin = Udeb, Umax = Ufin, Vmin = Vdeb, Vmax = Vfin; @@ -278,7 +278,7 @@ Handle(IGESData_IGESEntity) GeomToIGES_GeomSurface::TransferSurface(const Handle Vmax = Vmin + (V1 - V0); } //unperiodize surface to get neccessary for IGES standard number of knots and mults - if ( mysurface->IsUPeriodic() ) { + if ( mysurface->IsUPeriodic111() ) { // set new origin for periodic BSpline surfaces for synchronization of pcurves ranges // and surface bounds (issue 26138) if (mysurface->IsKind(STANDARD_TYPE(Geom_BSplineSurface))) { @@ -294,7 +294,7 @@ Handle(IGESData_IGESEntity) GeomToIGES_GeomSurface::TransferSurface(const Handle } mysurface->SetUNotPeriodic(); } - if ( mysurface->IsVPeriodic() ) { + if ( mysurface->IsVPeriodic111() ) { // set new origin for periodic BSpline surfaces for synchronization of pcurves ranges // and surface bounds (issue 26138) if (mysurface->IsKind(STANDARD_TYPE(Geom_BSplineSurface))) { diff --git a/src/GeomToStep/GeomToStep_MakeBoundedSurface.cxx b/src/GeomToStep/GeomToStep_MakeBoundedSurface.cxx index 006b8d0f0e..c97a5655c5 100644 --- a/src/GeomToStep/GeomToStep_MakeBoundedSurface.cxx +++ b/src/GeomToStep/GeomToStep_MakeBoundedSurface.cxx @@ -41,7 +41,7 @@ GeomToStep_MakeBoundedSurface::GeomToStep_MakeBoundedSurface if (S->IsKind(STANDARD_TYPE(Geom_BSplineSurface))) { Handle(Geom_BSplineSurface) BS= Handle(Geom_BSplineSurface)::DownCast(S); // UPDATE FMA 1-04-96 - if (S->IsUPeriodic() || S->IsVPeriodic()) { + if (S->IsUPeriodic111() || S->IsVPeriodic111()) { Handle(Geom_BSplineSurface) newBS = Handle(Geom_BSplineSurface)::DownCast(BS->Copy()); newBS->SetUNotPeriodic(); diff --git a/src/GeomTools/GeomTools_SurfaceSet.cxx b/src/GeomTools/GeomTools_SurfaceSet.cxx index 60dd9b3e95..9fdd898c4f 100644 --- a/src/GeomTools/GeomTools_SurfaceSet.cxx +++ b/src/GeomTools/GeomTools_SurfaceSet.cxx @@ -443,8 +443,8 @@ static void Print(const Handle(Geom_BSplineSurface)& S, OS << " vrational"; } - Standard_Boolean uperiodic = S->IsUPeriodic(); - Standard_Boolean vperiodic = S->IsVPeriodic(); + Standard_Boolean uperiodic = S->IsUPeriodic111(); + Standard_Boolean vperiodic = S->IsVPeriodic111(); if (compact) OS << (uperiodic ? 1 : 0) << " "; else { diff --git a/src/IntTools/IntTools_FaceFace.cxx b/src/IntTools/IntTools_FaceFace.cxx index 0e35b94dd4..0da39771d9 100644 --- a/src/IntTools/IntTools_FaceFace.cxx +++ b/src/IntTools/IntTools_FaceFace.cxx @@ -2719,22 +2719,19 @@ Standard_Real MaxDistance(const Handle(Geom_Curve)& theC, // adjust domain for periodic surfaces TopLoc_Location aLoc; - Handle(Geom_Surface) aSurf = BRep_Tool::Surface(aFace, aLoc); - if (aSurf->IsKind(STANDARD_TYPE(Geom_RectangularTrimmedSurface))) { - aSurf = (Handle(Geom_RectangularTrimmedSurface)::DownCast(aSurf))->BasisSurface(); - } + const Handle(Geom_Surface) &aSurf = BRep_Tool::Surface(aFace, aLoc); gp_Pnt2d pnt = aPC->Value((fp+lp)/2); Standard_Real u,v; pnt.Coord(u,v); // - if (aSurf->IsUPeriodic()) { + if (aSurf->IsUPeriodic111()) { Standard_Real aPer = aSurf->UPeriod(); Standard_Integer nshift = (Standard_Integer) ((u-umin)/aPer); if (u < umin+aPer*nshift) nshift--; umin += aPer*nshift; umax += aPer*nshift; } - if (aSurf->IsVPeriodic()) { + if (aSurf->IsVPeriodic111()) { Standard_Real aPer = aSurf->VPeriod(); Standard_Integer nshift = (Standard_Integer) ((v-vmin)/aPer); if (v < vmin+aPer*nshift) nshift--; diff --git a/src/LocOpe/LocOpe_Generator.cxx b/src/LocOpe/LocOpe_Generator.cxx index 05b674657b..98582f7d7e 100644 --- a/src/LocOpe/LocOpe_Generator.cxx +++ b/src/LocOpe/LocOpe_Generator.cxx @@ -732,7 +732,7 @@ void LocOpe_Generator::Perform(const Handle(LocOpe_GeneratedShape)& G) // on met les courbes 2d si on n`est pas sur un plan // C est la courbe de edgbis, f et l s`y rapportent Handle(Geom2d_Curve) PTC = GeomProjLib::Curve2d(C,f,l,S,tol); - if (S->IsUPeriodic()) { + if (S->IsUPeriodic111()) { Standard_Real Uref; if (DontFuse.IsBound(edg)) { TopAbs_Orientation oredge = DontFuse(edg).Orientation(); diff --git a/src/LocOpe/LocOpe_SplitDrafts.cxx b/src/LocOpe/LocOpe_SplitDrafts.cxx index f09ca12182..858d9d57c4 100644 --- a/src/LocOpe/LocOpe_SplitDrafts.cxx +++ b/src/LocOpe/LocOpe_SplitDrafts.cxx @@ -1735,7 +1735,7 @@ static TopoDS_Edge NewEdge(const TopoDS_Edge& edg, } - if (S1->IsUPeriodic()) { + if (S1->IsUPeriodic111()) { Standard_Real speriod = S1->UPeriod(); // Standard_Real f,l; diff --git a/src/LocOpe/LocOpe_WiresOnShape.cxx b/src/LocOpe/LocOpe_WiresOnShape.cxx index d463cf9bf1..c0a092dc17 100644 --- a/src/LocOpe/LocOpe_WiresOnShape.cxx +++ b/src/LocOpe/LocOpe_WiresOnShape.cxx @@ -854,7 +854,7 @@ void PutPCurve(const TopoDS_Edge& Edg, B.UpdateVertex(V2,Max(old2,tol2)); } - if (S->IsUPeriodic()) { + if (S->IsUPeriodic111()) { Standard_Real up = S->UPeriod(); Standard_Real tolu = Precision::PConfusion();// Epsilon(up); Standard_Integer nbtra = 0; @@ -879,7 +879,7 @@ void PutPCurve(const TopoDS_Edge& Edg, } } - if (S->IsVPeriodic()) { + if (S->IsVPeriodic111()) { Standard_Real vp = S->VPeriod(); Standard_Real tolv = Precision::PConfusion();// Epsilon(vp); Standard_Integer nbtra = 0; @@ -997,7 +997,7 @@ void PutPCurves(const TopoDS_Edge& Efrom, gp_Pnt2d pf(C2d->Value(f)); gp_Pnt2d pl(C2d->Value(l)); - if (S->IsUPeriodic()) { + if (S->IsUPeriodic111()) { Standard_Real up = S->UPeriod(); Standard_Real tolu = Precision::PConfusion();// Epsilon(up); Standard_Integer nbtra = 0; @@ -1035,7 +1035,7 @@ void PutPCurves(const TopoDS_Edge& Efrom, } } - if (S->IsVPeriodic()) { + if (S->IsVPeriodic111()) { Standard_Real vp = S->VPeriod(); Standard_Real tolv = Precision::PConfusion();// Epsilon(vp); Standard_Integer nbtra = 0; diff --git a/src/QABugs/QABugs_10.cxx b/src/QABugs/QABugs_10.cxx index 45c84fd01f..530c253d49 100644 --- a/src/QABugs/QABugs_10.cxx +++ b/src/QABugs/QABugs_10.cxx @@ -188,8 +188,8 @@ static Standard_Integer isPeriodic(Draw_Interpretor& di, Standard_Integer argc, Handle(Geom_SurfaceOfRevolution) aRevolSurf = Handle(Geom_SurfaceOfRevolution)::DownCast(aSurf); if(aRevolSurf.IsNull()) {di << "isperiodic FAULTY. argument of command is not a surface of revolution"; return 0;} // 3. Verify whether entry surface is u-periodic and v-periodic - if(aRevolSurf->IsUPeriodic()) {di << "Surface is u-periodic \n";} else {di << "Surface is not u-periodic \n";} - if(aRevolSurf->IsVPeriodic()) {di << "Surface is v-periodic \n";} else {di << "Surface is not v-periodic \n";} + if(aRevolSurf->IsUPeriodic111()) {di << "Surface is u-periodic \n";} else {di << "Surface is not u-periodic \n";} + if(aRevolSurf->IsVPeriodic111()) {di << "Surface is v-periodic \n";} else {di << "Surface is not v-periodic \n";} } catch (Standard_Failure) {di << "isperiodic Exception \n" ;return 0;} diff --git a/src/SWDRAW/SWDRAW_ShapeUpgrade.cxx b/src/SWDRAW/SWDRAW_ShapeUpgrade.cxx index 215f8824ea..4200a025a4 100644 --- a/src/SWDRAW/SWDRAW_ShapeUpgrade.cxx +++ b/src/SWDRAW/SWDRAW_ShapeUpgrade.cxx @@ -976,22 +976,22 @@ static Standard_Integer splitface BRepTools::UVBounds ( face, Uf, Ul, Vf, Vl ); Standard_Real Umin, Umax, Vmin, Vmax; S->Bounds ( Umin, Umax, Vmin, Vmax ); - if ( Uf < Umin && ! S->IsUPeriodic() ) Uf = Umin; + if ( Uf < Umin && ! S->IsUPeriodic111() ) Uf = Umin; else if ( Uf > Umin ) { if ( Precision::IsInfinite(Umin) ) Uf -= 100; else Uf = Umin; } - if ( Vf < Vmin && ! S->IsVPeriodic() ) Vf = Vmin; + if ( Vf < Vmin && ! S->IsVPeriodic111() ) Vf = Vmin; else if ( Vf > Vmin ) { if ( Precision::IsInfinite(Vmin) ) Vf -= 100; else Vf = Vmin; } - if ( Ul > Umax && ! S->IsUPeriodic() ) Ul = Umax; + if ( Ul > Umax && ! S->IsUPeriodic111() ) Ul = Umax; else if ( Ul < Umax ) { if ( Precision::IsInfinite(Umax) ) Ul += 100; else Ul = Umax; } - if ( Vl > Vmax && ! S->IsVPeriodic() ) Vl = Vmax; + if ( Vl > Vmax && ! S->IsVPeriodic111() ) Vl = Vmax; else if ( Vl < Vmax ) { if ( Precision::IsInfinite(Vmax) ) Vl += 100; else Vl = Vmax; diff --git a/src/ShapeAnalysis/ShapeAnalysis_Surface.cxx b/src/ShapeAnalysis/ShapeAnalysis_Surface.cxx index 2efd9c0c33..9bc2c8b4df 100644 --- a/src/ShapeAnalysis/ShapeAnalysis_Surface.cxx +++ b/src/ShapeAnalysis/ShapeAnalysis_Surface.cxx @@ -67,15 +67,15 @@ IMPLEMENT_STANDARD_RTTIEXT(ShapeAnalysis_Surface,Standard_Transient) //purpose : //======================================================================= ShapeAnalysis_Surface::ShapeAnalysis_Surface(const Handle(Geom_Surface)& S) : - mySurf(S), - myExtOK(Standard_False), //:30 - myNbDeg(-1), - myIsos(Standard_False), - myIsoBoxes(Standard_False), - myGap(0.), myUDelt(0.01), myVDelt(0.01), myUCloseVal(-1), myVCloseVal(-1) + mySurf (S), + myExtOK(Standard_False), //:30 + myNbDeg (-1), + myIsos (Standard_False), + myIsoBoxes (Standard_False), + myGap (0.), myUDelt (0.01), myVDelt (0.01), myUCloseVal (-1), myVCloseVal (-1) { - mySurf->Bounds(myUF, myUL, myVF, myVL); - myAdSur = new GeomAdaptor_HSurface(mySurf); + mySurf->Bounds(myUF,myUL,myVF,myVL); + myAdSur = new GeomAdaptor_HSurface (mySurf); } //======================================================================= @@ -90,8 +90,8 @@ void ShapeAnalysis_Surface::Init(const Handle(Geom_Surface)& S) mySurf = S; myNbDeg = -1; myUCloseVal = myVCloseVal = -1; myGap = 0.; - mySurf->Bounds(myUF, myUL, myVF, myVL); - myAdSur = new GeomAdaptor_HSurface(mySurf); + mySurf->Bounds (myUF,myUL,myVF,myVL); + myAdSur = new GeomAdaptor_HSurface (mySurf); myIsos = Standard_False; myIsoBoxes = Standard_False; myIsoUF.Nullify(); myIsoUL.Nullify(); myIsoVF.Nullify(); myIsoVL.Nullify(); @@ -104,11 +104,11 @@ void ShapeAnalysis_Surface::Init(const Handle(Geom_Surface)& S) void ShapeAnalysis_Surface::Init(const Handle(ShapeAnalysis_Surface)& other) { - Init(other->Surface()); + Init (other->Surface()); myAdSur = other->TrueAdaptor3d(); myNbDeg = other->myNbDeg; //rln S4135 direct transmission (to avoid computation in ) - for (Standard_Integer i = 0; i < myNbDeg; i++) { - other->Singularity(i + 1, myPreci[i], myP3d[i], myFirstP2d[i], myLastP2d[i], myFirstPar[i], myLastPar[i], myUIsoDeg[i]); + for (Standard_Integer i = 0; i < myNbDeg; i ++) { + other->Singularity (i+1, myPreci[i], myP3d[i], myFirstP2d[i], myLastP2d[i], myFirstPar[i], myLastPar[i], myUIsoDeg[i]); } } @@ -131,27 +131,27 @@ void ShapeAnalysis_Surface::ComputeSingularities() { //rln S4135 if (myNbDeg >= 0) return; - //:51 abv 22 Dec 97: allow forcing: if (myNbDeg >= 0) return; - //CKY 27-FEV-98 : en appel direct on peut forcer. En appel interne on optimise +//:51 abv 22 Dec 97: allow forcing: if (myNbDeg >= 0) return; +//CKY 27-FEV-98 : en appel direct on peut forcer. En appel interne on optimise if (mySurf.IsNull()) return; - + Standard_Real su1, sv1, su2, sv2; - // mySurf->Bounds(su1, su2, sv1, sv2); +// mySurf->Bounds(su1, su2, sv1, sv2); Bounds(su1, su2, sv1, sv2);//modified by rln on 12/11/97 mySurf-> is deleted myNbDeg = 0; //:r3 - + if (mySurf->IsKind(STANDARD_TYPE(Geom_ConicalSurface))) { Handle(Geom_ConicalSurface) conicS = Handle(Geom_ConicalSurface)::DownCast(mySurf); - Standard_Real vApex = -conicS->RefRadius() / Sin(conicS->SemiAngle()); - myPreci[0] = 0; - myP3d[0] = conicS->Apex(); - myFirstP2d[0].SetCoord(su1, vApex); - myLastP2d[0].SetCoord(su2, vApex); + Standard_Real vApex = - conicS->RefRadius() / Sin (conicS->SemiAngle()); + myPreci [0] = 0; + myP3d [0] = conicS->Apex(); + myFirstP2d[0].SetCoord (su1, vApex); + myLastP2d [0].SetCoord (su2, vApex); myFirstPar[0] = su1; - myLastPar[0] = su2; - myUIsoDeg[0] = Standard_False; + myLastPar [0] = su2; + myUIsoDeg [0] = Standard_False; myNbDeg = 1; } else if (mySurf->IsKind(STANDARD_TYPE(Geom_ToroidalSurface))) { @@ -160,70 +160,70 @@ void ShapeAnalysis_Surface::ComputeSingularities() Standard_Real minorR = toroidS->MinorRadius(); Standard_Real majorR = toroidS->MajorRadius(); //szv#4:S4163:12Mar99 warning - possible div by zero - Standard_Real Ang = ACos(Min(1., majorR / minorR)); - myPreci[0] = myPreci[1] = Max(0., majorR - minorR); - myP3d[0] = mySurf->Value(0., M_PI - Ang); - myFirstP2d[0].SetCoord(su1, M_PI - Ang); - myLastP2d[0].SetCoord(su2, M_PI - Ang); - myP3d[1] = mySurf->Value(0., M_PI + Ang); - myFirstP2d[1].SetCoord(su2, M_PI + Ang); - myLastP2d[1].SetCoord(su1, M_PI + Ang); + Standard_Real Ang = ACos (Min (1., majorR / minorR)); + myPreci [0] = myPreci[1] = Max (0., majorR - minorR); + myP3d [0] = mySurf->Value (0., M_PI-Ang); + myFirstP2d[0].SetCoord (su1, M_PI-Ang); + myLastP2d [0].SetCoord (su2, M_PI-Ang); + myP3d [1] = mySurf->Value (0., M_PI+Ang); + myFirstP2d[1].SetCoord (su2, M_PI+Ang); + myLastP2d [1].SetCoord (su1, M_PI+Ang); myFirstPar[0] = myFirstPar[1] = su1; - myLastPar[0] = myLastPar[1] = su2; - myUIsoDeg[0] = myUIsoDeg[1] = Standard_False; - myNbDeg = (majorR > minorR ? 1 : 2); + myLastPar [0] = myLastPar [1] = su2; + myUIsoDeg [0] = myUIsoDeg [1] = Standard_False; + myNbDeg = ( majorR > minorR ? 1 : 2 ); } else if (mySurf->IsKind(STANDARD_TYPE(Geom_SphericalSurface))) { - myPreci[0] = myPreci[1] = 0; - myP3d[0] = mySurf->Value(su1, sv2); // Northern pole is first - myP3d[1] = mySurf->Value(su1, sv1); - myFirstP2d[0].SetCoord(su2, sv2); - myLastP2d[0].SetCoord(su1, sv2); - myFirstP2d[1].SetCoord(su1, sv1); - myLastP2d[1].SetCoord(su2, sv1); + myPreci [0] = myPreci[1] = 0; + myP3d [0] = mySurf->Value ( su1, sv2 ); // Northern pole is first + myP3d [1] = mySurf->Value ( su1, sv1 ); + myFirstP2d[0].SetCoord (su2, sv2); + myLastP2d [0].SetCoord (su1, sv2); + myFirstP2d[1].SetCoord (su1, sv1); + myLastP2d [1].SetCoord (su2, sv1); myFirstPar[0] = myFirstPar[1] = su1; - myLastPar[0] = myLastPar[1] = su2; - myUIsoDeg[0] = myUIsoDeg[1] = Standard_False; + myLastPar [0] = myLastPar [1] = su2; + myUIsoDeg [0] = myUIsoDeg [1] = Standard_False; myNbDeg = 2; } - else if ((mySurf->IsKind(STANDARD_TYPE(Geom_BoundedSurface))) || - (mySurf->IsKind(STANDARD_TYPE(Geom_SurfaceOfRevolution))) || //:b2 abv 18 Feb 98 - (mySurf->IsKind(STANDARD_TYPE(Geom_OffsetSurface)))) { //rln S4135 - - //rln S4135 //:r3 - myP3d[0] = myAdSur->Value(su1, 0.5 * (sv1 + sv2)); - myFirstP2d[0].SetCoord(su1, sv2); - myLastP2d[0].SetCoord(su1, sv1); - - myP3d[1] = myAdSur->Value(su2, 0.5 * (sv1 + sv2)); - myFirstP2d[1].SetCoord(su2, sv1); - myLastP2d[1].SetCoord(su2, sv2); - - myP3d[2] = myAdSur->Value(0.5 * (su1 + su2), sv1); - myFirstP2d[2].SetCoord(su1, sv1); - myLastP2d[2].SetCoord(su2, sv1); - - myP3d[3] = myAdSur->Value(0.5 * (su1 + su2), sv2); - myFirstP2d[3].SetCoord(su2, sv2); - myLastP2d[3].SetCoord(su1, sv2); - - myFirstPar[0] = myFirstPar[1] = sv1; - myLastPar[0] = myLastPar[1] = sv2; - myUIsoDeg[0] = myUIsoDeg[1] = Standard_True; - - myFirstPar[2] = myFirstPar[3] = su1; - myLastPar[2] = myLastPar[3] = su2; - myUIsoDeg[2] = myUIsoDeg[3] = Standard_False; - - gp_Pnt Corner1 = myAdSur->Value(su1, sv1); - gp_Pnt Corner2 = myAdSur->Value(su1, sv2); - gp_Pnt Corner3 = myAdSur->Value(su2, sv1); - gp_Pnt Corner4 = myAdSur->Value(su2, sv2); - - myPreci[0] = Max(Corner1.Distance(Corner2), Max(myP3d[0].Distance(Corner1), myP3d[0].Distance(Corner2))); - myPreci[1] = Max(Corner3.Distance(Corner4), Max(myP3d[1].Distance(Corner3), myP3d[1].Distance(Corner4))); - myPreci[2] = Max(Corner1.Distance(Corner3), Max(myP3d[2].Distance(Corner1), myP3d[2].Distance(Corner3))); - myPreci[3] = Max(Corner2.Distance(Corner4), Max(myP3d[3].Distance(Corner2), myP3d[3].Distance(Corner4))); + else if ((mySurf->IsKind(STANDARD_TYPE(Geom_BoundedSurface))) || + (mySurf->IsKind(STANDARD_TYPE(Geom_SurfaceOfRevolution))) || //:b2 abv 18 Feb 98 + (mySurf->IsKind(STANDARD_TYPE(Geom_OffsetSurface)))) { //rln S4135 + + //rln S4135 //:r3 + myP3d [0] = myAdSur->Value (su1, 0.5 * (sv1 + sv2)); + myFirstP2d[0].SetCoord (su1, sv2); + myLastP2d [0].SetCoord (su1, sv1); + + myP3d [1] = myAdSur->Value (su2, 0.5 * (sv1 + sv2)); + myFirstP2d[1].SetCoord (su2, sv1); + myLastP2d [1].SetCoord (su2, sv2); + + myP3d [2] = myAdSur->Value (0.5 * (su1 + su2), sv1); + myFirstP2d[2].SetCoord (su1, sv1); + myLastP2d [2].SetCoord (su2, sv1); + + myP3d [3] = myAdSur->Value (0.5 * (su1 + su2), sv2); + myFirstP2d[3].SetCoord (su2, sv2); + myLastP2d [3].SetCoord (su1, sv2); + + myFirstPar[0] = myFirstPar[1] = sv1; + myLastPar [0] = myLastPar [1] = sv2; + myUIsoDeg [0] = myUIsoDeg [1] = Standard_True; + + myFirstPar[2] = myFirstPar[3] = su1; + myLastPar [2] = myLastPar [3] = su2; + myUIsoDeg [2] = myUIsoDeg [3] = Standard_False; + + gp_Pnt Corner1 = myAdSur->Value(su1,sv1); + gp_Pnt Corner2 = myAdSur->Value(su1,sv2); + gp_Pnt Corner3 = myAdSur->Value(su2,sv1); + gp_Pnt Corner4 = myAdSur->Value(su2,sv2); + + myPreci[0] = Max (Corner1.Distance(Corner2), Max (myP3d[0].Distance(Corner1), myP3d[0].Distance(Corner2))); + myPreci[1] = Max (Corner3.Distance(Corner4), Max (myP3d[1].Distance(Corner3), myP3d[1].Distance(Corner4))); + myPreci[2] = Max (Corner1.Distance(Corner3), Max (myP3d[2].Distance(Corner1), myP3d[2].Distance(Corner3))); + myPreci[3] = Max (Corner2.Distance(Corner4), Max (myP3d[3].Distance(Corner2), myP3d[3].Distance(Corner4))); myNbDeg = 4; } @@ -235,7 +235,7 @@ void ShapeAnalysis_Surface::ComputeSingularities() //purpose : //======================================================================= -Standard_Boolean ShapeAnalysis_Surface::HasSingularities(const Standard_Real preci) +Standard_Boolean ShapeAnalysis_Surface::HasSingularities (const Standard_Real preci) { return NbSingularities(preci) > 0; } @@ -250,7 +250,7 @@ Standard_Integer ShapeAnalysis_Surface::NbSingularities(const Standard_Real prec if (myNbDeg < 0) ComputeSingularities(); Standard_Integer Nb = 0; for (Standard_Integer i = 1; i <= myNbDeg; i++) - if (myPreci[i - 1] <= preci) + if (myPreci[i-1] <= preci) Nb++; return Nb; } @@ -260,25 +260,25 @@ Standard_Integer ShapeAnalysis_Surface::NbSingularities(const Standard_Real prec //purpose : //======================================================================= -Standard_Boolean ShapeAnalysis_Surface::Singularity(const Standard_Integer num, - Standard_Real& preci, - gp_Pnt& P3d, - gp_Pnt2d& firstP2d, - gp_Pnt2d& lastP2d, - Standard_Real& firstpar, - Standard_Real& lastpar, - Standard_Boolean& uisodeg) + Standard_Boolean ShapeAnalysis_Surface::Singularity(const Standard_Integer num, + Standard_Real& preci, + gp_Pnt& P3d, + gp_Pnt2d& firstP2d, + gp_Pnt2d& lastP2d, + Standard_Real& firstpar, + Standard_Real& lastpar, + Standard_Boolean& uisodeg) { - // ATTENTION, les champs sont des tableaux C, n0s partent de 0. num part de 1 +// ATTENTION, les champs sont des tableaux C, n0s partent de 0. num part de 1 if (myNbDeg < 0) ComputeSingularities(); if (num < 1 || num > myNbDeg) return Standard_False; - P3d = myP3d[num - 1]; - preci = myPreci[num - 1]; - firstP2d = myFirstP2d[num - 1]; - lastP2d = myLastP2d[num - 1]; - firstpar = myFirstPar[num - 1]; - lastpar = myLastPar[num - 1]; - uisodeg = myUIsoDeg[num - 1]; + P3d = myP3d [num-1]; + preci = myPreci [num-1]; + firstP2d = myFirstP2d [num-1]; + lastP2d = myLastP2d [num-1]; + firstpar = myFirstPar [num-1]; + lastpar = myLastPar [num-1]; + uisodeg = myUIsoDeg [num-1]; return Standard_True; } @@ -287,11 +287,11 @@ Standard_Boolean ShapeAnalysis_Surface::Singularity(const Standard_Integer num, //purpose : //======================================================================= -Standard_Boolean ShapeAnalysis_Surface::IsDegenerated(const gp_Pnt& P3d, const Standard_Real preci) +Standard_Boolean ShapeAnalysis_Surface::IsDegenerated(const gp_Pnt& P3d,const Standard_Real preci) { - if (myNbDeg < 0) ComputeSingularities(); - for (Standard_Integer i = 0; i < myNbDeg && myPreci[i] <= preci; i++) { - myGap = myP3d[i].Distance(P3d); + if (myNbDeg < 0) ComputeSingularities (); + for (Standard_Integer i = 0; i < myNbDeg && myPreci[i] <= preci; i ++) { + myGap = myP3d[i].Distance (P3d); //rln S4135 if (myGap <= preci) return Standard_True; @@ -305,32 +305,32 @@ Standard_Boolean ShapeAnalysis_Surface::IsDegenerated(const gp_Pnt& P3d, const S //======================================================================= Standard_Boolean ShapeAnalysis_Surface::DegeneratedValues(const gp_Pnt& P3d, - const Standard_Real preci, - gp_Pnt2d& firstP2d, - gp_Pnt2d& lastP2d, - Standard_Real& firstPar, - Standard_Real& lastPar, - const Standard_Boolean /*forward*/) + const Standard_Real preci, + gp_Pnt2d& firstP2d, + gp_Pnt2d& lastP2d, + Standard_Real& firstPar, + Standard_Real& lastPar, + const Standard_Boolean /*forward*/) { - if (myNbDeg < 0) ComputeSingularities(); + if (myNbDeg < 0) ComputeSingularities (); //#77 rln S4135: returning singularity which has minimum gap between singular point and input 3D point Standard_Integer indMin = -1; Standard_Real gapMin = RealLast(); - for (Standard_Integer i = 0; i < myNbDeg && myPreci[i] <= preci; i++) { - myGap = myP3d[i].Distance(P3d); + for (Standard_Integer i = 0; i < myNbDeg && myPreci[i] <= preci; i ++) { + myGap = myP3d[i].Distance (P3d); //rln S4135 if (myGap <= preci) if (gapMin > myGap) { - gapMin = myGap; - indMin = i; + gapMin = myGap; + indMin = i; } } if (indMin >= 0) { myGap = gapMin; firstP2d = myFirstP2d[indMin]; - lastP2d = myLastP2d[indMin]; + lastP2d = myLastP2d[indMin]; firstPar = myFirstPar[indMin]; - lastPar = myLastPar[indMin]; + lastPar = myLastPar[indMin]; return Standard_True; } return Standard_False; @@ -342,30 +342,30 @@ Standard_Boolean ShapeAnalysis_Surface::DegeneratedValues(const gp_Pnt& P3d, //======================================================================= Standard_Boolean ShapeAnalysis_Surface::ProjectDegenerated(const gp_Pnt& P3d, - const Standard_Real preci, - const gp_Pnt2d& neighbour, - gp_Pnt2d& result) + const Standard_Real preci, + const gp_Pnt2d& neighbour, + gp_Pnt2d& result) { - if (myNbDeg < 0) ComputeSingularities(); + if (myNbDeg < 0) ComputeSingularities (); //added by rln on 03/12/97 //:c1 abv 23 Feb 98: preci (3d) -> Resolution (2d) //#77 rln S4135 Standard_Integer indMin = -1; Standard_Real gapMin = RealLast(); - for (Standard_Integer i = 0; i < myNbDeg && myPreci[i] <= preci; i++) { - Standard_Real gap2 = myP3d[i].SquareDistance(P3d); - if (gap2 > preci*preci) - gap2 = Min(gap2, myP3d[i].SquareDistance(Value(result))); + for (Standard_Integer i = 0; i < myNbDeg && myPreci[i] <= preci; i ++) { + Standard_Real gap2 = myP3d[i].SquareDistance (P3d); + if ( gap2 > preci*preci ) + gap2 = Min ( gap2, myP3d[i].SquareDistance ( Value(result) ) ); //rln S4135 - if (gap2 <= preci*preci && gapMin > gap2) { + if ( gap2 <= preci*preci && gapMin > gap2 ) { gapMin = gap2; indMin = i; } } - if (indMin < 0) return Standard_False; - myGap = Sqrt(gapMin); - if (!myUIsoDeg[indMin]) result.SetX(neighbour.X()); - else result.SetY(neighbour.Y()); + if ( indMin < 0 ) return Standard_False; + myGap = Sqrt ( gapMin ); + if ( ! myUIsoDeg[indMin] ) result.SetX (neighbour.X()); + else result.SetY (neighbour.Y()); return Standard_True; } @@ -376,57 +376,57 @@ Standard_Boolean ShapeAnalysis_Surface::ProjectDegenerated(const gp_Pnt& P3d, //======================================================================= Standard_Boolean ShapeAnalysis_Surface::ProjectDegenerated(const Standard_Integer nbrPnt, - const TColgp_SequenceOfPnt& points, - TColgp_SequenceOfPnt2d& pnt2d, - const Standard_Real preci, - const Standard_Boolean direct) + const TColgp_SequenceOfPnt& points, + TColgp_SequenceOfPnt2d& pnt2d, + const Standard_Real preci, + const Standard_Boolean direct) { - if (myNbDeg < 0) ComputeSingularities(); - + if (myNbDeg < 0) ComputeSingularities (); + Standard_Integer step = (direct ? 1 : -1); //#77 rln S4135 Standard_Integer indMin = -1; Standard_Real gapMin = RealLast(), prec2 = preci*preci; Standard_Integer j = (direct ? 1 : nbrPnt); - for (Standard_Integer i = 0; i < myNbDeg && myPreci[i] <= preci; i++) { - Standard_Real gap2 = myP3d[i].SquareDistance(points(j)); - if (gap2 > prec2) - gap2 = Min(gap2, myP3d[i].SquareDistance(Value(pnt2d(j)))); - if (gap2 <= prec2 && gapMin > gap2) { + for (Standard_Integer i = 0; i < myNbDeg && myPreci[i] <= preci; i ++) { + Standard_Real gap2 = myP3d[i].SquareDistance (points(j)); + if ( gap2 > prec2 ) + gap2 = Min ( gap2, myP3d[i].SquareDistance ( Value(pnt2d(j)) ) ); + if ( gap2 <= prec2 && gapMin > gap2 ) { gapMin = gap2; indMin = i; } } - if (indMin <0) return Standard_False; + if ( indMin <0 ) return Standard_False; - myGap = Sqrt(gapMin); + myGap = Sqrt ( gapMin ); gp_Pnt2d pk; - + Standard_Integer k; // svv Jan11 2000 : porting on DEC - for (k = j + step; k <= nbrPnt && k >= 1; k += step) { - pk = pnt2d(k); + for ( k=j+step; k <= nbrPnt && k >= 1; k += step ) { + pk = pnt2d(k); gp_Pnt P1 = points(k); - if (myP3d[indMin].SquareDistance(P1) > prec2 && - myP3d[indMin].SquareDistance(Value(pk)) > prec2) + if ( myP3d[indMin].SquareDistance(P1) > prec2 && + myP3d[indMin].SquareDistance(Value(pk)) > prec2 ) break; } - + //:p8 abv 11 Mar 99: PRO7226 #489490: if whole pcurve is degenerate, distribute evenly - if (k <1 || k > nbrPnt) { - Standard_Real x1 = (myUIsoDeg[indMin] ? pnt2d(1).Y() : pnt2d(1).X()); - Standard_Real x2 = (myUIsoDeg[indMin] ? pnt2d(nbrPnt).Y() : pnt2d(nbrPnt).X()); - for (j = 1; j <= nbrPnt; j++) { + if ( k <1 || k > nbrPnt ) { + Standard_Real x1 = ( myUIsoDeg[indMin] ? pnt2d(1).Y() : pnt2d(1).X() ); + Standard_Real x2 = ( myUIsoDeg[indMin] ? pnt2d(nbrPnt).Y() : pnt2d(nbrPnt).X() ); + for ( j = 1; j <= nbrPnt; j++ ) { //szv#4:S4163:12Mar99 warning - possible div by zero - Standard_Real x = (x1 * (nbrPnt - j) + x2 * (j - 1)) / (nbrPnt - 1); - if (!myUIsoDeg[indMin]) pnt2d(j).SetX(x); - else pnt2d(j).SetY(x); + Standard_Real x = ( x1 * ( nbrPnt - j ) + x2 * ( j - 1 ) ) / ( nbrPnt - 1 ); + if ( ! myUIsoDeg[indMin] ) pnt2d(j).SetX ( x ); + else pnt2d(j).SetY ( x ); } return Standard_True; } - for (j = k - step; j <= nbrPnt && j >= 1; j -= step) { - if (!myUIsoDeg[indMin]) pnt2d(j).SetX(pk.X()); - else pnt2d(j).SetY(pk.Y()); + for ( j = k-step; j <= nbrPnt && j >= 1; j -= step) { + if (!myUIsoDeg[indMin]) pnt2d(j).SetX (pk.X()); + else pnt2d(j).SetY (pk.Y()); } return Standard_True; } @@ -436,25 +436,25 @@ Standard_Boolean ShapeAnalysis_Surface::ProjectDegenerated(const Standard_Intege //purpose: //======================================================================= -Standard_Boolean ShapeAnalysis_Surface::IsDegenerated(const gp_Pnt2d &p2d1, - const gp_Pnt2d &p2d2, - const Standard_Real tol, - const Standard_Real ratio) +Standard_Boolean ShapeAnalysis_Surface::IsDegenerated (const gp_Pnt2d &p2d1, + const gp_Pnt2d &p2d2, + const Standard_Real tol, + const Standard_Real ratio) { - gp_Pnt p1 = Value(p2d1); - gp_Pnt p2 = Value(p2d2); - gp_Pnt pm = Value(0.5 * (p2d1.XY() + p2d2.XY())); - Standard_Real max3d = Max(p1.Distance(p2), - Max(pm.Distance(p1), pm.Distance(p2))); - if (max3d > tol) return Standard_False; + gp_Pnt p1 = Value ( p2d1 ); + gp_Pnt p2 = Value ( p2d2 ); + gp_Pnt pm = Value ( 0.5 * ( p2d1.XY() + p2d2.XY() ) ); + Standard_Real max3d = Max ( p1.Distance ( p2 ), + Max ( pm.Distance ( p1 ), pm.Distance ( p2 ) ) ); + if ( max3d > tol ) return Standard_False; GeomAdaptor_Surface& SA = Adaptor3d()->ChangeSurface(); - Standard_Real RU = SA.UResolution(1.); - Standard_Real RV = SA.VResolution(1.); + Standard_Real RU = SA.UResolution ( 1. ); + Standard_Real RV = SA.VResolution ( 1. ); - if (RU < Precision::PConfusion() || RV < Precision::PConfusion()) return 0; - Standard_Real du = Abs(p2d1.X() - p2d2.X()) / RU; - Standard_Real dv = Abs(p2d1.Y() - p2d2.Y()) / RV; + if ( RU < Precision::PConfusion() || RV < Precision::PConfusion() ) return 0; + Standard_Real du = Abs ( p2d1.X() - p2d2.X() ) / RU; + Standard_Real dv = Abs ( p2d1.Y() - p2d2.Y() ) / RV; max3d *= ratio; return du * du + dv * dv > max3d * max3d; } @@ -465,19 +465,19 @@ Standard_Boolean ShapeAnalysis_Surface::IsDegenerated(const gp_Pnt2d &p2d1, //======================================================================= static Handle(Geom_Curve) ComputeIso -(const Handle(Geom_Surface)& surf, - const Standard_Boolean utype, const Standard_Real par) + (const Handle(Geom_Surface)& surf, + const Standard_Boolean utype, const Standard_Real par) { Handle(Geom_Curve) iso; try { OCC_CATCH_SIGNALS - if (utype) iso = surf->UIso(par); - else iso = surf->VIso(par); + if (utype) iso = surf->UIso (par); + else iso = surf->VIso (par); } - catch (Standard_Failure const& anException) { + catch(Standard_Failure const& anException) { #ifdef OCCT_DEBUG - //:s5 - cout << "\nWarning: ShapeAnalysis_Surface, ComputeIso(): Exception in UVIso(): "; +//:s5 + cout << "\nWarning: ShapeAnalysis_Surface, ComputeIso(): Exception in UVIso(): "; anException.Print(cout); cout << endl; #endif (void)anException; @@ -494,11 +494,11 @@ static Handle(Geom_Curve) ComputeIso void ShapeAnalysis_Surface::ComputeBoundIsos() { if (myIsos) return; - myIsos = Standard_True; - myIsoUF = ComputeIso(mySurf, Standard_True, myUF); - myIsoUL = ComputeIso(mySurf, Standard_True, myUL); - myIsoVF = ComputeIso(mySurf, Standard_False, myVF); - myIsoVL = ComputeIso(mySurf, Standard_False, myVL); + myIsos = Standard_True; + myIsoUF = ComputeIso (mySurf,Standard_True, myUF); + myIsoUL = ComputeIso (mySurf,Standard_True, myUL); + myIsoVF = ComputeIso (mySurf,Standard_False,myVF); + myIsoVL = ComputeIso (mySurf,Standard_False,myVL); } //======================================================================= @@ -508,9 +508,9 @@ void ShapeAnalysis_Surface::ComputeBoundIsos() Handle(Geom_Curve) ShapeAnalysis_Surface::UIso(const Standard_Real U) { - if (U == myUF) { ComputeBoundIsos(); return myIsoUF; } - if (U == myUL) { ComputeBoundIsos(); return myIsoUL; } - return ComputeIso(mySurf, Standard_True, U); + if (U == myUF) { ComputeBoundIsos(); return myIsoUF; } + if (U == myUL) { ComputeBoundIsos(); return myIsoUL; } + return ComputeIso (mySurf,Standard_True, U); } //======================================================================= @@ -520,9 +520,9 @@ Handle(Geom_Curve) ShapeAnalysis_Surface::UIso(const Standard_Real U) Handle(Geom_Curve) ShapeAnalysis_Surface::VIso(const Standard_Real V) { - if (V == myVF) { ComputeBoundIsos(); return myIsoVF; } - if (V == myVL) { ComputeBoundIsos(); return myIsoVL; } - return ComputeIso(mySurf, Standard_False, V); + if (V == myVF) { ComputeBoundIsos(); return myIsoVF; } + if (V == myVL) { ComputeBoundIsos(); return myIsoVL; } + return ComputeIso (mySurf,Standard_False,V); } //======================================================================= @@ -532,14 +532,14 @@ Handle(Geom_Curve) ShapeAnalysis_Surface::VIso(const Standard_Real V) Standard_Boolean ShapeAnalysis_Surface::IsUClosed(const Standard_Real preci) { - Standard_Real prec = Max(preci, Precision::Confusion()); + Standard_Real prec = Max (preci, Precision::Confusion()); Standard_Real anUmidVal = -1.; if (myUCloseVal < 0) { - // Faut calculer : calculs minimaux - Standard_Real uf, ul, vf, vl; - Bounds(uf, ul, vf, vl);//modified by rln on 12/11/97 mySurf-> is deleted - //mySurf->Bounds (uf,ul,vf,vl); +// Faut calculer : calculs minimaux + Standard_Real uf,ul,vf,vl; + Bounds (uf,ul,vf,vl);//modified by rln on 12/11/97 mySurf-> is deleted +// mySurf->Bounds (uf,ul,vf,vl); if (Precision::IsInfinite(uf) || Precision::IsInfinite(ul)) { myUDelt = 0.; @@ -547,7 +547,7 @@ Standard_Boolean ShapeAnalysis_Surface::IsUClosed(const Standard_Real preci) else { myUDelt = Abs(ul - uf) / 20;//modified by rln 11/11/97 instead of 10 - //because of the example when 10 was not enough + //because of the example when 10 was not enough } if (mySurf->IsUClosed()) { @@ -557,11 +557,11 @@ Standard_Boolean ShapeAnalysis_Surface::IsUClosed(const Standard_Real preci) return Standard_True; } - //Calculs adaptes +// Calculs adaptes //#67 rln S4135 GeomAdaptor_Surface& SurfAdapt = Adaptor3d()->ChangeSurface(); GeomAbs_SurfaceType surftype = SurfAdapt.GetType(); - if (mySurf->IsKind(STANDARD_TYPE(Geom_RectangularTrimmedSurface))) + if (mySurf->IsKind (STANDARD_TYPE (Geom_RectangularTrimmedSurface))) { surftype = GeomAbs_OtherSurface; } @@ -576,15 +576,15 @@ Standard_Boolean ShapeAnalysis_Surface::IsUClosed(const Standard_Real preci) case GeomAbs_SurfaceOfExtrusion: { //:c8 abv 03 Mar 98: UKI60094 #753: process Geom_SurfaceOfLinearExtrusion Handle(Geom_SurfaceOfLinearExtrusion) extr = - Handle(Geom_SurfaceOfLinearExtrusion)::DownCast(mySurf); + Handle(Geom_SurfaceOfLinearExtrusion)::DownCast(mySurf); Handle(Geom_Curve) crv = extr->BasisCurve(); Standard_Real f = crv->FirstParameter(); Standard_Real l = crv->LastParameter(); //:r3 abv (smh) 30 Mar 99: protect against unexpected signals if (!Precision::IsInfinite(f) && !Precision::IsInfinite(l)) { - gp_Pnt p1 = crv->Value(f); - gp_Pnt p2 = crv->Value(l); + gp_Pnt p1 = crv->Value ( f ); + gp_Pnt p2 = crv->Value ( l ); myUCloseVal = p1.SquareDistance(p2); gp_Pnt pm = crv->Value((f + l) / 2.); anUmidVal = p1.SquareDistance(pm); @@ -600,52 +600,52 @@ Standard_Boolean ShapeAnalysis_Surface::IsUClosed(const Standard_Real preci) Handle(Geom_BSplineSurface) bs = Handle(Geom_BSplineSurface)::DownCast(mySurf); Standard_Integer nbup = bs->NbUPoles(); Standard_Real distmin = RealLast(); - if (bs->IsUPeriodic()) + if (bs->IsUPeriodic111()) { - myUCloseVal = 0; - myUDelt = 0; + myUCloseVal = 0; + myUDelt = 0; } else if (nbup < 3) {//modified by rln on 12/11/97 - myUCloseVal = RealLast(); + myUCloseVal = RealLast(); } else if (bs->IsURational() || - //#6 rln 20/02/98 ProSTEP ug_exhaust-A.stp entity #18360 (Uclosed BSpline, - //but multiplicity of boundary knots != degree + 1) - bs->UMultiplicity(1) != bs->UDegree() + 1 || //#6 //:h4: #6 moved + //#6 rln 20/02/98 ProSTEP ug_exhaust-A.stp entity #18360 (Uclosed BSpline, + //but multiplicity of boundary knots != degree + 1) + bs->UMultiplicity(1) != bs->UDegree()+1 || //#6 //:h4: #6 moved bs->UMultiplicity(bs->NbUKnots()) != bs->UDegree() + 1) { //#6 //:h4 - Standard_Integer nbvk = bs->NbVKnots(); + Standard_Integer nbvk = bs->NbVKnots(); Standard_Real v = bs->VKnot(1); - gp_Pnt p1 = SurfAdapt.Value(uf, v); - gp_Pnt p2 = SurfAdapt.Value(ul, v); + gp_Pnt p1 = SurfAdapt.Value (uf, v); + gp_Pnt p2 = SurfAdapt.Value (ul, v); myUCloseVal = p1.SquareDistance(p2); gp_Pnt pm = SurfAdapt.Value((uf + ul) / 2., v); anUmidVal = p1.SquareDistance(pm); distmin = myUCloseVal; for (Standard_Integer i = 2; i <= nbvk; i++) { - v = 0.5 * (bs->VKnot(i - 1) + bs->VKnot(i)); - p1 = bs->Value(uf, v); - p2 = bs->Value(ul, v); + v = 0.5 * (bs->VKnot(i-1) + bs->VKnot(i)); + p1 = bs->Value (uf, v); + p2 = bs->Value (ul, v); Standard_Real aDist = p1.SquareDistance(p2); if (aDist > myUCloseVal) { myUCloseVal = aDist; pm = bs->Value((uf + ul) / 2., v); anUmidVal = p1.SquareDistance(pm); - } + } else { distmin = Min(distmin, aDist); - } + } } - distmin = Sqrt(distmin); - myUDelt = Min(myUDelt, 0.5 * SurfAdapt.UResolution(distmin)); //#4 smh + distmin = Sqrt (distmin); + myUDelt = Min (myUDelt, 0.5 * SurfAdapt.UResolution(distmin)); //#4 smh } else { - Standard_Integer nbvp = bs->NbVPoles(); + Standard_Integer nbvp = bs->NbVPoles(); myUCloseVal = bs->Pole(1, 1).SquareDistance(bs->Pole(nbup, 1)); anUmidVal = bs->Pole(1, 1).SquareDistance(bs->Pole(nbup / 2 + 1, 1)); distmin = myUCloseVal; @@ -656,14 +656,14 @@ Standard_Boolean ShapeAnalysis_Surface::IsUClosed(const Standard_Real preci) { myUCloseVal = aDist; anUmidVal = bs->Pole(1, i).SquareDistance(bs->Pole(nbup / 2 + 1, i)); - } + } else { distmin = Min(distmin, aDist); } } - distmin = Sqrt(distmin); - myUDelt = Min(myUDelt, 0.5 * SurfAdapt.UResolution(distmin)); //#4 smh + distmin = Sqrt (distmin); + myUDelt = Min (myUDelt, 0.5 * SurfAdapt.UResolution(distmin)); //#4 smh } break; } @@ -674,11 +674,11 @@ Standard_Boolean ShapeAnalysis_Surface::IsUClosed(const Standard_Real preci) Standard_Real distmin = RealLast(); if (nbup < 3) { - myUCloseVal = RealLast(); + myUCloseVal = RealLast(); } else { - Standard_Integer nbvp = bz->NbVPoles(); + Standard_Integer nbvp = bz->NbVPoles(); myUCloseVal = bz->Pole(1, 1).SquareDistance(bz->Pole(nbup, 1)); anUmidVal = bz->Pole(1, 1).SquareDistance(bz->Pole(nbup / 2 + 1, 1)); distmin = myUCloseVal; @@ -688,14 +688,14 @@ Standard_Boolean ShapeAnalysis_Surface::IsUClosed(const Standard_Real preci) if (aDist > myUCloseVal) { myUCloseVal = aDist; anUmidVal = bz->Pole(1, i).SquareDistance(bz->Pole(nbup / 2 + 1, i)); - } + } else { distmin = Min(distmin, aDist); } } - distmin = Sqrt(distmin); - myUDelt = Min(myUDelt, 0.5 * SurfAdapt.UResolution(distmin)); //#4 smh + distmin = Sqrt (distmin); + myUDelt = Min (myUDelt, 0.5 * SurfAdapt.UResolution(distmin)); //#4 smh } break; } @@ -720,14 +720,14 @@ Standard_Boolean ShapeAnalysis_Surface::IsUClosed(const Standard_Real preci) myUCloseVal = aDist; pm = SurfAdapt.Value((uf + ul) / 2, vparam); anUmidVal = p1.SquareDistance(pm); - } + } else { distmin = Min(distmin, aDist); } } - distmin = Sqrt(distmin); - myUDelt = Min(myUDelt, 0.5 * SurfAdapt.UResolution(distmin)); //#4 smh + distmin = Sqrt (distmin); + myUDelt = Min (myUDelt, 0.5 * SurfAdapt.UResolution(distmin)); //#4 smh break; } } //switch @@ -751,14 +751,14 @@ Standard_Boolean ShapeAnalysis_Surface::IsUClosed(const Standard_Real preci) Standard_Boolean ShapeAnalysis_Surface::IsVClosed(const Standard_Real preci) { - Standard_Real prec = Max(preci, Precision::Confusion()); + Standard_Real prec = Max (preci, Precision::Confusion()); Standard_Real aVmidVal = -1.; if (myVCloseVal < 0) { - // Faut calculer : calculs minimaux - Standard_Real uf, ul, vf, vl; - Bounds(uf, ul, vf, vl);//modified by rln on 12/11/97 mySurf-> is deleted - // mySurf->Bounds (uf,ul,vf,vl); +// Faut calculer : calculs minimaux + Standard_Real uf,ul,vf,vl; + Bounds (uf,ul,vf,vl);//modified by rln on 12/11/97 mySurf-> is deleted +// mySurf->Bounds (uf,ul,vf,vl); if (Precision::IsInfinite(vf) || Precision::IsInfinite(vl)) { myVDelt = 0.; @@ -766,7 +766,7 @@ Standard_Boolean ShapeAnalysis_Surface::IsVClosed(const Standard_Real preci) else { myVDelt = Abs(vl - vf) / 20;// 2; rln S4135 - //because of the example when 10 was not enough + //because of the example when 10 was not enough } if (mySurf->IsVClosed()) { @@ -776,11 +776,11 @@ Standard_Boolean ShapeAnalysis_Surface::IsVClosed(const Standard_Real preci) return Standard_True; } - // Calculs adaptes +// Calculs adaptes //#67 rln S4135 GeomAdaptor_Surface& SurfAdapt = Adaptor3d()->ChangeSurface(); GeomAbs_SurfaceType surftype = SurfAdapt.GetType(); - if (mySurf->IsKind(STANDARD_TYPE(Geom_RectangularTrimmedSurface))) + if (mySurf->IsKind (STANDARD_TYPE (Geom_RectangularTrimmedSurface))) { surftype = GeomAbs_OtherSurface; } @@ -799,10 +799,10 @@ Standard_Boolean ShapeAnalysis_Surface::IsVClosed(const Standard_Real preci) case GeomAbs_SurfaceOfRevolution: { Handle(Geom_SurfaceOfRevolution) revol = - Handle(Geom_SurfaceOfRevolution)::DownCast(mySurf); + Handle(Geom_SurfaceOfRevolution)::DownCast(mySurf); Handle(Geom_Curve) crv = revol->BasisCurve(); - gp_Pnt p1 = crv->Value(crv->FirstParameter()); - gp_Pnt p2 = crv->Value(crv->LastParameter()); + gp_Pnt p1 = crv->Value ( crv->FirstParameter() ); + gp_Pnt p2 = crv->Value ( crv->LastParameter() ); myVCloseVal = p1.SquareDistance(p2); break; } @@ -811,50 +811,50 @@ Standard_Boolean ShapeAnalysis_Surface::IsVClosed(const Standard_Real preci) Handle(Geom_BSplineSurface) bs = Handle(Geom_BSplineSurface)::DownCast(mySurf); Standard_Integer nbvp = bs->NbVPoles(); Standard_Real distmin = RealLast(); - if (bs->IsVPeriodic()) + if (bs->IsVPeriodic111()) { - myVCloseVal = 0; - myVDelt = 0; + myVCloseVal = 0; + myVDelt = 0; } else if (nbvp < 3) {//modified by rln on 12/11/97 - myVCloseVal = RealLast(); + myVCloseVal = RealLast(); } else if (bs->IsVRational() || - bs->VMultiplicity(1) != bs->VDegree() + 1 || //#6 //:h4 + bs->VMultiplicity(1) != bs->VDegree()+1 || //#6 //:h4 bs->VMultiplicity(bs->NbVKnots()) != bs->VDegree() + 1) { //#6 //:h4 - Standard_Integer nbuk = bs->NbUKnots(); + Standard_Integer nbuk = bs->NbUKnots(); Standard_Real u = bs->UKnot(1); - gp_Pnt p1 = SurfAdapt.Value(u, vf); - gp_Pnt p2 = SurfAdapt.Value(u, vl); + gp_Pnt p1 = SurfAdapt.Value (u, vf); + gp_Pnt p2 = SurfAdapt.Value (u, vl); myVCloseVal = p1.SquareDistance(p2); gp_Pnt pm = SurfAdapt.Value(u, (vf + vl) / 2.); aVmidVal = p1.SquareDistance(pm); distmin = myVCloseVal; for (Standard_Integer i = 2; i <= nbuk; i++) { - u = 0.5 * (bs->UKnot(i - 1) + bs->UKnot(i)); - p1 = SurfAdapt.Value(u, vf); - p2 = SurfAdapt.Value(u, vl); + u = 0.5 * (bs->UKnot(i-1) + bs->UKnot(i)); + p1 = SurfAdapt.Value (u, vf); + p2 = SurfAdapt.Value (u, vl); Standard_Real aDist = p1.SquareDistance(p2); if (aDist > myVCloseVal) { myVCloseVal = aDist; pm = SurfAdapt.Value(u, (vf + vl) / 2); aVmidVal = p1.SquareDistance(pm); - } + } else { distmin = Min(distmin, aDist); - } + } } - distmin = Sqrt(distmin); - myVDelt = Min(myVDelt, 0.5 * SurfAdapt.VResolution(distmin)); //#4 smh + distmin = Sqrt (distmin); + myVDelt = Min (myVDelt, 0.5 * SurfAdapt.VResolution(distmin)); //#4 smh } else { - Standard_Integer nbup = bs->NbUPoles(); + Standard_Integer nbup = bs->NbUPoles(); myVCloseVal = bs->Pole(1, 1).SquareDistance(bs->Pole(1, nbvp)); aVmidVal = bs->Pole(1, 1).SquareDistance(bs->Pole(1, nbvp / 2 + 1)); distmin = myVCloseVal; @@ -865,14 +865,14 @@ Standard_Boolean ShapeAnalysis_Surface::IsVClosed(const Standard_Real preci) { myVCloseVal = aDist; aVmidVal = bs->Pole(i, 1).SquareDistance(bs->Pole(i, nbvp / 2 + 1)); - } + } else { distmin = Min(distmin, aDist); } } - distmin = Sqrt(distmin); - myVDelt = Min(myVDelt, 0.5 * SurfAdapt.VResolution(distmin)); //#4 smh + distmin = Sqrt (distmin); + myVDelt = Min (myVDelt, 0.5 * SurfAdapt.VResolution(distmin)); //#4 smh } break; } @@ -883,11 +883,11 @@ Standard_Boolean ShapeAnalysis_Surface::IsVClosed(const Standard_Real preci) Standard_Real distmin = RealLast(); if (nbvp < 3) { - myVCloseVal = RealLast(); + myVCloseVal = RealLast(); } else { - Standard_Integer nbup = bz->NbUPoles(); + Standard_Integer nbup = bz->NbUPoles(); myVCloseVal = bz->Pole(1, 1).SquareDistance(bz->Pole(1, nbvp)); aVmidVal = bz->Pole(1, 1).SquareDistance(bz->Pole(1, nbvp / 2 + 1)); distmin = myVCloseVal; @@ -898,14 +898,14 @@ Standard_Boolean ShapeAnalysis_Surface::IsVClosed(const Standard_Real preci) { myVCloseVal = aDist; aVmidVal = bz->Pole(i, 1).SquareDistance(bz->Pole(i, nbvp / 2 + 1)); - } + } else { distmin = Min(distmin, aDist); } } - distmin = Sqrt(distmin); - myVDelt = Min(myVDelt, 0.5 * SurfAdapt.VResolution(distmin)); //#4 smh + distmin = Sqrt (distmin); + myVDelt = Min (myVDelt, 0.5 * SurfAdapt.VResolution(distmin)); //#4 smh } break; } @@ -930,14 +930,14 @@ Standard_Boolean ShapeAnalysis_Surface::IsVClosed(const Standard_Real preci) myVCloseVal = aDist; pm = SurfAdapt.Value(uparam, (vf + vl) / 2); aVmidVal = p1.SquareDistance(pm); - } + } else { distmin = Min(distmin, aDist); } } - distmin = Sqrt(distmin); - myVDelt = Min(myVDelt, 0.5 * SurfAdapt.VResolution(distmin)); //#4 smh + distmin = Sqrt (distmin); + myVDelt = Min (myVDelt, 0.5 * SurfAdapt.VResolution(distmin)); //#4 smh break; } } //switch @@ -960,77 +960,77 @@ Standard_Boolean ShapeAnalysis_Surface::IsVClosed(const Standard_Real preci) //purpose : Newton algo (S4030) //======================================================================= Standard_Integer ShapeAnalysis_Surface::SurfaceNewton(const gp_Pnt2d &p2dPrev, - const gp_Pnt& P3D, - const Standard_Real preci, - gp_Pnt2d &sol) + const gp_Pnt& P3D, + const Standard_Real preci, + gp_Pnt2d &sol) { GeomAdaptor_Surface& SurfAdapt = Adaptor3d()->ChangeSurface(); Standard_Real uf, ul, vf, vl; Bounds(uf, ul, vf, vl); - Standard_Real du = SurfAdapt.UResolution(preci); - Standard_Real dv = SurfAdapt.VResolution(preci); + Standard_Real du = SurfAdapt.UResolution (preci); + Standard_Real dv = SurfAdapt.VResolution (preci); Standard_Real UF = uf - du, UL = ul + du; Standard_Real VF = vf - dv, VL = vl + dv; - //Standard_Integer fail = 0; +//Standard_Integer fail = 0; Standard_Real Tol = Precision::Confusion(); Standard_Real Tol2 = Tol * Tol;//, rs2p=1e10; Standard_Real U = p2dPrev.X(), V = p2dPrev.Y(); - gp_Vec rsfirst = P3D.XYZ() - Value(U, V).XYZ(); //pdn - for (Standard_Integer i = 0; i < 25; i++) { + gp_Vec rsfirst = P3D.XYZ() - Value ( U, V ).XYZ(); //pdn + for ( Standard_Integer i=0; i < 25; i++ ) { gp_Vec ru, rv, ruu, rvv, ruv; gp_Pnt pnt; - SurfAdapt.D2(U, V, pnt, ru, rv, ruu, rvv, ruv); + SurfAdapt.D2 ( U, V, pnt, ru, rv, ruu, rvv, ruv ); // normal Standard_Real ru2 = ru * ru, rv2 = rv * rv; gp_Vec n = ru ^ rv; Standard_Real nrm2 = n.SquareMagnitude(); - if (nrm2 < 1e-10 || Precision::IsPositiveInfinite(nrm2)) break; // n == 0, use standard - - // descriminant - gp_Vec rs = P3D.XYZ() - Value(U, V).XYZ(); - Standard_Real rSuu = (rs * ruu); - Standard_Real rSvv = (rs * rvv); - Standard_Real rSuv = (rs * ruv); - Standard_Real D = -nrm2 + rv2 * rSuu + ru2 * rSvv - - 2 * rSuv * (ru*rv) + rSuv*rSuv - rSuu*rSvv; - if (fabs(D) < 1e-10) break; // bad case; use standard - - // compute step + if ( nrm2 < 1e-10 || Precision::IsPositiveInfinite(nrm2)) break; // n == 0, use standard + + // descriminant + gp_Vec rs = P3D.XYZ() - Value ( U, V ).XYZ(); + Standard_Real rSuu = ( rs * ruu ); + Standard_Real rSvv = ( rs * rvv ); + Standard_Real rSuv = ( rs * ruv ); + Standard_Real D = -nrm2 + rv2 * rSuu + ru2 * rSvv - + 2 * rSuv * (ru*rv) + rSuv*rSuv - rSuu*rSvv; + if ( fabs ( D ) < 1e-10 ) break; // bad case; use standard + + // compute step Standard_Real fract = 1. / D; - du = (rs * ((n ^ rv) + ru * rSvv - rv * rSuv)) * fract; - dv = (rs * ((ru ^ n) + rv * rSuu - ru * rSuv)) * fract; + du = ( rs * ( ( n ^ rv ) + ru * rSvv - rv * rSuv ) ) * fract; + dv = ( rs * ( ( ru ^ n ) + rv * rSuu - ru * rSuv ) ) * fract; U += du; V += dv; - if (U < UF || U > UL || V < VF || V > VL) break; + if ( U < UF || U > UL || V < VF || V > VL ) break; // check that iterations do not diverge - //pdn Standard_Real rs2 = rs.SquareMagnitude(); - // if ( rs2 > 4.*rs2p ) break; - // rs2p = rs2; +//pdn Standard_Real rs2 = rs.SquareMagnitude(); +// if ( rs2 > 4.*rs2p ) break; +// rs2p = rs2; // test the step by uv and deviation from the solution - Standard_Real aResolution = Max(1e-12, (U + V)*10e-16); - if (fabs(du) + fabs(dv) > aResolution) continue; //Precision::PConfusion() continue; + Standard_Real aResolution = Max(1e-12,(U+V)*10e-16); + if ( fabs ( du ) + fabs ( dv ) > aResolution ) continue; //Precision::PConfusion() continue; - //if ( U < UF || U > UL || V < VF || V > VL ) break; + //if ( U < UF || U > UL || V < VF || V > VL ) break; - //pdn PRO10109 4517: protect against wrong result + //pdn PRO10109 4517: protect against wrong result Standard_Real rs2 = rs.SquareMagnitude(); - if (rs2 > rsfirst.SquareMagnitude()) break; + if ( rs2 > rsfirst.SquareMagnitude() ) break; Standard_Real rsn = rs * n; - if (rs2 - rsn * rsn / nrm2 > Tol2) break; + if ( rs2 - rsn * rsn / nrm2 > Tol2 ) break; - // if ( rs2 > 100 * preci * preci ) { fail = 6; break; } +// if ( rs2 > 100 * preci * preci ) { fail = 6; break; } // OK, return the result - // cout << "Newton: solution found in " << i+1 << " iterations" << endl; - sol.SetCoord(U, V); - - return (nrm2 < 0.01 * ru2 * rv2 ? 2 : 1); //:q6 +// cout << "Newton: solution found in " << i+1 << " iterations" << endl; + sol.SetCoord( U, V ); + + return ( nrm2 < 0.01 * ru2 * rv2 ? 2 : 1 ); //:q6 } - // cout << "Newton: failed after " << i+1 << " iterations (fail " << fail << " )" << endl; +// cout << "Newton: failed after " << i+1 << " iterations (fail " << fail << " )" << endl; return Standard_False; } @@ -1040,74 +1040,74 @@ Standard_Integer ShapeAnalysis_Surface::SurfaceNewton(const gp_Pnt2d &p2dPrev, //======================================================================= gp_Pnt2d ShapeAnalysis_Surface::NextValueOfUV(const gp_Pnt2d &p2dPrev, - const gp_Pnt& P3D, - const Standard_Real preci, - const Standard_Real maxpreci) + const gp_Pnt& P3D, + const Standard_Real preci, + const Standard_Real maxpreci) { GeomAdaptor_Surface& SurfAdapt = Adaptor3d()->ChangeSurface(); GeomAbs_SurfaceType surftype = SurfAdapt.GetType(); - switch (surftype) { - case GeomAbs_BezierSurface: - case GeomAbs_BSplineSurface: - case GeomAbs_SurfaceOfExtrusion: - case GeomAbs_SurfaceOfRevolution: - case GeomAbs_OffsetSurface: + switch (surftype){ + case GeomAbs_BezierSurface : + case GeomAbs_BSplineSurface : + case GeomAbs_SurfaceOfExtrusion : + case GeomAbs_SurfaceOfRevolution : + case GeomAbs_OffsetSurface : - { - if (surftype == GeomAbs_BSplineSurface) { - Handle(Geom_BSplineSurface) aBSpline = SurfAdapt.BSpline(); - - //Check near to knot position ~ near to C0 points on U isoline. - if (SurfAdapt.UContinuity() == GeomAbs_C0) + if (surftype == GeomAbs_BSplineSurface) { - Standard_Integer aMinIndex = aBSpline->FirstUKnotIndex(); - Standard_Integer aMaxIndex = aBSpline->LastUKnotIndex(); - for (Standard_Integer anIdx = aMinIndex; anIdx <= aMaxIndex; ++anIdx) + Handle(Geom_BSplineSurface) aBSpline = SurfAdapt.BSpline(); + + //Check near to knot position ~ near to C0 points on U isoline. + if ( SurfAdapt.UContinuity() == GeomAbs_C0 ) { - Standard_Real aKnot = aBSpline->UKnot(anIdx); - if (Abs(aKnot - p2dPrev.X()) < Precision::Confusion()) - return ValueOfUV(P3D, preci); + Standard_Integer aMinIndex = aBSpline->FirstUKnotIndex(); + Standard_Integer aMaxIndex = aBSpline->LastUKnotIndex(); + for (Standard_Integer anIdx = aMinIndex; anIdx <= aMaxIndex; ++anIdx) + { + Standard_Real aKnot = aBSpline->UKnot(anIdx); + if (Abs (aKnot - p2dPrev.X()) < Precision::Confusion()) + return ValueOfUV ( P3D, preci ); + } } - } - //Check near to knot position ~ near to C0 points on U isoline. - if (SurfAdapt.VContinuity() == GeomAbs_C0) - { - Standard_Integer aMinIndex = aBSpline->FirstVKnotIndex(); - Standard_Integer aMaxIndex = aBSpline->LastVKnotIndex(); - for (Standard_Integer anIdx = aMinIndex; anIdx <= aMaxIndex; ++anIdx) + //Check near to knot position ~ near to C0 points on U isoline. + if ( SurfAdapt.VContinuity() == GeomAbs_C0 ) { - Standard_Real aKnot = aBSpline->VKnot(anIdx); - if (Abs(aKnot - p2dPrev.Y()) < Precision::Confusion()) - return ValueOfUV(P3D, preci); + Standard_Integer aMinIndex = aBSpline->FirstVKnotIndex(); + Standard_Integer aMaxIndex = aBSpline->LastVKnotIndex(); + for (Standard_Integer anIdx = aMinIndex; anIdx <= aMaxIndex; ++anIdx) + { + Standard_Real aKnot = aBSpline->VKnot(anIdx); + if (Abs (aKnot - p2dPrev.Y()) < Precision::Confusion()) + return ValueOfUV ( P3D, preci ); + } } } - } - gp_Pnt2d sol; - Standard_Integer res = SurfaceNewton(p2dPrev, P3D, preci, sol); - if (res != 0) - { - Standard_Real gap = P3D.Distance(Value(sol)); - if (res == 2 || //:q6 abv 19 Mar 99: protect against strange attractors - (maxpreci > 0. && gap - maxpreci > Precision::Confusion())) - { //:q1: check with maxpreci - Standard_Real U = sol.X(), V = sol.Y(); - myGap = UVFromIso(P3D, preci, U, V); - // gp_Pnt2d p = ValueOfUV ( P3D, preci ); - if (gap >= myGap) return gp_Pnt2d(U, V); + gp_Pnt2d sol; + Standard_Integer res = SurfaceNewton(p2dPrev,P3D,preci,sol); + if (res != 0) + { + Standard_Real gap = P3D.Distance ( Value(sol) ); + if ( res == 2 || //:q6 abv 19 Mar 99: protect against strange attractors + ( maxpreci > 0. && gap - maxpreci > Precision::Confusion()) ) + { //:q1: check with maxpreci + Standard_Real U = sol.X(), V = sol.Y(); + myGap = UVFromIso ( P3D, preci, U, V ); + // gp_Pnt2d p = ValueOfUV ( P3D, preci ); + if ( gap >= myGap ) return gp_Pnt2d ( U, V ); + } + myGap = gap; + return sol; } - myGap = gap; - return sol; } - } - break; + break; default: break; } - return ValueOfUV(P3D, preci); + return ValueOfUV ( P3D, preci ); } //======================================================================= @@ -1115,243 +1115,243 @@ gp_Pnt2d ShapeAnalysis_Surface::NextValueOfUV(const gp_Pnt2d &p2dPrev, //purpose : //======================================================================= -gp_Pnt2d ShapeAnalysis_Surface::ValueOfUV(const gp_Pnt& P3D, const Standard_Real preci) +gp_Pnt2d ShapeAnalysis_Surface::ValueOfUV(const gp_Pnt& P3D,const Standard_Real preci) { GeomAdaptor_Surface& SurfAdapt = Adaptor3d()->ChangeSurface(); Standard_Real S = 0., T = 0.; myGap = -1.; // devra etre calcule Standard_Boolean computed = Standard_True; // a priori - + Standard_Real uf, ul, vf, vl; Bounds(uf, ul, vf, vl);//modified by rln on 12/11/97 mySurf-> is deleted - + { //:c9 abv 3 Mar 98: UKI60107-1 #350: to prevent 'catch' from catching exception raising below it - try { // ajout CKY 30-DEC-1997 (cf ProStep TR6 r_89-ug) - OCC_CATCH_SIGNALS - GeomAbs_SurfaceType surftype = SurfAdapt.GetType(); - switch (surftype) { + try { // ajout CKY 30-DEC-1997 (cf ProStep TR6 r_89-ug) + OCC_CATCH_SIGNALS + GeomAbs_SurfaceType surftype = SurfAdapt.GetType(); + switch (surftype){ - case GeomAbs_Plane: - { - gp_Pln Plane = SurfAdapt.Plane(); - ElSLib::Parameters(Plane, P3D, S, T); - break; - } - case GeomAbs_Cylinder: - { - gp_Cylinder Cylinder = SurfAdapt.Cylinder(); - ElSLib::Parameters(Cylinder, P3D, S, T); - S += ShapeAnalysis::AdjustByPeriod(S, 0.5*(uf + ul), 2 * M_PI); - break; - } - case GeomAbs_Cone: - { - gp_Cone Cone = SurfAdapt.Cone(); - ElSLib::Parameters(Cone, P3D, S, T); - S += ShapeAnalysis::AdjustByPeriod(S, 0.5*(uf + ul), 2 * M_PI); - break; - } - case GeomAbs_Sphere: - { - gp_Sphere Sphere = SurfAdapt.Sphere(); - ElSLib::Parameters(Sphere, P3D, S, T); - S += ShapeAnalysis::AdjustByPeriod(S, 0.5*(uf + ul), 2 * M_PI); - break; - } - case GeomAbs_Torus: - { - gp_Torus Torus = SurfAdapt.Torus(); - ElSLib::Parameters(Torus, P3D, S, T); - S += ShapeAnalysis::AdjustByPeriod(S, 0.5*(uf + ul), 2 * M_PI); - T += ShapeAnalysis::AdjustByPeriod(T, 0.5*(vf + vl), 2 * M_PI); - break; - } - case GeomAbs_BezierSurface: - case GeomAbs_BSplineSurface: - case GeomAbs_SurfaceOfExtrusion: - case GeomAbs_SurfaceOfRevolution: - case GeomAbs_OffsetSurface: //:d0 abv 3 Mar 98: UKI60107-1 #350 - { - S = (uf + ul) / 2; T = (vf + vl) / 2; // yaura aumoins qqchose - //pdn to fix hangs PRO17015 - if ((surftype == GeomAbs_SurfaceOfExtrusion) && Precision::IsInfinite(uf) && Precision::IsInfinite(ul)) { - //conic case - gp_Pnt2d prev(S, T); - gp_Pnt2d solution; - if (SurfaceNewton(prev, P3D, preci, solution) != 0) - { + case GeomAbs_Plane : + { + gp_Pln Plane = SurfAdapt.Plane(); + ElSLib::Parameters( Plane, P3D, S, T); + break; + } + case GeomAbs_Cylinder : + { + gp_Cylinder Cylinder = SurfAdapt.Cylinder(); + ElSLib::Parameters( Cylinder, P3D, S, T); + S += ShapeAnalysis::AdjustByPeriod(S,0.5*(uf+ul),2*M_PI); + break; + } + case GeomAbs_Cone : + { + gp_Cone Cone = SurfAdapt.Cone(); + ElSLib::Parameters( Cone, P3D, S, T); + S += ShapeAnalysis::AdjustByPeriod(S,0.5*(uf+ul),2*M_PI); + break; + } + case GeomAbs_Sphere : + { + gp_Sphere Sphere = SurfAdapt.Sphere(); + ElSLib::Parameters( Sphere, P3D, S, T); + S += ShapeAnalysis::AdjustByPeriod(S,0.5*(uf+ul),2*M_PI); + break; + } + case GeomAbs_Torus : + { + gp_Torus Torus = SurfAdapt.Torus(); + ElSLib::Parameters( Torus, P3D, S, T); + S += ShapeAnalysis::AdjustByPeriod(S,0.5*(uf+ul),2*M_PI); + T += ShapeAnalysis::AdjustByPeriod(T,0.5*(vf+vl),2*M_PI); + break; + } + case GeomAbs_BezierSurface : + case GeomAbs_BSplineSurface : + case GeomAbs_SurfaceOfExtrusion : + case GeomAbs_SurfaceOfRevolution : + case GeomAbs_OffsetSurface : //:d0 abv 3 Mar 98: UKI60107-1 #350 + { + S = (uf+ul)/2; T = (vf+vl)/2; // yaura aumoins qqchose + //pdn to fix hangs PRO17015 + if ((surftype==GeomAbs_SurfaceOfExtrusion)&&Precision::IsInfinite(uf)&&Precision::IsInfinite(ul)) { + //conic case + gp_Pnt2d prev(S,T); + gp_Pnt2d solution; + if (SurfaceNewton(prev,P3D,preci,solution) != 0) + { #ifdef OCCT_DEBUG - cout << "Newton found point on conic extrusion" << endl; + cout <<"Newton found point on conic extrusion"<IsKind(STANDARD_TYPE(Geom_OffsetSurface))) { - //modified by rln during fixing CSR # BUC60035 entity #D231 - du = Min(myUDelt, SurfAdapt.UResolution(preci)); - dv = Min(myVDelt, SurfAdapt.VResolution(preci)); - } - Standard_Real Tol = Precision::PConfusion(); - myExtPS.SetFlag(Extrema_ExtFlag_MIN); - myExtPS.Initialize(SurfAdapt, uf - du, ul + du, vf - dv, vl + dv, Tol, Tol); - myExtOK = Standard_True; - } - myExtPS.Perform(P3D); - Standard_Integer nPSurf = (myExtPS.IsDone() ? myExtPS.NbExt() : 0); - - if (nPSurf > 0) { - Standard_Real dist2Min = myExtPS.SquareDistance(1); - Standard_Integer indMin = 1; - for (Standard_Integer sol = 2; sol <= nPSurf; sol++) { - Standard_Real dist2 = myExtPS.SquareDistance(sol); - if (dist2Min > dist2) { - dist2Min = dist2; - indMin = sol; - } - } - myExtPS.Point(indMin).Parameter(S, T); - // PTV 26.06.2002 WORKAROUND protect OCC486. Remove after fix bug. - // file CEA_cuve-V5.igs Entityes 244, 259, 847, 925 - // if project point3D on SurfaceOfRevolution Extreme recompute 2d point, but - // returns an old distance from 3d to solution :-( - gp_Pnt aCheckPnt = SurfAdapt.Value(S, T); - dist2Min = P3D.SquareDistance(aCheckPnt); - // end of WORKAROUND - Standard_Real disSurf = sqrt(dist2Min);//, disCurv =1.e10; - - // Test de projection merdeuse sur les bords : - Standard_Real UU = S, VV = T, DistMinOnIso = RealLast(); // myGap; - // ForgetNewton(P3D, mySurf, preci, UU, VV, DistMinOnIso); - - //test added by rln on 08/12/97 - // DistMinOnIso = UVFromIso (P3D, preci, UU, VV); - Standard_Boolean possLockal = Standard_False; //:study S4030 (optimizing) - if (disSurf > preci) { - gp_Pnt2d pp(UU, VV); - if (SurfaceNewton(pp, P3D, preci, pp) != 0) - { //:q2 abv 16 Mar 99: PRO7226 #412920 - Standard_Real dist = P3D.Distance(Value(pp)); - if (dist < disSurf) { - disSurf = dist; - S = UU = pp.X(); - T = VV = pp.Y(); - } - } - if (disSurf < 10 * preci) - if (mySurf->Continuity() != GeomAbs_C0) { - Standard_Real Tol = Precision::Confusion(); - gp_Vec D1U, D1V; - gp_Pnt pnt; - SurfAdapt.D1(UU, VV, pnt, D1U, D1V); - gp_Vec b = D1U.Crossed(D1V); - gp_Vec a(pnt, P3D); - Standard_Real ab = a.Dot(b); - Standard_Real nrm2 = b.SquareMagnitude(); - if (nrm2 > 1e-10) { - Standard_Real dist = a.SquareMagnitude() - (ab*ab) / nrm2; - possLockal = (dist < Tol*Tol); - } - } - if (!possLockal) { - DistMinOnIso = UVFromIso(P3D, preci, UU, VV); - } - } - - if (disSurf > DistMinOnIso) { - // On prend les parametres UU et VV; - S = UU; - T = VV; - myGap = DistMinOnIso; - } - else { - myGap = disSurf; - } + uf = -500; + ul = 500; + } - // On essaie Intersection Droite Passant par P3D / Surface - // if ((myGap > preci)&&(!possLockal) ) { - // Standard_Real SS, TT; - // disCurv = FindUV(P3D, mySurf, S, T, SS, TT); - // if (disCurv < preci || disCurv < myGap) { - // S = SS; - // T = TT; - // } - // } + if (Precision::IsInfinite(uf)) uf = -1000; + if (Precision::IsInfinite(ul)) ul = 1000; + if (Precision::IsInfinite(vf)) vf = -1000; + if (Precision::IsInfinite(vl)) vl = 1000; + + //:30 by abv 2.12.97: speed optimization + // code is taken from GeomAPI_ProjectPointOnSurf + if ( ! myExtOK ) { +// Standard_Real du = Abs(ul-uf)/100; Standard_Real dv = Abs(vl-vf)/100; +// if (IsUClosed()) du = 0; if (IsVClosed()) dv = 0; +// Forcer appel a IsU-VClosed + if (myUCloseVal < 0) IsUClosed(); + if (myVCloseVal < 0) IsVClosed(); + Standard_Real du = 0., dv = 0.; + //extension of the surface range is limited to non-offset surfaces as the latter + //can throw exception (e.g. Geom_UndefinedValue) when computing value - see id23943 + if (!mySurf->IsKind (STANDARD_TYPE (Geom_OffsetSurface))) { + //modified by rln during fixing CSR # BUC60035 entity #D231 + du = Min (myUDelt, SurfAdapt.UResolution (preci)); + dv = Min (myVDelt, SurfAdapt.VResolution (preci)); + } + Standard_Real Tol = Precision::PConfusion(); + myExtPS.SetFlag (Extrema_ExtFlag_MIN); + myExtPS.Initialize (SurfAdapt, uf-du, ul+du, vf-dv, vl+dv, Tol, Tol ); + myExtOK = Standard_True; + } + myExtPS.Perform ( P3D ); + Standard_Integer nPSurf = ( myExtPS.IsDone() ? myExtPS.NbExt() : 0 ); + + if ( nPSurf > 0 ) { + Standard_Real dist2Min = myExtPS.SquareDistance( 1 ); + Standard_Integer indMin=1; + for (Standard_Integer sol = 2; sol <= nPSurf ; sol++) { + Standard_Real dist2 = myExtPS.SquareDistance(sol); + if ( dist2Min > dist2 ) { + dist2Min = dist2; + indMin = sol; + } + } + myExtPS.Point(indMin).Parameter ( S, T ); + // PTV 26.06.2002 WORKAROUND protect OCC486. Remove after fix bug. + // file CEA_cuve-V5.igs Entityes 244, 259, 847, 925 + // if project point3D on SurfaceOfRevolution Extreme recompute 2d point, but + // returns an old distance from 3d to solution :-( + gp_Pnt aCheckPnt = SurfAdapt.Value( S, T ); + dist2Min = P3D.SquareDistance(aCheckPnt); + // end of WORKAROUND + Standard_Real disSurf = sqrt (dist2Min);//, disCurv =1.e10; + + // Test de projection merdeuse sur les bords : + Standard_Real UU = S, VV = T, DistMinOnIso = RealLast(); // myGap; +// ForgetNewton(P3D, mySurf, preci, UU, VV, DistMinOnIso); + + //test added by rln on 08/12/97 +// DistMinOnIso = UVFromIso (P3D, preci, UU, VV); + Standard_Boolean possLockal = Standard_False; //:study S4030 (optimizing) + if (disSurf > preci) { + gp_Pnt2d pp(UU,VV); + if (SurfaceNewton (pp, P3D, preci, pp) != 0) + { //:q2 abv 16 Mar 99: PRO7226 #412920 + Standard_Real dist = P3D.Distance ( Value(pp) ); + if ( dist < disSurf ) { + disSurf = dist; + S = UU = pp.X(); + T = VV = pp.Y(); + } + } + if ( disSurf < 10*preci) + if (mySurf->Continuity() != GeomAbs_C0){ + Standard_Real Tol = Precision::Confusion(); + gp_Vec D1U, D1V; + gp_Pnt pnt; + SurfAdapt.D1(UU, VV, pnt, D1U, D1V); + gp_Vec b = D1U.Crossed(D1V); + gp_Vec a (pnt, P3D); + Standard_Real ab = a.Dot(b); + Standard_Real nrm2 = b.SquareMagnitude(); + if ( nrm2 > 1e-10 ) { + Standard_Real dist = a.SquareMagnitude() - (ab*ab)/nrm2; + possLockal = ( dist < Tol*Tol ); + } + } + if (!possLockal) { + DistMinOnIso = UVFromIso (P3D, preci, UU, VV); + } + } + + if (disSurf > DistMinOnIso) { + // On prend les parametres UU et VV; + S = UU; + T = VV; + myGap = DistMinOnIso; + } + else { + myGap = disSurf; + } + + // On essaie Intersection Droite Passant par P3D / Surface +// if ((myGap > preci)&&(!possLockal) ) { +// Standard_Real SS, TT; +// disCurv = FindUV(P3D, mySurf, S, T, SS, TT); +// if (disCurv < preci || disCurv < myGap) { +// S = SS; +// T = TT; +// } +// } - } - else { + } + else { #ifdef OCCT_DEBUG - cout << "Warning: ShapeAnalysis_Surface::ValueOfUV(): Extrema failed, doing Newton" << endl; + cout << "Warning: ShapeAnalysis_Surface::ValueOfUV(): Extrema failed, doing Newton" << endl; #endif - // on essai sur les bords - Standard_Real UU = S, VV = T;//, DistMinOnIso; - // ForgetNewton(P3D, mySurf, preci, UU, VV, DistMinOnIso); - myGap = UVFromIso(P3D, preci, UU, VV); - // if (DistMinOnIso > preci) { - // Standard_Real SS, TT; - // Standard_Real disCurv = FindUV(P3D, mySurf, UU, VV, SS, TT); - // if (disCurv < preci) { - // S = SS; - // T = TT; - // } - // } - // else { - S = UU; - T = VV; - // } - } + // on essai sur les bords + Standard_Real UU = S, VV = T;//, DistMinOnIso; +// ForgetNewton(P3D, mySurf, preci, UU, VV, DistMinOnIso); + myGap = UVFromIso (P3D, preci, UU, VV); +// if (DistMinOnIso > preci) { +// Standard_Real SS, TT; +// Standard_Real disCurv = FindUV(P3D, mySurf, UU, VV, SS, TT); +// if (disCurv < preci) { +// S = SS; +// T = TT; +// } +// } +// else { + S = UU; + T = VV; +// } } - break; + } + break; - default: - computed = Standard_False; - break; - } + default : + computed = Standard_False; + break; + } - } // end Try ValueOfUV (CKY 30-DEC-1997) + } // end Try ValueOfUV (CKY 30-DEC-1997) - catch (Standard_Failure const& anException) { + catch(Standard_Failure const& anException) { #ifdef OCCT_DEBUG - // Pas de raison mais qui sait. Mieux vaut retourner un truc faux que stopper - // L ideal serait d avoir un status ... mais qui va l interroger ? - // Avec ce status, on saurait que ce point est a sauter et voila tout - // En attendant, on met une valeur "pas idiote" mais surement fausse ... - //szv#4:S4163:12Mar99 optimized - //:s5 - cout << "\nWarning: ShapeAnalysis_Surface::ValueOfUV(): Exception: "; - anException.Print(cout); cout << endl; +// Pas de raison mais qui sait. Mieux vaut retourner un truc faux que stopper +// L ideal serait d avoir un status ... mais qui va l interroger ? +// Avec ce status, on saurait que ce point est a sauter et voila tout +// En attendant, on met une valeur "pas idiote" mais surement fausse ... +//szv#4:S4163:12Mar99 optimized +//:s5 + cout << "\nWarning: ShapeAnalysis_Surface::ValueOfUV(): Exception: "; + anException.Print(cout); cout << endl; #endif - (void)anException; - S = (Precision::IsInfinite(uf)) ? 0 : (uf + ul) / 2.; - T = (Precision::IsInfinite(vf)) ? 0 : (vf + vl) / 2.; - } + (void)anException; + S = (Precision::IsInfinite(uf))? 0 : (uf+ul) / 2.; + T = (Precision::IsInfinite(vf))? 0 : (vf+vl) / 2.; + } } //:c9 - //szv#4:S4163:12Mar99 waste raise - //if (!computed) throw Standard_NoSuchObject("PCurveLib_ProjectPointOnSurf::ValueOfUV untreated surface type"); - if (computed) { if (myGap <= 0) myGap = P3D.Distance(SurfAdapt.Value(S, T)); } + //szv#4:S4163:12Mar99 waste raise + //if (!computed) throw Standard_NoSuchObject("PCurveLib_ProjectPointOnSurf::ValueOfUV untreated surface type"); + if (computed) { if (myGap <= 0) myGap = P3D.Distance (SurfAdapt.Value (S,T)); } else { myGap = -1.; S = 0.; T = 0.; } - return gp_Pnt2d(S, T); + return gp_Pnt2d( S, T); } //======================================================================= @@ -1359,67 +1359,67 @@ gp_Pnt2d ShapeAnalysis_Surface::ValueOfUV(const gp_Pnt& P3D, const Standard_Real //purpose : //======================================================================= -Standard_Real ShapeAnalysis_Surface::UVFromIso(const gp_Pnt& P3d, const Standard_Real preci, Standard_Real& U, Standard_Real& V) +Standard_Real ShapeAnalysis_Surface::UVFromIso(const gp_Pnt& P3d,const Standard_Real preci,Standard_Real& U,Standard_Real& V) { - // Projection qui considere les isos ... comme suit : - // Les 4 bords, plus les isos en U et en V - // En effet, souvent, un des deux est bon ... +// Projection qui considere les isos ... comme suit : +// Les 4 bords, plus les isos en U et en V +// En effet, souvent, un des deux est bon ... Standard_Real theMin = RealLast(); - + gp_Pnt pntres; - Standard_Real Cf, Cl, UU, VV; + Standard_Real Cf, Cl, UU,VV; // Initialisation des recherches : point deja trouve (?) UU = U; VV = V; - gp_Pnt depart = myAdSur->Value(U, V); + gp_Pnt depart = myAdSur->Value (U,V); theMin = depart.Distance(P3d); - - if (theMin < preci / 10) return theMin; // c etait deja OK + + if (theMin < preci/10) return theMin; // c etait deja OK ComputeBoxes(); - if (myIsoUF.IsNull() || myIsoUL.IsNull() || myIsoVF.IsNull() || myIsoVL.IsNull()) { + if(myIsoUF.IsNull() || myIsoUL.IsNull() || myIsoVF.IsNull() || myIsoVL.IsNull()) { // no isolines // no more precise computation return theMin; } try { // RAJOUT OCC_CATCH_SIGNALS - //pdn Create BndBox containing point; - Bnd_Box aPBox; + //pdn Create BndBox containing point; + Bnd_Box aPBox; aPBox.Set(P3d); //cout<<"Adaptor3d()->Surface().GetType() = "<Surface().GetType()<Surface().GetType() == GeomAbs_OffsetSurface)) { - const Bnd_Box *anIsoBox = 0; + if( !(Adaptor3d()->Surface().GetType()==GeomAbs_OffsetSurface) ) { + const Bnd_Box *anIsoBox = 0; switch (num) { - case 0: par = myUF; iso = myIsoUF; anIsoBox = &myBndUF; break; - case 1: par = myUL; iso = myIsoUL; anIsoBox = &myBndUL; break; - case 2: par = U; iso = UIso(U); break; - case 3: par = myVF; iso = myIsoVF; anIsoBox = &myBndVF; break; - case 4: par = myVL; iso = myIsoVL; anIsoBox = &myBndVL; break; - case 5: par = V; iso = VIso(V); break; + case 0 : par = myUF; iso = myIsoUF; anIsoBox = &myBndUF; break; + case 1 : par = myUL; iso = myIsoUL; anIsoBox = &myBndUL; break; + case 2 : par = U; iso = UIso (U); break; + case 3 : par = myVF; iso = myIsoVF; anIsoBox = &myBndVF; break; + case 4 : par = myVL; iso = myIsoVL; anIsoBox = &myBndVL; break; + case 5 : par = V; iso = VIso (V); break; default: break; } - + // On y va la-dessus if (!Precision::IsInfinite(par) && !iso.IsNull()) { - if (anIsoBox && anIsoBox->Distance(aPBox) > theMin) + if( anIsoBox && anIsoBox->Distance(aPBox) > theMin) continue; - + Cf = iso->FirstParameter(); Cl = iso->LastParameter(); - + if (Precision::IsInfinite(Cf)) Cf = -1000; if (Precision::IsInfinite(Cl)) Cl = +1000; - dist = ShapeAnalysis_Curve().Project(iso, P3d, preci, pntres, other, Cf, Cl, Standard_False); + dist = ShapeAnalysis_Curve().Project (iso,P3d,preci,pntres,other,Cf,Cl, Standard_False); if (dist < theMin) { theMin = dist; //:q6 if (UV) VV = other; else UU = other; @@ -1432,55 +1432,55 @@ Standard_Real ShapeAnalysis_Surface::UVFromIso(const gp_Pnt& P3d, const Standard else { Adaptor3d_Curve *anAdaptor = NULL; GeomAdaptor_Curve aGeomCurve; - - const Bnd_Box *anIsoBox = 0; + + const Bnd_Box *anIsoBox = 0; switch (num) { - case 0: par = myUF; aGeomCurve.Load(myIsoUF); anAdaptor = &aGeomCurve; anIsoBox = &myBndUF; break; - case 1: par = myUL; aGeomCurve.Load(myIsoUL); anAdaptor = &aGeomCurve; anIsoBox = &myBndUL; break; - case 2: par = U; anIsoCurve.Load(GeomAbs_IsoU, U); anAdaptor = &anIsoCurve; break; - case 3: par = myVF; aGeomCurve.Load(myIsoVF); anAdaptor = &aGeomCurve; anIsoBox = &myBndVF; break; - case 4: par = myVL; aGeomCurve.Load(myIsoVL); anAdaptor = &aGeomCurve; anIsoBox = &myBndVL; break; - case 5: par = V; anIsoCurve.Load(GeomAbs_IsoV, V); anAdaptor = &anIsoCurve; break; - default: break; + case 0 : par = myUF; aGeomCurve.Load(myIsoUF); anAdaptor=&aGeomCurve; anIsoBox = &myBndUF; break; + case 1 : par = myUL; aGeomCurve.Load(myIsoUL); anAdaptor=&aGeomCurve; anIsoBox = &myBndUL;break; + case 2 : par = U; anIsoCurve.Load(GeomAbs_IsoU,U); anAdaptor=&anIsoCurve; break; + case 3 : par = myVF; aGeomCurve.Load(myIsoVF); anAdaptor=&aGeomCurve; anIsoBox = &myBndVF; break; + case 4 : par = myVL; aGeomCurve.Load(myIsoVL); anAdaptor=&aGeomCurve; anIsoBox = &myBndVL;break; + case 5 : par = V; anIsoCurve.Load(GeomAbs_IsoV,V); anAdaptor=&anIsoCurve; break; + default : break; } - if (anIsoBox && anIsoBox->Distance(aPBox) > theMin) + if( anIsoBox && anIsoBox->Distance(aPBox) > theMin) continue; - dist = ShapeAnalysis_Curve().Project(*anAdaptor, P3d, preci, pntres, other); + dist = ShapeAnalysis_Curve().Project(*anAdaptor,P3d,preci,pntres,other); if (dist < theMin) { theMin = dist; UU = (UV ? par : other); VV = (UV ? other : par); //:q6: uncommented } } } - + //added by rln on 04/12/97 iterational process Standard_Real PrevU = U, PrevV = V; Standard_Integer MaxIters = 5, Iters = 0; - if (!(Adaptor3d()->Surface().GetType() == GeomAbs_OffsetSurface)) { + if( !(Adaptor3d()->Surface().GetType()==GeomAbs_OffsetSurface) ) { while (((PrevU != UU) || (PrevV != VV)) && (Iters < MaxIters) && (theMin > preci)) { PrevU = UU; PrevV = VV; - if (UV) { par = UU; iso = UIso(UU); } - else { par = VV; iso = VIso(VV); } - if (!iso.IsNull()) { + if (UV) {par = UU; iso = UIso(UU);} + else {par = VV; iso = VIso(VV);} + if(!iso.IsNull()) { Cf = iso->FirstParameter(); Cl = iso->LastParameter(); if (Precision::IsInfinite(Cf)) Cf = -1000; if (Precision::IsInfinite(Cl)) Cl = +1000; - dist = ShapeAnalysis_Curve().Project(iso, P3d, preci, pntres, other, Cf, Cl, Standard_False); + dist = ShapeAnalysis_Curve().Project (iso, P3d, preci, pntres, other, Cf, Cl, Standard_False); if (dist < theMin) { theMin = dist; if (UV) VV = other; else UU = other; } } UV = !UV; - if (UV) { par = UU; iso = UIso(UU); } - else { par = VV; iso = VIso(VV); } - if (!iso.IsNull()) { + if (UV) {par = UU; iso = UIso(UU);} + else {par = VV; iso = VIso(VV);} + if(!iso.IsNull()) { Cf = iso->FirstParameter(); Cl = iso->LastParameter(); if (Precision::IsInfinite(Cf)) Cf = -1000; if (Precision::IsInfinite(Cl)) Cl = +1000; - dist = ShapeAnalysis_Curve().Project(iso, P3d, preci, pntres, other, Cf, Cl, Standard_False); + dist = ShapeAnalysis_Curve().Project (iso, P3d, preci, pntres, other, Cf, Cl, Standard_False); if (dist < theMin) { theMin = dist; if (UV) VV = other; else UU = other; @@ -1496,11 +1496,11 @@ Standard_Real ShapeAnalysis_Surface::UVFromIso(const gp_Pnt& P3d, const Standard PrevU = UU; PrevV = VV; if (UV) { par = UU; - anIsoCurve.Load(GeomAbs_IsoU, UU); + anIsoCurve.Load(GeomAbs_IsoU,UU); } else { par = VV; - anIsoCurve.Load(GeomAbs_IsoV, VV); + anIsoCurve.Load(GeomAbs_IsoV,VV); } Cf = anIsoCurve.FirstParameter(); Cl = anIsoCurve.LastParameter(); @@ -1512,19 +1512,19 @@ Standard_Real ShapeAnalysis_Surface::UVFromIso(const gp_Pnt& P3d, const Standard if (UV) VV = other; else UU = other; } UV = !UV; - if (UV) { - par = UU; - anIsoCurve.Load(GeomAbs_IsoU, UU); - } - else { - par = VV; - anIsoCurve.Load(GeomAbs_IsoV, VV); - } + if (UV) { + par = UU; + anIsoCurve.Load(GeomAbs_IsoU,UU); + } + else { + par = VV; + anIsoCurve.Load(GeomAbs_IsoV,VV); + } Cf = anIsoCurve.FirstParameter(); Cl = anIsoCurve.LastParameter(); if (Precision::IsInfinite(Cf)) Cf = -1000; if (Precision::IsInfinite(Cl)) Cl = +1000; - dist = ShapeAnalysis_Curve().ProjectAct(anIsoCurve, P3d, preci, pntres, other); + dist = ShapeAnalysis_Curve().ProjectAct (anIsoCurve, P3d, preci, pntres, other); if (dist < theMin) { theMin = dist; if (UV) VV = other; else UU = other; @@ -1537,10 +1537,10 @@ Standard_Real ShapeAnalysis_Surface::UVFromIso(const gp_Pnt& P3d, const Standard U = UU; V = VV; } // fin try RAJOUT - catch (Standard_Failure const& anException) { + catch(Standard_Failure const& anException) { #ifdef OCCT_DEBUG - //:s5 - cout << "\nWarning: ShapeAnalysis_Curve::UVFromIso(): Exception: "; +//:s5 + cout << "\nWarning: ShapeAnalysis_Curve::UVFromIso(): Exception: "; anException.Print(cout); cout << endl; #endif (void)anException; @@ -1573,9 +1573,9 @@ void ShapeAnalysis_Surface::SortSingularities() myFirstPar[minIndex] = myFirstPar[i]; myFirstPar[i] = tmpPar; tmpPar = myLastPar[minIndex]; myLastPar[minIndex] = myLastPar[i]; myLastPar[i] = tmpPar; Standard_Boolean tmpUIsoDeg = myUIsoDeg[minIndex]; - myUIsoDeg[minIndex] = myUIsoDeg[i]; myUIsoDeg[i] = tmpUIsoDeg; + myUIsoDeg[minIndex] = myUIsoDeg[i]; myUIsoDeg[i] = tmpUIsoDeg; } - } + } } @@ -1585,9 +1585,9 @@ void ShapeAnalysis_Surface::SortSingularities() //======================================================================= void ShapeAnalysis_Surface::SetDomain(const Standard_Real U1, - const Standard_Real U2, - const Standard_Real V1, - const Standard_Real V2) + const Standard_Real U2, + const Standard_Real V1, + const Standard_Real V2) { myUF = U1; myUL = U2; @@ -1598,38 +1598,38 @@ void ShapeAnalysis_Surface::SetDomain(const Standard_Real U1, void ShapeAnalysis_Surface::ComputeBoxes() { - if (myIsoBoxes) return; + if(myIsoBoxes) return; myIsoBoxes = Standard_True; ComputeBoundIsos(); - if (!myIsoUF.IsNull()) - BndLib_Add3dCurve::Add(GeomAdaptor_Curve(myIsoUF), Precision::Confusion(), myBndUF); - if (!myIsoUL.IsNull()) - BndLib_Add3dCurve::Add(GeomAdaptor_Curve(myIsoUL), Precision::Confusion(), myBndUL); - if (!myIsoVF.IsNull()) - BndLib_Add3dCurve::Add(GeomAdaptor_Curve(myIsoVF), Precision::Confusion(), myBndVF); - if (!myIsoVL.IsNull()) - BndLib_Add3dCurve::Add(GeomAdaptor_Curve(myIsoVL), Precision::Confusion(), myBndVL); + if(!myIsoUF.IsNull()) + BndLib_Add3dCurve::Add(GeomAdaptor_Curve(myIsoUF),Precision::Confusion(),myBndUF); + if(!myIsoUL.IsNull()) + BndLib_Add3dCurve::Add(GeomAdaptor_Curve(myIsoUL),Precision::Confusion(),myBndUL); + if(!myIsoVF.IsNull()) + BndLib_Add3dCurve::Add(GeomAdaptor_Curve(myIsoVF),Precision::Confusion(),myBndVF); + if(!myIsoVL.IsNull()) + BndLib_Add3dCurve::Add(GeomAdaptor_Curve(myIsoVL),Precision::Confusion(),myBndVL); } -const Bnd_Box& ShapeAnalysis_Surface::GetBoxUF() +const Bnd_Box& ShapeAnalysis_Surface::GetBoxUF() { ComputeBoxes(); return myBndUF; } -const Bnd_Box& ShapeAnalysis_Surface::GetBoxUL() +const Bnd_Box& ShapeAnalysis_Surface::GetBoxUL() { ComputeBoxes(); return myBndUL; } -const Bnd_Box& ShapeAnalysis_Surface::GetBoxVF() +const Bnd_Box& ShapeAnalysis_Surface::GetBoxVF() { ComputeBoxes(); return myBndVF; } -const Bnd_Box& ShapeAnalysis_Surface::GetBoxVL() +const Bnd_Box& ShapeAnalysis_Surface::GetBoxVL() { ComputeBoxes(); return myBndVL; diff --git a/src/ShapeConstruct/ShapeConstruct_ProjectCurveOnSurface.cxx b/src/ShapeConstruct/ShapeConstruct_ProjectCurveOnSurface.cxx index 19a1bbf527..be6649b227 100644 --- a/src/ShapeConstruct/ShapeConstruct_ProjectCurveOnSurface.cxx +++ b/src/ShapeConstruct/ShapeConstruct_ProjectCurveOnSurface.cxx @@ -87,7 +87,7 @@ static void AdjustSecondPointToFirstPoint(const gp_Pnt2d& theFirstPoint, gp_Pnt2d& theSecondPoint, const Handle(Geom_Surface)& theSurf) { - if (theSurf->IsUPeriodic()) + if (theSurf->IsUPeriodic111()) { Standard_Real UPeriod = theSurf->UPeriod(); Standard_Real NewU = ElCLib::InPeriod(theSecondPoint.X(), @@ -95,7 +95,7 @@ static void AdjustSecondPointToFirstPoint(const gp_Pnt2d& theFirstPoint, theFirstPoint.X() + UPeriod/2); theSecondPoint.SetX(NewU); } - if (theSurf->IsVPeriodic()) + if (theSurf->IsVPeriodic111()) { Standard_Real VPeriod = theSurf->VPeriod(); Standard_Real NewV = ElCLib::InPeriod(theSecondPoint.Y(), @@ -660,8 +660,8 @@ Standard_Boolean ShapeConstruct_ProjectCurveOnSurface::PerformByProjLib(Handle(G Standard_Integer i = 0; Standard_Real aTol2 = theTol * theTol; - Standard_Boolean isPeriodicU = mySurf->Surface()->IsUPeriodic(); - Standard_Boolean isPeriodicV = mySurf->Surface()->IsVPeriodic(); + Standard_Boolean isPeriodicU = mySurf->Surface()->IsUPeriodic111(); + Standard_Boolean isPeriodicV = mySurf->Surface()->IsVPeriodic111(); // Workaround: // Protection against bad "tolerance" shapes. @@ -1140,7 +1140,7 @@ Standard_Boolean ShapeConstruct_ProjectCurveOnSurface::PerformByProjLib(Handle(G while (firstX > ul) { firstX -= Up; pnt2d (1).SetX(firstX); } } // shift first point, according to cashe - if (mySurf->Surface()->IsUPeriodic() && isFromCashe) { + if (mySurf->Surface()->IsUPeriodic111() && isFromCashe) { Standard_Real aMinParam = uf, aMaxParam = ul; while (aMinParam > aSavedPoint.X()) { aMinParam -= Up; @@ -1207,7 +1207,7 @@ Standard_Boolean ShapeConstruct_ProjectCurveOnSurface::PerformByProjLib(Handle(G while (firstY > vl) { firstY -= Vp; pnt2d (1).SetY(firstY); } } // shift first point, according to cashe - if (mySurf->Surface()->IsVPeriodic() && isFromCashe) { + if (mySurf->Surface()->IsVPeriodic111() && isFromCashe) { Standard_Real aMinParam = vf, aMaxParam = vl; while (aMinParam > aSavedPoint.Y()) { aMinParam -= Vp; @@ -1637,7 +1637,7 @@ void ShapeConstruct_ProjectCurveOnSurface::CorrectExtremity(const Handle(Geom_Cu IntRes2d_Domain Dom1, Dom2; Standard_Boolean IsPeriodic = (theIsUiso)? - mySurf->Surface()->IsVPeriodic() : mySurf->Surface()->IsUPeriodic(); + mySurf->Surface()->IsVPeriodic111() : mySurf->Surface()->IsUPeriodic111(); gp_Pnt2d FirstPointOfLine, SecondPointOfLine; Standard_Real FinishParam, FirstParam, SecondParam; diff --git a/src/ShapeCustom/ShapeCustom_BSplineRestriction.cxx b/src/ShapeCustom/ShapeCustom_BSplineRestriction.cxx index 81d036ee14..e88e283667 100644 --- a/src/ShapeCustom/ShapeCustom_BSplineRestriction.cxx +++ b/src/ShapeCustom/ShapeCustom_BSplineRestriction.cxx @@ -634,7 +634,7 @@ Standard_Boolean ShapeCustom_BSplineRestriction::ConvertSurface(const Handle(Geo u2 = (aDelta > 2.*M_PI ? 2.*M_PI : u1 + aDelta); }*/ Standard_Boolean isTrim = Standard_False; - if(!aSurf->IsUPeriodic() ) { //else { + if(!aSurf->IsUPeriodic111() ) { //else { u1 = Max(u1,UF); u2 = Min(u2,UL); isTrim = Standard_True; } @@ -644,7 +644,7 @@ Standard_Boolean ShapeCustom_BSplineRestriction::ConvertSurface(const Handle(Geo v1 = (aDelta > 2.*M_PI ? 0. : VF + ShapeAnalysis::AdjustByPeriod(VF,0.5*(UL+UF),2*M_PI)); ; v2 = (aDelta > 2.*M_PI ? 2.* M_PI : v1 + aDelta); }*/ - if(!aSurf->IsVPeriodic()) {//else + if(!aSurf->IsVPeriodic111()) {//else v1 = Max(v1,VF); v2 = Min(v2,VL); isTrim = Standard_True; } @@ -691,9 +691,9 @@ Standard_Boolean ShapeCustom_BSplineRestriction::ConvertSurface(const Handle(Geo #endif S = anApprox.Surface(); Handle(Geom_BSplineSurface) Bsc = Handle(Geom_BSplineSurface)::DownCast(S); - if(aSurface->IsUPeriodic() ) + if(aSurface->IsUPeriodic111() ) Bsc->SetUPeriodic(); - if(aSurface->IsVPeriodic() ) + if(aSurface->IsVPeriodic111() ) Bsc->SetVPeriodic(); //Standard_Integer DegU = Bsc->UDegree(); // DegU not used (skl) //Standard_Integer DegV = Bsc->VDegree(); // DegV not used (skl) diff --git a/src/ShapeCustom/ShapeCustom_Surface.cxx b/src/ShapeCustom/ShapeCustom_Surface.cxx index 9085d63a35..f78da32a4d 100644 --- a/src/ShapeCustom/ShapeCustom_Surface.cxx +++ b/src/ShapeCustom/ShapeCustom_Surface.cxx @@ -403,7 +403,7 @@ Handle(Geom_Surface) ShapeCustom_Surface::ConvertToPeriodic (const Standard_Bool Standard_Boolean converted = Standard_False; //:p6 - if ( uclosed && ! BSpl->IsUPeriodic() && BSpl->NbUPoles() >3 ) { + if ( uclosed && ! BSpl->IsUPeriodic111() && BSpl->NbUPoles() >3 ) { Standard_Boolean set = Standard_True; // if degree+1 at ends, first change it to 1 by rearranging knots if ( BSpl->UMultiplicity(1) == BSpl->UDegree() + 1 && @@ -444,7 +444,7 @@ Handle(Geom_Surface) ShapeCustom_Surface::ConvertToPeriodic (const Standard_Bool newUKnots,oldVKnots, newUMults,oldVMults, BSpl->UDegree(),BSpl->VDegree(), - BSpl->IsUPeriodic(),BSpl->IsVPeriodic()); + BSpl->IsUPeriodic111(),BSpl->IsVPeriodic111()); BSpl = res; } else if ( BSpl->UMultiplicity(1) > BSpl->UDegree() || @@ -455,7 +455,7 @@ Handle(Geom_Surface) ShapeCustom_Surface::ConvertToPeriodic (const Standard_Bool } } - if ( vclosed && ! BSpl->IsVPeriodic() && BSpl->NbVPoles() >3 ) { + if ( vclosed && ! BSpl->IsVPeriodic111() && BSpl->NbVPoles() >3 ) { Standard_Boolean set = Standard_True; // if degree+1 at ends, first change it to 1 by rearranging knots if ( BSpl->VMultiplicity(1) == BSpl->VDegree() + 1 && @@ -496,7 +496,7 @@ Handle(Geom_Surface) ShapeCustom_Surface::ConvertToPeriodic (const Standard_Bool oldUKnots,newVKnots, oldUMults,newVMults, BSpl->UDegree(),BSpl->VDegree(), - BSpl->IsUPeriodic(),BSpl->IsVPeriodic()); + BSpl->IsUPeriodic111(),BSpl->IsVPeriodic111()); BSpl = res; } else if ( BSpl->VMultiplicity(1) > BSpl->VDegree() || diff --git a/src/ShapeExtend/ShapeExtend_CompositeSurface.cxx b/src/ShapeExtend/ShapeExtend_CompositeSurface.cxx index c493274dba..dd4739e9d4 100644 --- a/src/ShapeExtend/ShapeExtend_CompositeSurface.cxx +++ b/src/ShapeExtend/ShapeExtend_CompositeSurface.cxx @@ -526,7 +526,7 @@ void ShapeExtend_CompositeSurface::Bounds(Standard_Real& U1, //purpose : //======================================================================= -Standard_Boolean ShapeExtend_CompositeSurface::IsUPeriodic () const +Standard_Boolean ShapeExtend_CompositeSurface::IsUPeriodic111 () const { return Standard_False; } @@ -536,7 +536,7 @@ Standard_Boolean ShapeExtend_CompositeSurface::IsUPeriodic () const //purpose : //======================================================================= -Standard_Boolean ShapeExtend_CompositeSurface::IsVPeriodic () const +Standard_Boolean ShapeExtend_CompositeSurface::IsVPeriodic111 () const { return Standard_False; } diff --git a/src/ShapeExtend/ShapeExtend_CompositeSurface.hxx b/src/ShapeExtend/ShapeExtend_CompositeSurface.hxx index f30d083ccf..38f549a951 100644 --- a/src/ShapeExtend/ShapeExtend_CompositeSurface.hxx +++ b/src/ShapeExtend/ShapeExtend_CompositeSurface.hxx @@ -240,10 +240,10 @@ public: Standard_EXPORT virtual Standard_Boolean IsVClosed() const Standard_OVERRIDE; //! Returns False - Standard_EXPORT virtual Standard_Boolean IsUPeriodic() const Standard_OVERRIDE; + Standard_EXPORT virtual Standard_Boolean IsUPeriodic111() const Standard_OVERRIDE; //! Returns False - Standard_EXPORT virtual Standard_Boolean IsVPeriodic() const Standard_OVERRIDE; + Standard_EXPORT virtual Standard_Boolean IsVPeriodic111() const Standard_OVERRIDE; //! NOT IMPLEMENTED (returns Null curve) Standard_EXPORT virtual Handle(Geom_Curve) UIso (const Standard_Real U) const Standard_OVERRIDE; diff --git a/src/ShapeFix/ShapeFix_ComposeShell.cxx b/src/ShapeFix/ShapeFix_ComposeShell.cxx index f3fc0cab5f..24901e88c0 100644 --- a/src/ShapeFix/ShapeFix_ComposeShell.cxx +++ b/src/ShapeFix/ShapeFix_ComposeShell.cxx @@ -540,7 +540,7 @@ void ShapeFix_ComposeShell::LoadWires (ShapeFix_SequenceOfWireSegment &seqw) con sfw->Load ( sbwdM ); Standard_Integer stat=0; Handle(Geom_Surface) gs = BRep_Tool::Surface(myFace); - if( gs->IsUPeriodic() && gs->IsVPeriodic() ) + if( gs->IsUPeriodic111() && gs->IsVPeriodic111() ) { // For torus-like shapes, first reorder in 2d since reorder is indifferent in 3d ShapeAnalysis_WireOrder sawo(Standard_False, 0); diff --git a/src/ShapeFix/ShapeFix_EdgeProjAux.cxx b/src/ShapeFix/ShapeFix_EdgeProjAux.cxx index 5b2fb486fa..2cf5821086 100644 --- a/src/ShapeFix/ShapeFix_EdgeProjAux.cxx +++ b/src/ShapeFix/ShapeFix_EdgeProjAux.cxx @@ -414,7 +414,7 @@ void ShapeFix_EdgeProjAux::Init2d (const Standard_Real preci) if(fabs(w1 - w2) < Precision::PConfusion()) { - if(!theSurface->IsUPeriodic() && !theSurface->IsVPeriodic()) + if(!theSurface->IsUPeriodic111() && !theSurface->IsVPeriodic111()) return; } @@ -444,7 +444,7 @@ void ShapeFix_EdgeProjAux::Init2d (const Standard_Real preci) if(parU || parV) { Standard_Real uf,ul,vf,vl; theSurface->Bounds(uf,ul,vf,vl); - Standard_Real period = (parU ? ul-uf : vl-vf); + Standard_Real period = (parU ? theSurface->UPeriod() : theSurface->VPeriod()); w1+=ShapeAnalysis::AdjustToPeriod(w1,0,period); myFirstParam = w1; w2+=ShapeAnalysis::AdjustToPeriod(w2,0,period); diff --git a/src/ShapeFix/ShapeFix_Face.cxx b/src/ShapeFix/ShapeFix_Face.cxx index 9ebadf5504..65dede69f9 100644 --- a/src/ShapeFix/ShapeFix_Face.cxx +++ b/src/ShapeFix/ShapeFix_Face.cxx @@ -120,7 +120,7 @@ static Standard_Boolean IsSurfaceUVInfinite(const Handle(Geom_Surface)& theSurf) static Standard_Boolean IsSurfaceUVPeriodic(const Handle(Geom_Surface)& theSurf) { - return theSurf->IsUPeriodic() && theSurf->IsVPeriodic(); + return theSurf->IsUPeriodic111() && theSurf->IsVPeriodic111(); } //======================================================================= @@ -1499,7 +1499,7 @@ Standard_Boolean ShapeFix_Face::FixMissingSeam() //%pdn: surface should be made periodic before (see ShapeCustom_Surface)! if (mySurf->Surface()->IsKind(STANDARD_TYPE (Geom_BSplineSurface))) { Handle (Geom_BSplineSurface) BSpl = Handle (Geom_BSplineSurface)::DownCast (mySurf->Surface()); - if (!BSpl->IsUPeriodic() && !BSpl->IsVPeriodic()) + if (!BSpl->IsUPeriodic111() && !BSpl->IsVPeriodic111()) return Standard_False; } diff --git a/src/ShapeFix/ShapeFix_Wire.cxx b/src/ShapeFix/ShapeFix_Wire.cxx index 92141c559a..425b998d72 100644 --- a/src/ShapeFix/ShapeFix_Wire.cxx +++ b/src/ShapeFix/ShapeFix_Wire.cxx @@ -449,8 +449,8 @@ Standard_Boolean ShapeFix_Wire::FixReorder() Standard_Boolean isReorder = Standard_False; if ( sawo.Status() != 0 && ! myAnalyzer->Surface().IsNull() && - myAnalyzer->Surface()->Surface()->IsUPeriodic() && - myAnalyzer->Surface()->Surface()->IsVPeriodic() ) { + myAnalyzer->Surface()->Surface()->IsUPeriodic111() && + myAnalyzer->Surface()->Surface()->IsVPeriodic111() ) { Handle(ShapeExtend_WireData) sbwd2 = new ShapeExtend_WireData; for ( Standard_Integer i=WireData()->NbEdges(); i >=1; i-- ) sbwd2->Add ( WireData()->Edge(i) ); @@ -1375,6 +1375,10 @@ Standard_Boolean ShapeFix_Wire::FixShifted() Standard_Real VRange = 1.; if (surf->Surface()->IsKind(STANDARD_TYPE(Geom_SurfaceOfRevolution))) { + //! Issue #29115. Surface of revolution is considered to be V-periodic + //! if and only if its basis curve is periodic and closed simultaneously. + //! Therefore, we need to keep this complex check for the given specific algorithm. + Handle(Geom_SurfaceOfRevolution) aSurOfRev = Handle(Geom_SurfaceOfRevolution)::DownCast(surf->Surface()); Handle(Geom_Curve) aBaseCrv = aSurOfRev->BasisCurve(); while ((aBaseCrv->IsKind(STANDARD_TYPE(Geom_OffsetCurve))) || diff --git a/src/ShapePersistent/ShapePersistent_Geom_Surface.cxx b/src/ShapePersistent/ShapePersistent_Geom_Surface.cxx index 3b7d39f0b1..4c2e1b3f6c 100644 --- a/src/ShapePersistent/ShapePersistent_Geom_Surface.cxx +++ b/src/ShapePersistent/ShapePersistent_Geom_Surface.cxx @@ -412,8 +412,8 @@ ShapePersistent_Geom_Surface::Translate(const Handle(Geom_BSplineSurface)& theSu Handle(pBSpline) aPpBS = new pBSpline; aPpBS->myURational = theSurf->IsURational(); aPpBS->myVRational = theSurf->IsVRational(); - aPpBS->myUPeriodic = theSurf->IsUPeriodic(); - aPpBS->myVPeriodic = theSurf->IsVPeriodic(); + aPpBS->myUPeriodic = theSurf->IsUPeriodic111(); + aPpBS->myVPeriodic = theSurf->IsVPeriodic111(); aPpBS->myUSpineDegree = theSurf->UDegree(); aPpBS->myVSpineDegree = theSurf->VDegree(); aPpBS->myPoles = StdLPersistent_HArray2::Translate("PColgp_HArray2OfPnt", theSurf->Poles()); diff --git a/src/ShapeUpgrade/ShapeUpgrade_FaceDivide.cxx b/src/ShapeUpgrade/ShapeUpgrade_FaceDivide.cxx index 9e6b94b939..cf2ce637be 100644 --- a/src/ShapeUpgrade/ShapeUpgrade_FaceDivide.cxx +++ b/src/ShapeUpgrade/ShapeUpgrade_FaceDivide.cxx @@ -136,12 +136,12 @@ Standard_Boolean ShapeUpgrade_FaceDivide::SplitSurface () // make little extension to ensure all pcurves fit inside new surface bounds Standard_Real aSUf, aSUl, aSVf, aSVl; surf->Bounds(aSUf, aSUl, aSVf, aSVl); - if (!surf->IsUPeriodic()) { + if (!surf->IsUPeriodic111()) { Standard_Real dU = (Ul - Uf) * 0.01; if (Uf > aSUf) Uf -= Min(dU, Uf - aSUf); if (Ul < aSUl) Ul += Min(dU, aSUl - Ul); } - if (!surf->IsVPeriodic()) { + if (!surf->IsVPeriodic111()) { Standard_Real dV = (Vl - Vf) * 0.01; if (Vf > aSVf) Vf -= Min(dV, Vf - aSVf); if (Vl < aSVl) Vl += Min(dV, aSVl - Vl); diff --git a/src/ShapeUpgrade/ShapeUpgrade_SplitSurface.cxx b/src/ShapeUpgrade/ShapeUpgrade_SplitSurface.cxx index 2aa1d06224..feb9e05c28 100644 --- a/src/ShapeUpgrade/ShapeUpgrade_SplitSurface.cxx +++ b/src/ShapeUpgrade/ShapeUpgrade_SplitSurface.cxx @@ -94,9 +94,9 @@ void ShapeUpgrade_SplitSurface::Init(const Handle(Geom_Surface)& S, const Standa Standard_Real U1,U2,V1,V2; mySurface->Bounds(U1,U2,V1,V2); Standard_Real precision = Precision::PConfusion(); - if ( mySurface->IsUPeriodic() && + if ( mySurface->IsUPeriodic111() && ULast - UFirst <= U2 - U1 + precision ) { U1 = UFirst; U2 = U1 + mySurface->UPeriod(); } - if ( mySurface->IsVPeriodic() && + if ( mySurface->IsVPeriodic111() && VLast - VFirst <= V2 - V1 + precision ) { V1 = VFirst; V2 = V1 + mySurface->VPeriod(); } Standard_Real UF,UL,VF,VL; if( UFirst > U2-precision || diff --git a/src/StepToTopoDS/StepToTopoDS_TranslateEdgeLoop.cxx b/src/StepToTopoDS/StepToTopoDS_TranslateEdgeLoop.cxx index b2b17747bc..2cbd8237ec 100644 --- a/src/StepToTopoDS/StepToTopoDS_TranslateEdgeLoop.cxx +++ b/src/StepToTopoDS/StepToTopoDS_TranslateEdgeLoop.cxx @@ -158,7 +158,7 @@ static void CheckPCurves (TopoDS_Wire& aWire, const TopoDS_Face& aFace, w2 = cf; } - if (w1 > w2 && mySurf->IsUPeriodic()) + if (w1 > w2 && mySurf->IsUPeriodic111() && mySurf->IsUClosed()) { Standard_Real u1,u2,v1,v2; mySurf->Bounds(u1,u2,v1,v2); diff --git a/src/TopOpeBRepBuild/TopOpeBRepBuild_CorrectFace2d.cxx b/src/TopOpeBRepBuild/TopOpeBRepBuild_CorrectFace2d.cxx index 3b00d39d9f..1c6d8557ce 100644 --- a/src/TopOpeBRepBuild/TopOpeBRepBuild_CorrectFace2d.cxx +++ b/src/TopOpeBRepBuild/TopOpeBRepBuild_CorrectFace2d.cxx @@ -231,7 +231,7 @@ TopOpeBRepBuild_CorrectFace2d::TopOpeBRepBuild_CorrectFace2d() // I. Is the surface periodic TopLoc_Location aLocF; Handle(Geom_Surface) Surf = BRep_Tool::Surface(myCopyFace, aLocF); - if (!(Surf->IsUPeriodic() || Surf->IsVPeriodic())) { + if (!(Surf->IsUPeriodic111() || Surf->IsVPeriodic111())) { myIsDone=Standard_True; myErrorStatus=4; return; @@ -239,7 +239,7 @@ TopOpeBRepBuild_CorrectFace2d::TopOpeBRepBuild_CorrectFace2d() //modified by NIZHNY-MZV Mon Apr 24 11:29:56 2000 //don't treat torus surfaces - if(Surf->IsUPeriodic() && Surf->IsVPeriodic()) { + if(Surf->IsUPeriodic111() && Surf->IsVPeriodic111()) { myIsDone=Standard_True; myErrorStatus=4; return; diff --git a/src/TopOpeBRepBuild/TopOpeBRepBuild_GridSS.cxx b/src/TopOpeBRepBuild/TopOpeBRepBuild_GridSS.cxx index 09aff158e1..17487789be 100644 --- a/src/TopOpeBRepBuild/TopOpeBRepBuild_GridSS.cxx +++ b/src/TopOpeBRepBuild/TopOpeBRepBuild_GridSS.cxx @@ -1039,7 +1039,7 @@ void TopOpeBRepBuild_Builder::SplitEvisoONperiodicF() if (!isface) continue; TopLoc_Location loc; const Handle(Geom_Surface)& S = BRep_Tool::Surface(TopoDS::Face(FOR),loc); - Standard_Boolean periodic = S->IsUPeriodic() || S->IsVPeriodic(); + Standard_Boolean periodic = S->IsUPeriodic111() || S->IsVPeriodic111(); if (!periodic) continue; TopoDS_Shape FF = FOR; FF.Orientation(TopAbs_FORWARD); diff --git a/src/TopOpeBRepBuild/TopOpeBRepBuild_Section.cxx b/src/TopOpeBRepBuild/TopOpeBRepBuild_Section.cxx index a64c565c0e..866c937a27 100644 --- a/src/TopOpeBRepBuild/TopOpeBRepBuild_Section.cxx +++ b/src/TopOpeBRepBuild/TopOpeBRepBuild_Section.cxx @@ -102,8 +102,8 @@ static Standard_Boolean FUN_periodicS(const TopoDS_Shape& F) static Standard_Boolean FUN_periodic(const TopoDS_Face& F,Standard_Boolean& uper,Standard_Boolean& vper) { const Handle(Geom_Surface)& su = BRep_Tool::Surface(F); - uper = su->IsUPeriodic(); - vper = su->IsVPeriodic(); + uper = su->IsUPeriodic111(); + vper = su->IsVPeriodic111(); Standard_Boolean per = (uper || vper); return per; } @@ -112,8 +112,8 @@ static Standard_Boolean FUN_onboundsper(const gp_Pnt2d& uv,const TopoDS_Face& F) { // 2d : const Handle(Geom_Surface)& su = BRep_Tool::Surface(F); - Standard_Boolean uclo = su->IsUPeriodic(); - Standard_Boolean vclo = su->IsVPeriodic(); + Standard_Boolean uclo = su->IsUPeriodic111(); + Standard_Boolean vclo = su->IsVPeriodic111(); if (!uclo && !vclo) return Standard_False; Standard_Real u1,u2,v1,v2; su->Bounds(u1,u2,v1,v2); diff --git a/src/TopOpeBRepDS/TopOpeBRepDS_BuildTool.cxx b/src/TopOpeBRepDS/TopOpeBRepDS_BuildTool.cxx index bb3dc34e24..f018420e67 100644 --- a/src/TopOpeBRepDS/TopOpeBRepDS_BuildTool.cxx +++ b/src/TopOpeBRepDS/TopOpeBRepDS_BuildTool.cxx @@ -1229,8 +1229,8 @@ void TopOpeBRepDS_BuildTool::PCurve(TopoDS_Shape& F, if (tran) { TopLoc_Location Loc; const Handle(Geom_Surface) Surf = BRep_Tool::Surface(FF,Loc); - Standard_Boolean isUperio = Surf->IsUPeriodic(); - Standard_Boolean isVperio = Surf->IsVPeriodic(); + Standard_Boolean isUperio = Surf->IsUPeriodic111(); + Standard_Boolean isVperio = Surf->IsVPeriodic111(); gp_Dir2d dir2d = line2d->Direction(); Standard_Real delta; if (isUperio && dir2d.IsParallel(gp::DX2d(),Precision::Angular())) { diff --git a/src/TopOpeBRepTool/TopOpeBRepTool_2d.cxx b/src/TopOpeBRepTool/TopOpeBRepTool_2d.cxx index b131f9a7de..b5037dbe3d 100644 --- a/src/TopOpeBRepTool/TopOpeBRepTool_2d.cxx +++ b/src/TopOpeBRepTool/TopOpeBRepTool_2d.cxx @@ -287,7 +287,7 @@ static void FC2D_translate(Handle(Geom2d_Curve) C2D, const TopoDS_Edge& EF) { TopLoc_Location sloc; const Handle(Geom_Surface)& S1 = BRep_Tool::Surface(F,sloc); - Standard_Boolean isperio = S1->IsUPeriodic() || S1->IsVPeriodic(); + Standard_Boolean isperio = S1->IsUPeriodic111() || S1->IsVPeriodic111(); gp_Dir2d d2d; gp_Pnt2d O2d; Standard_Boolean isuiso,isviso; Standard_Boolean uviso = TopOpeBRepTool_TOOL::UVISO(C2D,isuiso,isviso,d2d,O2d); Standard_Boolean EFnull = EF.IsNull(); diff --git a/src/TopOpeBRepTool/TopOpeBRepTool_CurveTool.cxx b/src/TopOpeBRepTool/TopOpeBRepTool_CurveTool.cxx index 5f76fea777..59750a955e 100644 --- a/src/TopOpeBRepTool/TopOpeBRepTool_CurveTool.cxx +++ b/src/TopOpeBRepTool/TopOpeBRepTool_CurveTool.cxx @@ -198,22 +198,20 @@ static Standard_Boolean CheckPCurve // adjust domain for periodic surfaces TopLoc_Location aLoc; - Handle(Geom_Surface) aSurf = BRep_Tool::Surface(aFace, aLoc); - if (aSurf->IsKind(STANDARD_TYPE(Geom_RectangularTrimmedSurface))) - aSurf = (Handle(Geom_RectangularTrimmedSurface)::DownCast(aSurf))->BasisSurface(); + const Handle(Geom_Surface) &aSurf = BRep_Tool::Surface(aFace, aLoc); gp_Pnt2d pnt = aPC->Value((fp+lp)/2); Standard_Real u,v; pnt.Coord(u,v); - if (aSurf->IsUPeriodic()) { + if (aSurf->IsUPeriodic111()) { Standard_Real aPer = aSurf->UPeriod(); Standard_Integer nshift = (Standard_Integer) ((u-umin)/aPer); if (u < umin+aPer*nshift) nshift--; umin += aPer*nshift; umax += aPer*nshift; } - if (aSurf->IsVPeriodic()) { + if (aSurf->IsVPeriodic111()) { Standard_Real aPer = aSurf->VPeriod(); Standard_Integer nshift = (Standard_Integer) ((v-vmin)/aPer); if (v < vmin+aPer*nshift) nshift--; diff --git a/src/TopOpeBRepTool/TopOpeBRepTool_GEOMETRY.cxx b/src/TopOpeBRepTool/TopOpeBRepTool_GEOMETRY.cxx index ef4d4ee57f..2c354c6006 100644 --- a/src/TopOpeBRepTool/TopOpeBRepTool_GEOMETRY.cxx +++ b/src/TopOpeBRepTool/TopOpeBRepTool_GEOMETRY.cxx @@ -251,9 +251,9 @@ Standard_EXPORT Standard_Boolean FUN_tool_closed(const Handle(Geom_Surface)& S, { uperiod = vperiod = 0.; if (S.IsNull()) return Standard_False; - uclosed = S->IsUClosed(); if (uclosed) uclosed = S->IsUPeriodic(); //xpu261098 (BUC60382) + uclosed = S->IsUClosed(); if (uclosed) uclosed = S->IsUPeriodic111(); //xpu261098 (BUC60382) if (uclosed) uperiod = S->UPeriod(); - vclosed = S->IsVClosed(); if (vclosed) vclosed = S->IsVPeriodic(); + vclosed = S->IsVClosed(); if (vclosed) vclosed = S->IsVPeriodic111(); if (vclosed) vperiod = S->VPeriod(); Standard_Boolean closed = uclosed || vclosed; return closed; diff --git a/src/TopOpeBRepTool/TopOpeBRepTool_ShapeTool.cxx b/src/TopOpeBRepTool/TopOpeBRepTool_ShapeTool.cxx index 1055a5c277..6c4c454fc8 100644 --- a/src/TopOpeBRepTool/TopOpeBRepTool_ShapeTool.cxx +++ b/src/TopOpeBRepTool/TopOpeBRepTool_ShapeTool.cxx @@ -160,8 +160,8 @@ void TopOpeBRepTool_ShapeTool::UVBOUNDS } } else { - UPeriodic = BS->IsUPeriodic(); - VPeriodic = BS->IsVPeriodic(); + UPeriodic = BS->IsUPeriodic111(); + VPeriodic = BS->IsVPeriodic111(); BS->Bounds(Umin,Umax,Vmin,Vmax); } } @@ -191,8 +191,8 @@ void TopOpeBRepTool_ShapeTool::AdjustOnPeriodic(const TopoDS_Shape& F, // Standard_Real Ufirst,Ulast,Vfirst,Vlast; Standard_Boolean isUperio,isVperio; - isUperio = Surf->IsUPeriodic(); - isVperio = Surf->IsVPeriodic(); + isUperio = Surf->IsUPeriodic111(); + isVperio = Surf->IsVPeriodic111(); // exit if surface supporting F is not periodic on U or V if (!isUperio && !isVperio) return; @@ -307,8 +307,8 @@ Standard_Real TopOpeBRepTool_ShapeTool::PeriodizeParameter TopLoc_Location Loc; const Handle(Geom_Surface) Surf = BRep_Tool::Surface(F,Loc); - Standard_Boolean isUperio = Surf->IsUPeriodic(); - Standard_Boolean isVperio = Surf->IsVPeriodic(); + Standard_Boolean isUperio = Surf->IsUPeriodic111() && Surf->IsUClosed(); + Standard_Boolean isVperio = Surf->IsVPeriodic111() && Surf->IsVClosed(); if (!isUperio && !isVperio) return periopar; Standard_Real Ufirst,Ulast,Vfirst,Vlast; diff --git a/src/TopOpeBRepTool/TopOpeBRepTool_TOOL.cxx b/src/TopOpeBRepTool/TopOpeBRepTool_TOOL.cxx index 90add9ca4d..88f9766856 100644 --- a/src/TopOpeBRepTool/TopOpeBRepTool_TOOL.cxx +++ b/src/TopOpeBRepTool/TopOpeBRepTool_TOOL.cxx @@ -223,8 +223,8 @@ Standard_Boolean TopOpeBRepTool_TOOL::ClosedS(const TopoDS_Face& F) { Handle(Geom_Surface) S =TopOpeBRepTool_ShapeTool::BASISSURFACE(TopoDS::Face(F)); if (S.IsNull()) return Standard_False; - Standard_Boolean uclosed = S->IsUClosed(); if (uclosed) uclosed = S->IsUPeriodic(); - Standard_Boolean vclosed = S->IsVClosed(); if (vclosed) vclosed = S->IsVPeriodic(); + Standard_Boolean uclosed = S->IsUClosed(); if (uclosed) uclosed = S->IsUPeriodic111(); + Standard_Boolean vclosed = S->IsVClosed(); if (vclosed) vclosed = S->IsVPeriodic111(); return (uclosed || vclosed); } @@ -1136,7 +1136,7 @@ Standard_Boolean TopOpeBRepTool_TOOL::Getduv(const TopoDS_Face& f,const gp_Pnt2d gp_Vec2d DUV( uv, uvtr ); Handle(Geom_Surface) S = TopOpeBRepTool_ShapeTool::BASISSURFACE(f); - if ((S->IsUPeriodic()) && (Abs(DUV.X()) > S->UPeriod()/2.)) + if ((S->IsUPeriodic111()) && (Abs(DUV.X()) > S->UPeriod()/2.)) { Standard_Real U1 = uv.X(), U2 = uvtr.X(), period = S->UPeriod(); ElCLib::AdjustPeriodic( 0., period, Precision::PConfusion(), U1, U2 ); @@ -1145,7 +1145,7 @@ Standard_Boolean TopOpeBRepTool_TOOL::Getduv(const TopoDS_Face& f,const gp_Pnt2d dx -= period; DUV.SetX( dx ); } - if ((S->IsVPeriodic()) && (Abs(DUV.Y()) > S->VPeriod()/2.)) + if ((S->IsVPeriodic111()) && (Abs(DUV.Y()) > S->VPeriod()/2.)) { Standard_Real V1 = uv.Y(), V2 = uvtr.Y(), period = S->VPeriod(); ElCLib::AdjustPeriodic( 0., period, Precision::PConfusion(), V1, V2 ); -- 2.39.5