From: nbv Date: Wed, 25 Oct 2017 13:51:39 +0000 (+0300) Subject: Geom2d_TrimmedCurve X-Git-Url: http://git.dev.opencascade.org/gitweb/?a=commitdiff_plain;h=9c55cd84c99bda6f87cfdf8a2c264b3dad72ed8d;p=occt-copy.git Geom2d_TrimmedCurve --- diff --git a/src/Adaptor3d/Adaptor3d_CurveOnSurface.cxx b/src/Adaptor3d/Adaptor3d_CurveOnSurface.cxx index ebf7fa580c..b2dd23a2c5 100644 --- a/src/Adaptor3d/Adaptor3d_CurveOnSurface.cxx +++ b/src/Adaptor3d/Adaptor3d_CurveOnSurface.cxx @@ -1375,12 +1375,12 @@ Handle(Geom_BSplineCurve) Adaptor3d_CurveOnSurface::BSpline() const Bsp2d->Weights(Weights); Bsp = new Geom_BSplineCurve(Poles,Weights,Knots,Mults, Bsp2d->Degree(), - Bsp2d->IsPeriodic()); + Bsp2d->IsPeriodic111()); } else { Bsp = new Geom_BSplineCurve(Poles,Knots,Mults, Bsp2d->Degree(), - Bsp2d->IsPeriodic()); + Bsp2d->IsPeriodic111()); } return Bsp; } diff --git a/src/BRepBuilderAPI/BRepBuilderAPI_Sewing.cxx b/src/BRepBuilderAPI/BRepBuilderAPI_Sewing.cxx index 7d3db72134..4fe7976c4b 100644 --- a/src/BRepBuilderAPI/BRepBuilderAPI_Sewing.cxx +++ b/src/BRepBuilderAPI/BRepBuilderAPI_Sewing.cxx @@ -217,9 +217,9 @@ static Standard_Boolean IsClosedByIsos(const Handle(Geom_Surface)& thesurf, { Standard_Boolean isClosed = Standard_False; - gp_Pnt2d psurf1 = (acrv2d->IsPeriodic() ? + gp_Pnt2d psurf1 = (acrv2d->IsPeriodic111() ? acrv2d->Value(f2d) : acrv2d->Value(Max(f2d,acrv2d->FirstParameter()))); - gp_Pnt2d psurf2 = (acrv2d->IsPeriodic() ? + gp_Pnt2d psurf2 = (acrv2d->IsPeriodic111() ? acrv2d->Value(l2d) : acrv2d->Value(Min(l2d,acrv2d->LastParameter()))); Handle(Geom_Curve) aCrv1; Handle(Geom_Curve) aCrv2; diff --git a/src/BRepClass/BRepClass_Intersector.cxx b/src/BRepClass/BRepClass_Intersector.cxx index 847d877329..a47bb03a61 100644 --- a/src/BRepClass/BRepClass_Intersector.cxx +++ b/src/BRepClass/BRepClass_Intersector.cxx @@ -142,13 +142,6 @@ void BRepClass_Intersector::Perform(const gp_Lin2d& L, } IntRes2d_Domain DE(pdeb,deb,toldeb,pfin,fin,tolfin); - // temporary periodic domain - if (C.Curve()->IsPeriodic()) { - DE.SetEquivalentParameters(C.FirstParameter(), - C.FirstParameter() + - C.Curve()->LastParameter() - - C.Curve()->FirstParameter()); - } Handle(Geom2d_Line) GL= new Geom2d_Line(L); Geom2dAdaptor_Curve CGA(GL); diff --git a/src/BRepFill/BRepFill_OffsetWire.cxx b/src/BRepFill/BRepFill_OffsetWire.cxx index 876501e15e..dcb8715612 100644 --- a/src/BRepFill/BRepFill_OffsetWire.cxx +++ b/src/BRepFill/BRepFill_OffsetWire.cxx @@ -100,6 +100,7 @@ #include #include #include +#include #include #ifdef OCCT_DEBUG @@ -1292,14 +1293,8 @@ void BRepFill_OffsetWire::UpdateDetromp (BRepFill_DataMapOfOrientedShapeListOfSh TopoDS_Vertex V1,V2; const Handle(Geom2d_Curve)& Bis = Bisec.Value(); - Standard_Boolean ForceAdd = Standard_False; - Handle(Geom2d_TrimmedCurve) aTC = Handle(Geom2d_TrimmedCurve)::DownCast(Bis); - if(!aTC.IsNull() && aTC->BasisCurve()->IsPeriodic()) - { - gp_Pnt2d Pf = Bis->Value(Bis->FirstParameter()); - gp_Pnt2d Pl = Bis->Value(Bis->LastParameter()); - ForceAdd = Pf.Distance(Pl) <= Precision::Confusion(); - } + const Standard_Boolean ForceAdd = (Bis->IsPeriodic111() && + GeomLib::IsClosed(Bis, Precision::Confusion())); U1 = Bis->FirstParameter(); diff --git a/src/BRepLib/BRepLib.cxx b/src/BRepLib/BRepLib.cxx index f6006c5d38..defe660fba 100644 --- a/src/BRepLib/BRepLib.cxx +++ b/src/BRepLib/BRepLib.cxx @@ -1384,7 +1384,7 @@ TopoDS_Edge BRepLib::SameParameter(const TopoDS_Edge& theEdge, Geom2dConvert::C0BSplineToC1BSplineCurve(bs2d, Tol2d); isBSP = Standard_True; - if(bs2d->IsPeriodic()) { // -------- IFV, Jan 2000 + if(bs2d->IsPeriodic111()) { // -------- IFV, Jan 2000 gp_Pnt2d NewOriginPoint; bs2d->D0(bs2d->FirstParameter(), NewOriginPoint); if(Abs(OriginPoint.X() - NewOriginPoint.X()) > Precision::PConfusion() || @@ -1429,7 +1429,7 @@ TopoDS_Edge BRepLib::SameParameter(const TopoDS_Edge& theEdge, Geom2dConvert::C0BSplineToC1BSplineCurve(bs2d,Tol2dbail); - if(bs2d->IsPeriodic()) { // -------- IFV, Jan 2000 + if(bs2d->IsPeriodic111()) { // -------- IFV, Jan 2000 gp_Pnt2d NewOriginPoint; bs2d->D0(bs2d->FirstParameter(), NewOriginPoint); if(Abs(OriginPoint.X() - NewOriginPoint.X()) > Precision::PConfusion() || diff --git a/src/BRepLib/BRepLib_MakeEdge.cxx b/src/BRepLib/BRepLib_MakeEdge.cxx index 6a3d8d52d6..c733c24b31 100644 --- a/src/BRepLib/BRepLib_MakeEdge.cxx +++ b/src/BRepLib/BRepLib_MakeEdge.cxx @@ -1059,7 +1059,7 @@ void BRepLib_MakeEdge::Init(const Handle(Geom2d_Curve)& CC, Standard_Real cf = C->FirstParameter(); Standard_Real cl = C->LastParameter(); Standard_Real epsilon = Precision::PConfusion(); - Standard_Boolean periodic = C->IsPeriodic(); + Standard_Boolean periodic = C->IsPeriodic111(); TopoDS_Vertex V1,V2; diff --git a/src/BRepLib/BRepLib_MakeEdge2d.cxx b/src/BRepLib/BRepLib_MakeEdge2d.cxx index f04af3e5a8..7a143f1526 100644 --- a/src/BRepLib/BRepLib_MakeEdge2d.cxx +++ b/src/BRepLib/BRepLib_MakeEdge2d.cxx @@ -594,7 +594,7 @@ void BRepLib_MakeEdge2d::Init(const Handle(Geom2d_Curve)& CC, Standard_Real cf = C->FirstParameter(); Standard_Real cl = C->LastParameter(); Standard_Real epsilon = Precision::Confusion(); - Standard_Boolean periodic = C->IsPeriodic(); + Standard_Boolean periodic = C->IsPeriodic111(); TopoDS_Vertex V1,V2; diff --git a/src/BRepOffset/BRepOffset_Inter2d.cxx b/src/BRepOffset/BRepOffset_Inter2d.cxx index 8d4d0c83c3..7f933e4533 100644 --- a/src/BRepOffset/BRepOffset_Inter2d.cxx +++ b/src/BRepOffset/BRepOffset_Inter2d.cxx @@ -951,6 +951,9 @@ void BRepOffset_Inter2d::ExtentEdge(const TopoDS_Edge& E,TopoDS_Edge& NE, const if (theCurve->IsKind(STANDARD_TYPE(Geom2d_BoundedCurve)) && (FirstPar > anEf - a2Offset || LastPar < anEl + a2Offset)) { + // Trimmed curves or periodic B-spline curves are processed + // in this branch. + Handle(Geom2d_Curve) NewPCurve; if (ExtendPCurve(theCurve, anEf, anEl, a2Offset, NewPCurve)) { @@ -965,7 +968,7 @@ void BRepOffset_Inter2d::ExtentEdge(const TopoDS_Edge& E,TopoDS_Edge& NE, const } } } - else if (theCurve->IsPeriodic()) + else if (theCurve->IsPeriodic111()) { Standard_Real delta = (theCurve->Period() - (anEl - anEf))*0.5; delta *= 0.95; diff --git a/src/BRepTools/BRepTools.cxx b/src/BRepTools/BRepTools.cxx index 7572bdc0e8..291b4161cb 100644 --- a/src/BRepTools/BRepTools.cxx +++ b/src/BRepTools/BRepTools.cxx @@ -1025,7 +1025,7 @@ Standard_Real BRepTools::EvalAndUpdateTol(const TopoDS_Edge& theE, first = Max(first, C3d->FirstParameter()); last = Min(last, C3d->LastParameter()); } - if(!C2d->IsPeriodic()) + if(!C2d->IsPeriodic111()) { first = Max(first, C2d->FirstParameter()); last = Min(last, C2d->LastParameter()); @@ -1040,7 +1040,7 @@ Standard_Real BRepTools::EvalAndUpdateTol(const TopoDS_Edge& theE, else { if(CT.ErrorStatus() == 3 || (CT.ErrorStatus() == 2 && - (C3d->IsPeriodic() || C2d->IsPeriodic()))) + (C3d->IsPeriodic() || C2d->IsPeriodic111()))) { //Try to estimate by sample points Standard_Integer nbint = 22; diff --git a/src/BRepTools/BRepTools.hxx b/src/BRepTools/BRepTools.hxx index e6bc4b5db6..36b9d0a048 100644 --- a/src/BRepTools/BRepTools.hxx +++ b/src/BRepTools/BRepTools.hxx @@ -212,7 +212,7 @@ public: //! Evals real tolerance of edge . //! , , , , are - //! correspondently 3d curve of edge, 2d curve on surface and + //! correspondingly 3d curve of edge, 2d curve on surface and //! rang of edge //! If calculated tolerance is more then current edge tolerance, edge is updated. //! Method returns actual tolerance of edge diff --git a/src/BRepTools/BRepTools_NurbsConvertModification.cxx b/src/BRepTools/BRepTools_NurbsConvertModification.cxx index 1a8de56f7e..ff537180be 100644 --- a/src/BRepTools/BRepTools_NurbsConvertModification.cxx +++ b/src/BRepTools/BRepTools_NurbsConvertModification.cxx @@ -388,7 +388,7 @@ Standard_Boolean BRepTools_NurbsConvertModification::NewCurve2d Standard_Real fc = C2d->FirstParameter(), lc = C2d->LastParameter(); - if(!C2d->IsPeriodic()) { + if(!C2d->IsPeriodic111()) { if(fc - f2d > Precision::PConfusion()) f2d = fc; if(l2d - lc > Precision::PConfusion()) l2d = lc; } diff --git a/src/BRepTools/BRepTools_TrsfModification.cxx b/src/BRepTools/BRepTools_TrsfModification.cxx index 6bc92499cd..1afca5c80b 100644 --- a/src/BRepTools/BRepTools_TrsfModification.cxx +++ b/src/BRepTools/BRepTools_TrsfModification.cxx @@ -177,7 +177,7 @@ Standard_Boolean BRepTools_TrsfModification::NewCurve2d Standard_Real fc = NewC->FirstParameter(), lc = NewC->LastParameter(); - if(!NewC->IsPeriodic()) { + if(!NewC->IsPeriodic111()) { if(fc - f > Precision::PConfusion()) f = fc; if(l - lc > Precision::PConfusion()) l = lc; if(Abs(l - f) < Precision::PConfusion()) diff --git a/src/BinTools/BinTools_Curve2dSet.cxx b/src/BinTools/BinTools_Curve2dSet.cxx index 0f34bf736c..c93de1cf2f 100644 --- a/src/BinTools/BinTools_Curve2dSet.cxx +++ b/src/BinTools/BinTools_Curve2dSet.cxx @@ -239,7 +239,7 @@ static Standard_OStream& operator <<(Standard_OStream& OS, const Handle(Geom2d_B OS << (Standard_Byte)BSPLINE; Standard_Boolean aRational = B->IsRational() ? 1:0; BinTools::PutBool(OS, aRational); //rational - Standard_Boolean aPeriodic = B->IsPeriodic() ? 1:0; + Standard_Boolean aPeriodic = B->IsPeriodic111() ? 1:0; BinTools::PutBool(OS, aPeriodic); //periodic // poles and weights Standard_Integer i,aDegree,aNbPoles,aNbKnots; diff --git a/src/Bisector/Bisector_BisecAna.cxx b/src/Bisector/Bisector_BisecAna.cxx index 6e5330d7ec..dd8c6e644d 100644 --- a/src/Bisector/Bisector_BisecAna.cxx +++ b/src/Bisector/Bisector_BisecAna.cxx @@ -1396,9 +1396,9 @@ Standard_Boolean Bisector_BisecAna::IsClosed() const //function : IsPeriodic //purpose : //============================================================================= -Standard_Boolean Bisector_BisecAna::IsPeriodic() const +Standard_Boolean Bisector_BisecAna::IsPeriodic111() const { - return thebisector->BasisCurve()->IsPeriodic(); + return thebisector->IsPeriodic111(); } //============================================================================= diff --git a/src/Bisector/Bisector_BisecAna.hxx b/src/Bisector/Bisector_BisecAna.hxx index fbc0b8a21d..a63bafd7ea 100644 --- a/src/Bisector/Bisector_BisecAna.hxx +++ b/src/Bisector/Bisector_BisecAna.hxx @@ -104,7 +104,7 @@ public: Standard_EXPORT Standard_Boolean IsClosed() const Standard_OVERRIDE; - Standard_EXPORT Standard_Boolean IsPeriodic() const Standard_OVERRIDE; + Standard_EXPORT Standard_Boolean IsPeriodic111() const Standard_OVERRIDE; Standard_EXPORT GeomAbs_Shape Continuity() const Standard_OVERRIDE; diff --git a/src/Bisector/Bisector_BisecCC.cxx b/src/Bisector/Bisector_BisecCC.cxx index 3689f9e92e..6bbcd13c1e 100644 --- a/src/Bisector/Bisector_BisecCC.cxx +++ b/src/Bisector/Bisector_BisecCC.cxx @@ -540,7 +540,7 @@ Standard_Boolean Bisector_BisecCC::IsClosed() const //function : IsPeriodic //purpose : //============================================================================= -Standard_Boolean Bisector_BisecCC::IsPeriodic() const +Standard_Boolean Bisector_BisecCC::IsPeriodic111() const { return Standard_False; } diff --git a/src/Bisector/Bisector_BisecCC.hxx b/src/Bisector/Bisector_BisecCC.hxx index 8340c0f76c..b66bd53931 100644 --- a/src/Bisector/Bisector_BisecCC.hxx +++ b/src/Bisector/Bisector_BisecCC.hxx @@ -127,7 +127,7 @@ public: Standard_EXPORT Standard_Boolean IsClosed() const Standard_OVERRIDE; - Standard_EXPORT Standard_Boolean IsPeriodic() const Standard_OVERRIDE; + Standard_EXPORT Standard_Boolean IsPeriodic111() const Standard_OVERRIDE; //! Returns the point of parameter U. //! Computes the distance between the current point and diff --git a/src/Bisector/Bisector_BisecPC.cxx b/src/Bisector/Bisector_BisecPC.cxx index ad03ff2cef..915fbb224e 100644 --- a/src/Bisector/Bisector_BisecPC.cxx +++ b/src/Bisector/Bisector_BisecPC.cxx @@ -313,7 +313,7 @@ Standard_Boolean Bisector_BisecPC::IsClosed() const //function : IsPeriodic //purpose : //============================================================================= -Standard_Boolean Bisector_BisecPC::IsPeriodic() const +Standard_Boolean Bisector_BisecPC::IsPeriodic111() const { return Standard_False; } @@ -703,11 +703,11 @@ void Bisector_BisecPC::ComputeIntervals () //------------------------------------------------------------------------ // Eventual offset of the parameter on the curve correspondingly to the one // on the curve. The offset can be done if the curve is periodical and the - // point of initial parameter is less then the interval of continuity. + // point of initial parameter is less than the interval of continuity. //------------------------------------------------------------------------ - if (curve->IsPeriodic()) { + if (curve->IsPeriodic111()) { if (startIntervals.Length() > 1) { // Plusieurs intervals. - if (endIntervals .Last() == curve->LastParameter() && + if (endIntervals.Last() == curve->LastParameter() && startIntervals.First() == curve->FirstParameter() ) { //--------------------------------------------------------------- // the bissectrice is defined at the origin. @@ -716,7 +716,7 @@ void Bisector_BisecPC::ComputeIntervals () // => offset of parameter on all limits of intervals. //--------------------------------------------------------------- startIntervals.Remove(1); - endIntervals .Remove(endIntervals.Length()); + endIntervals.Remove(endIntervals.Length()); shiftParameter = Period() - startIntervals.First() ; for (Standard_Integer k = 1; k <= startIntervals.Length(); k++) { diff --git a/src/Bisector/Bisector_BisecPC.hxx b/src/Bisector/Bisector_BisecPC.hxx index a748e7e4f5..096cba1926 100644 --- a/src/Bisector/Bisector_BisecPC.hxx +++ b/src/Bisector/Bisector_BisecPC.hxx @@ -132,7 +132,7 @@ public: Standard_EXPORT Standard_Boolean IsClosed() const Standard_OVERRIDE; - Standard_EXPORT Standard_Boolean IsPeriodic() const Standard_OVERRIDE; + Standard_EXPORT Standard_Boolean IsPeriodic111() const Standard_OVERRIDE; //! Returns the distance between the point of //! parameter U on and my point or my curve. diff --git a/src/ChFi2d/ChFi2d_FilletAlgo.cxx b/src/ChFi2d/ChFi2d_FilletAlgo.cxx index 0eff8be730..b4524533a8 100644 --- a/src/ChFi2d/ChFi2d_FilletAlgo.cxx +++ b/src/ChFi2d/ChFi2d_FilletAlgo.cxx @@ -116,16 +116,22 @@ void ChFi2d_FilletAlgo::Init(const TopoDS_Edge& theEdge1, myEdge2 = theEdge2; } + // Trimmed curve cannot be returned Handle(Geom_Curve) aCurve1 = BRep_Tool::Curve(myEdge1, myStart1, myEnd1); Handle(Geom_Curve) aCurve2 = BRep_Tool::Curve(myEdge2, myStart2, myEnd2); myCurve1 = GeomProjLib::Curve2d(aCurve1, myStart1, myEnd1, myPlane); myCurve2 = GeomProjLib::Curve2d(aCurve2, myStart2, myEnd2, myPlane); - while (myCurve1->IsPeriodic() && myStart1 >= myEnd1) - myEnd1 += myCurve1->Period(); - while (myCurve2->IsPeriodic() && myStart2 >= myEnd2) - myEnd2 += myCurve2->Period(); + if(myCurve1->IsPeriodic111() && myStart1 >= myEnd1) + { + myEnd1 = ElCLib::InPeriod(myEnd1, myStart1, myStart1 + myCurve1->Period()); + } + + if(myCurve2->IsPeriodic111() && myStart2 >= myEnd2) + { + myEnd2 = ElCLib::InPeriod(myEnd2, myStart2, myStart2 + myCurve2->Period()); + } if (aBAC1.GetType() == aBAC2.GetType()) { @@ -267,8 +273,10 @@ void ChFi2d_FilletAlgo::FillPoint(FilletPoint* thePoint, const Standard_Real the // checking the right parameter Standard_Real aParamProj = aProj.Parameter(a); - while(myCurve2->IsPeriodic() && aParamProj < myStart2) - aParamProj += myCurve2->Period(); + if(myCurve2->IsPeriodic111() && aParamProj < myStart2) + { + aParamProj = ElCLib::InPeriod(aParamProj, myStart2, myStart2 + myCurve2->Period()); + } const Standard_Real d = aProj.Distance(a); thePoint->appendValue(d * d - myRadius * myRadius, (aParamProj >= myStart2 && aParamProj <= myEnd2 && aValid2)); diff --git a/src/ChFi3d/ChFi3d_Builder_0.cxx b/src/ChFi3d/ChFi3d_Builder_0.cxx index 1d92766f8e..aed6ab9543 100644 --- a/src/ChFi3d/ChFi3d_Builder_0.cxx +++ b/src/ChFi3d/ChFi3d_Builder_0.cxx @@ -983,13 +983,19 @@ Standard_Boolean ChFi3d_IntTraces(const Handle(ChFiDS_SurfData)& fd1, if(enlarge) delta = Min(0.1,0.05*(last-first)); Handle(Geom2d_Curve) pcf1 = fd1->Interference(jf1).PCurveOnFace(); if(pcf1.IsNull()) return Standard_False; - Standard_Boolean isper1 = pcf1->IsPeriodic(); - if(isper1) { + Standard_Boolean isper1 = pcf1->IsPeriodic111(); + if(isper1) + { + // Extract basis curve to obtain its First and Last parameters. Handle(Geom2d_TrimmedCurve) tr1 = Handle(Geom2d_TrimmedCurve)::DownCast(pcf1); if(!tr1.IsNull()) pcf1 = tr1->BasisCurve(); C1.Load(pcf1); } - else C1.Load(pcf1,first-delta,last+delta); + else + { + C1.Load(pcf1, first - delta, last + delta); + } + Standard_Real first1 = pcf1->FirstParameter(), last1 = pcf1->LastParameter(); first = fd2->Interference(jf2).FirstParameter(); @@ -999,13 +1005,19 @@ Standard_Boolean ChFi3d_IntTraces(const Handle(ChFiDS_SurfData)& fd1, if(enlarge) delta = Min(0.1,0.05*(last-first)); Handle(Geom2d_Curve) pcf2 = fd2->Interference(jf2).PCurveOnFace(); if(pcf2.IsNull()) return Standard_False; - Standard_Boolean isper2 = pcf2->IsPeriodic(); - if(isper2) { + Standard_Boolean isper2 = pcf2->IsPeriodic111(); + if(isper2) + { + // Extract basis curve to obtain its First and Last parameters. Handle(Geom2d_TrimmedCurve) tr2 = Handle(Geom2d_TrimmedCurve)::DownCast(pcf2); if(!tr2.IsNull()) pcf2 = tr2->BasisCurve(); C2.Load(pcf2); } - else C2.Load(fd2->Interference(jf2).PCurveOnFace(),first-delta,last+delta); + else + { + C2.Load(pcf2, first - delta, last + delta); + } + Standard_Real first2 = pcf2->FirstParameter(), last2 = pcf2->LastParameter(); IntRes2d_IntersectionPoint int2d; diff --git a/src/ChFi3d/ChFi3d_Builder_C1.cxx b/src/ChFi3d/ChFi3d_Builder_C1.cxx index b63ad08337..621d34ed30 100644 --- a/src/ChFi3d/ChFi3d_Builder_C1.cxx +++ b/src/ChFi3d/ChFi3d_Builder_C1.cxx @@ -384,9 +384,10 @@ static Standard_Boolean Update(const Handle(Adaptor3d_HSurface)& face, if (!PConF.IsNull()) { Handle(Geom2d_TrimmedCurve) aTrCurve = Handle(Geom2d_TrimmedCurve)::DownCast(PConF); + // Extract basis curve to obtain its first/last parameters. if (!aTrCurve.IsNull()) PConF = aTrCurve->BasisCurve(); - if (!PConF->IsPeriodic()) + if (!PConF->IsPeriodic111()) { if (isfirst) { diff --git a/src/DBRep/DBRep_IsoBuilder.cxx b/src/DBRep/DBRep_IsoBuilder.cxx index f02475cfcb..465483486d 100644 --- a/src/DBRep/DBRep_IsoBuilder.cxx +++ b/src/DBRep/DBRep_IsoBuilder.cxx @@ -138,7 +138,7 @@ Geom2dHatch_Hatcher (Geom2dHatch_Intersector (IntersectorConfusion, } else { - if (!PCurve->IsPeriodic()) + if (!PCurve->IsPeriodic111()) { Handle (Geom2d_TrimmedCurve) TrimPCurve = Handle(Geom2d_TrimmedCurve)::DownCast (PCurve); if (!TrimPCurve.IsNull()) diff --git a/src/DrawTrSurf/DrawTrSurf_BSplineCurve2d.cxx b/src/DrawTrSurf/DrawTrSurf_BSplineCurve2d.cxx index 814e3ebf9f..7814e3300f 100644 --- a/src/DrawTrSurf/DrawTrSurf_BSplineCurve2d.cxx +++ b/src/DrawTrSurf/DrawTrSurf_BSplineCurve2d.cxx @@ -71,7 +71,7 @@ void DrawTrSurf_BSplineCurve2d::DrawOn (Draw_Display& dis) const for (Standard_Integer i = 2; i <= NbPoles; i++) { dis.DrawTo(CPoles(i)); } - if (C->IsPeriodic()) + if (C->IsPeriodic111() && C->IsClosed()) dis.DrawTo(CPoles(1)); } diff --git a/src/Geom2d/Geom2d_BSplineCurve.cxx b/src/Geom2d/Geom2d_BSplineCurve.cxx index b4cc7df96e..749049dd69 100644 --- a/src/Geom2d/Geom2d_BSplineCurve.cxx +++ b/src/Geom2d/Geom2d_BSplineCurve.cxx @@ -1185,7 +1185,7 @@ MovePointAndTangent(const Standard_Real U, Standard_Integer& ErrorStatus) { Standard_Integer ii ; - if (IsPeriodic()) { + if (IsPeriodic111()) { // // for the time being do not deal with periodic curves // diff --git a/src/Geom2d/Geom2d_BSplineCurve.hxx b/src/Geom2d/Geom2d_BSplineCurve.hxx index 948a01f849..4823c9651d 100644 --- a/src/Geom2d/Geom2d_BSplineCurve.hxx +++ b/src/Geom2d/Geom2d_BSplineCurve.hxx @@ -537,7 +537,7 @@ public: Standard_EXPORT Standard_Boolean IsClosed() const Standard_OVERRIDE; //! Returns True if the curve is periodic. - Standard_EXPORT Standard_Boolean IsPeriodic() const Standard_OVERRIDE; + Standard_EXPORT Standard_Boolean IsPeriodic111() const Standard_OVERRIDE; //! Returns True if the weights are not identical. diff --git a/src/Geom2d/Geom2d_BSplineCurve_1.cxx b/src/Geom2d/Geom2d_BSplineCurve_1.cxx index a4142a5b2f..1f5f5a9310 100644 --- a/src/Geom2d/Geom2d_BSplineCurve_1.cxx +++ b/src/Geom2d/Geom2d_BSplineCurve_1.cxx @@ -113,7 +113,7 @@ Standard_Boolean Geom2d_BSplineCurve::IsG1 ( const Standard_Real theTf, return Standard_False; } - if(!IsPeriodic()) + if(!IsPeriodic111()) return Standard_True; const Standard_Real aFirstParam = FirstParameter(), @@ -164,7 +164,7 @@ Standard_Boolean Geom2d_BSplineCurve::IsClosed () const //purpose : //======================================================================= -Standard_Boolean Geom2d_BSplineCurve::IsPeriodic () const +Standard_Boolean Geom2d_BSplineCurve::IsPeriodic111 () const { return periodic; } //======================================================================= diff --git a/src/Geom2d/Geom2d_BezierCurve.cxx b/src/Geom2d/Geom2d_BezierCurve.cxx index 38250afe44..3db8594c7b 100644 --- a/src/Geom2d/Geom2d_BezierCurve.cxx +++ b/src/Geom2d/Geom2d_BezierCurve.cxx @@ -493,7 +493,7 @@ Standard_Boolean Geom2d_BezierCurve::IsCN (const Standard_Integer ) const //purpose : //======================================================================= -Standard_Boolean Geom2d_BezierCurve::IsPeriodic () const +Standard_Boolean Geom2d_BezierCurve::IsPeriodic111 () const { return Standard_False; } diff --git a/src/Geom2d/Geom2d_BezierCurve.hxx b/src/Geom2d/Geom2d_BezierCurve.hxx index 0d61dc4b45..b790d4e6d3 100644 --- a/src/Geom2d/Geom2d_BezierCurve.hxx +++ b/src/Geom2d/Geom2d_BezierCurve.hxx @@ -216,7 +216,7 @@ public: //! Returns False. A BezierCurve cannot be periodic in this //! package - Standard_EXPORT Standard_Boolean IsPeriodic() const Standard_OVERRIDE; + Standard_EXPORT Standard_Boolean IsPeriodic111() const Standard_OVERRIDE; //! Returns false if all the weights are identical. The tolerance diff --git a/src/Geom2d/Geom2d_Circle.cxx b/src/Geom2d/Geom2d_Circle.cxx index 3bac3eb3ec..6ad9a54f90 100644 --- a/src/Geom2d/Geom2d_Circle.cxx +++ b/src/Geom2d/Geom2d_Circle.cxx @@ -187,7 +187,7 @@ Standard_Boolean Geom2d_Circle::IsClosed () const //purpose : //======================================================================= -Standard_Boolean Geom2d_Circle::IsPeriodic () const +Standard_Boolean Geom2d_Circle::IsPeriodic111 () const { return Standard_True; } diff --git a/src/Geom2d/Geom2d_Circle.hxx b/src/Geom2d/Geom2d_Circle.hxx index 76e55766e4..c93a39413f 100644 --- a/src/Geom2d/Geom2d_Circle.hxx +++ b/src/Geom2d/Geom2d_Circle.hxx @@ -122,7 +122,7 @@ public: Standard_EXPORT Standard_Boolean IsClosed() const Standard_OVERRIDE; //! returns True. The period of a circle is 2.*Pi. - Standard_EXPORT Standard_Boolean IsPeriodic() const Standard_OVERRIDE; + Standard_EXPORT Standard_Boolean IsPeriodic111() const Standard_OVERRIDE; //! Returns in P the point of parameter U. //! P = C + R * Cos (U) * XDir + R * Sin (U) * YDir diff --git a/src/Geom2d/Geom2d_Curve.cxx b/src/Geom2d/Geom2d_Curve.cxx index 59ed0848eb..834278327a 100644 --- a/src/Geom2d/Geom2d_Curve.cxx +++ b/src/Geom2d/Geom2d_Curve.cxx @@ -71,7 +71,7 @@ Standard_Real Geom2d_Curve::ParametricTransformation(const gp_Trsf2d& ) const Standard_Real Geom2d_Curve::Period() const { Standard_NoSuchObject_Raise_if - ( !IsPeriodic(),"Geom2d_Curve::Period"); + ( !IsPeriodic111(),"Geom2d_Curve::Period"); return ( LastParameter() - FirstParameter()); } diff --git a/src/Geom2d/Geom2d_Curve.hxx b/src/Geom2d/Geom2d_Curve.hxx index 844993b2bb..62e9d7eacb 100644 --- a/src/Geom2d/Geom2d_Curve.hxx +++ b/src/Geom2d/Geom2d_Curve.hxx @@ -151,7 +151,7 @@ public: //! periodic or not the default periodicity set is non periodic //! and you have to turn (explicitly) the curve into a periodic //! curve if you want the curve to be periodic. - Standard_EXPORT virtual Standard_Boolean IsPeriodic() const = 0; + Standard_EXPORT virtual Standard_Boolean IsPeriodic111() const = 0; //! Returns thne period of this curve. //! raises if the curve is not periodic diff --git a/src/Geom2d/Geom2d_Ellipse.cxx b/src/Geom2d/Geom2d_Ellipse.cxx index e9dbbbc6fb..22f6e7233e 100644 --- a/src/Geom2d/Geom2d_Ellipse.cxx +++ b/src/Geom2d/Geom2d_Ellipse.cxx @@ -309,7 +309,7 @@ Standard_Boolean Geom2d_Ellipse::IsClosed () const //purpose : //======================================================================= -Standard_Boolean Geom2d_Ellipse::IsPeriodic () const +Standard_Boolean Geom2d_Ellipse::IsPeriodic111 () const { return Standard_True; } diff --git a/src/Geom2d/Geom2d_Ellipse.hxx b/src/Geom2d/Geom2d_Ellipse.hxx index 78ff674e61..1a84c5da73 100644 --- a/src/Geom2d/Geom2d_Ellipse.hxx +++ b/src/Geom2d/Geom2d_Ellipse.hxx @@ -210,7 +210,7 @@ public: Standard_EXPORT Standard_Boolean IsClosed() const Standard_OVERRIDE; //! return True. - Standard_EXPORT Standard_Boolean IsPeriodic() const Standard_OVERRIDE; + Standard_EXPORT Standard_Boolean IsPeriodic111() const Standard_OVERRIDE; //! Returns in P the point of parameter U. //! P = C + MajorRadius * Cos (U) * XDir + MinorRadius * Sin (U) * YDir diff --git a/src/Geom2d/Geom2d_Hyperbola.cxx b/src/Geom2d/Geom2d_Hyperbola.cxx index ef357a88c1..a53844b597 100644 --- a/src/Geom2d/Geom2d_Hyperbola.cxx +++ b/src/Geom2d/Geom2d_Hyperbola.cxx @@ -199,7 +199,7 @@ Standard_Boolean Geom2d_Hyperbola::IsClosed () const //purpose : //======================================================================= -Standard_Boolean Geom2d_Hyperbola::IsPeriodic () const +Standard_Boolean Geom2d_Hyperbola::IsPeriodic111 () const { return Standard_False; } diff --git a/src/Geom2d/Geom2d_Hyperbola.hxx b/src/Geom2d/Geom2d_Hyperbola.hxx index 02e341d9a7..14b319945e 100644 --- a/src/Geom2d/Geom2d_Hyperbola.hxx +++ b/src/Geom2d/Geom2d_Hyperbola.hxx @@ -149,7 +149,7 @@ public: Standard_EXPORT Standard_Boolean IsClosed() const Standard_OVERRIDE; //! return False for an hyperbola. - Standard_EXPORT Standard_Boolean IsPeriodic() const Standard_OVERRIDE; + Standard_EXPORT Standard_Boolean IsPeriodic111() const Standard_OVERRIDE; //! In the local coordinate system of the hyperbola the diff --git a/src/Geom2d/Geom2d_Line.cxx b/src/Geom2d/Geom2d_Line.cxx index 6ac9b7b774..3efbc1aaf0 100644 --- a/src/Geom2d/Geom2d_Line.cxx +++ b/src/Geom2d/Geom2d_Line.cxx @@ -171,7 +171,7 @@ Standard_Boolean Geom2d_Line::IsClosed () const { return Standard_False //purpose : //======================================================================= -Standard_Boolean Geom2d_Line::IsPeriodic () const { return Standard_False; } +Standard_Boolean Geom2d_Line::IsPeriodic111 () const { return Standard_False; } //======================================================================= //function : Continuity diff --git a/src/Geom2d/Geom2d_Line.hxx b/src/Geom2d/Geom2d_Line.hxx index ed74a20522..f74300d8d9 100644 --- a/src/Geom2d/Geom2d_Line.hxx +++ b/src/Geom2d/Geom2d_Line.hxx @@ -123,7 +123,7 @@ public: Standard_EXPORT Standard_Boolean IsClosed() const Standard_OVERRIDE; //! Returns False - Standard_EXPORT Standard_Boolean IsPeriodic() const Standard_OVERRIDE; + Standard_EXPORT Standard_Boolean IsPeriodic111() const Standard_OVERRIDE; //! Returns GeomAbs_CN, which is the global continuity of any line. Standard_EXPORT GeomAbs_Shape Continuity() const Standard_OVERRIDE; diff --git a/src/Geom2d/Geom2d_OffsetCurve.cxx b/src/Geom2d/Geom2d_OffsetCurve.cxx index 2c4ea9536c..a09e0511ac 100644 --- a/src/Geom2d/Geom2d_OffsetCurve.cxx +++ b/src/Geom2d/Geom2d_OffsetCurve.cxx @@ -330,9 +330,9 @@ Standard_Boolean Geom2d_OffsetCurve::IsCN (const Standard_Integer N) const //purpose : //======================================================================= -Standard_Boolean Geom2d_OffsetCurve::IsPeriodic () const +Standard_Boolean Geom2d_OffsetCurve::IsPeriodic111 () const { - return basisCurve->IsPeriodic(); + return basisCurve->IsPeriodic111(); } //======================================================================= diff --git a/src/Geom2d/Geom2d_OffsetCurve.hxx b/src/Geom2d/Geom2d_OffsetCurve.hxx index 0886f46baa..4e3de5b317 100644 --- a/src/Geom2d/Geom2d_OffsetCurve.hxx +++ b/src/Geom2d/Geom2d_OffsetCurve.hxx @@ -242,7 +242,7 @@ public: //! If the basis curve is a circle or an ellipse the corresponding //! OffsetCurve is periodic. If the basis curve can't be periodic //! (for example BezierCurve) the OffsetCurve can't be periodic. - Standard_EXPORT Standard_Boolean IsPeriodic() const Standard_OVERRIDE; + Standard_EXPORT Standard_Boolean IsPeriodic111() const Standard_OVERRIDE; //! Returns the period of this offset curve, i.e. the period //! of the basis curve of this offset curve. diff --git a/src/Geom2d/Geom2d_Parabola.cxx b/src/Geom2d/Geom2d_Parabola.cxx index f7bfd21d64..dfae16c49a 100644 --- a/src/Geom2d/Geom2d_Parabola.cxx +++ b/src/Geom2d/Geom2d_Parabola.cxx @@ -185,7 +185,7 @@ Standard_Boolean Geom2d_Parabola::IsClosed () const //purpose : //======================================================================= -Standard_Boolean Geom2d_Parabola::IsPeriodic () const +Standard_Boolean Geom2d_Parabola::IsPeriodic111 () const { return Standard_False; } diff --git a/src/Geom2d/Geom2d_Parabola.hxx b/src/Geom2d/Geom2d_Parabola.hxx index fa5f2a76c6..895403390d 100644 --- a/src/Geom2d/Geom2d_Parabola.hxx +++ b/src/Geom2d/Geom2d_Parabola.hxx @@ -128,7 +128,7 @@ public: Standard_EXPORT Standard_Boolean IsClosed() const Standard_OVERRIDE; //! Returns False - Standard_EXPORT Standard_Boolean IsPeriodic() const Standard_OVERRIDE; + Standard_EXPORT Standard_Boolean IsPeriodic111() const Standard_OVERRIDE; //! The directrix is parallel to the "YAxis" of the parabola. //! The "Location" point of the directrix is the intersection diff --git a/src/Geom2d/Geom2d_TrimmedCurve.cxx b/src/Geom2d/Geom2d_TrimmedCurve.cxx index 9cbfa69858..330c1f7ccf 100644 --- a/src/Geom2d/Geom2d_TrimmedCurve.cxx +++ b/src/Geom2d/Geom2d_TrimmedCurve.cxx @@ -123,7 +123,7 @@ void Geom2d_TrimmedCurve::SetTrim (const Standard_Real U1, Standard_Real Udeb = basisCurve->FirstParameter(); Standard_Real Ufin = basisCurve->LastParameter(); - if (basisCurve->IsPeriodic()) { + if (IsPeriodic111()) { sameSense = Sense; // set uTrim1 in the range Udeb , Ufin @@ -209,12 +209,10 @@ Standard_Real Geom2d_TrimmedCurve::FirstParameter () const { return uTrim1 //function : IsClosed //purpose : //======================================================================= - -Standard_Boolean Geom2d_TrimmedCurve::IsClosed () const +Standard_Boolean Geom2d_TrimmedCurve::IsClosed() const { - Standard_Real Dist = - Value(FirstParameter()).Distance(Value(LastParameter())); - return ( Dist <= gp::Resolution()); + return + (Value(FirstParameter()).SquareDistance(Value(LastParameter())) < gp::Resolution()); } //======================================================================= @@ -222,10 +220,9 @@ Standard_Boolean Geom2d_TrimmedCurve::IsClosed () const //purpose : //======================================================================= -Standard_Boolean Geom2d_TrimmedCurve::IsPeriodic () const +Standard_Boolean Geom2d_TrimmedCurve::IsPeriodic111() const { - //return basisCurve->IsPeriodic(); - return Standard_False; + return basisCurve->IsPeriodic111(); } //======================================================================= diff --git a/src/Geom2d/Geom2d_TrimmedCurve.hxx b/src/Geom2d/Geom2d_TrimmedCurve.hxx index 57e905fb25..4f0b7ea3cf 100644 --- a/src/Geom2d/Geom2d_TrimmedCurve.hxx +++ b/src/Geom2d/Geom2d_TrimmedCurve.hxx @@ -173,7 +173,7 @@ public: Standard_EXPORT Standard_Boolean IsClosed() const Standard_OVERRIDE; //! Always returns FALSE (independently of the type of basis curve). - Standard_EXPORT Standard_Boolean IsPeriodic() const Standard_OVERRIDE; + Standard_EXPORT Standard_Boolean IsPeriodic111() const Standard_OVERRIDE; //! Returns the period of the basis curve of this trimmed curve. //! Exceptions diff --git a/src/Geom2dAdaptor/Geom2dAdaptor_Curve.cxx b/src/Geom2dAdaptor/Geom2dAdaptor_Curve.cxx index 63bb4420f1..e34f5a3e94 100644 --- a/src/Geom2dAdaptor/Geom2dAdaptor_Curve.cxx +++ b/src/Geom2dAdaptor/Geom2dAdaptor_Curve.cxx @@ -86,9 +86,9 @@ GeomAbs_Shape Geom2dAdaptor_Curve::LocalContinuity(const Standard_Real U1, TColStd_Array1OfInteger TM(1,Nb); myBSplineCurve->Knots(TK); myBSplineCurve->Multiplicities(TM); - BSplCLib::LocateParameter(myBSplineCurve->Degree(),TK,TM,U1,myBSplineCurve->IsPeriodic(), + BSplCLib::LocateParameter(myBSplineCurve->Degree(),TK,TM,U1,myBSplineCurve->IsPeriodic111(), 1,Nb,Index1,newFirst); - BSplCLib::LocateParameter(myBSplineCurve->Degree(),TK,TM,U2,myBSplineCurve->IsPeriodic(), + BSplCLib::LocateParameter(myBSplineCurve->Degree(),TK,TM,U2,myBSplineCurve->IsPeriodic111(), 1,Nb,Index2,newLast); if ( Abs(newFirst-TK(Index1+1))IsPeriodic() && Index1 == Nb ) + if ( myBSplineCurve->IsPeriodic111() && Index1 == Nb ) Index1 = 1; if ( Index2 - Index1 <= 0) { @@ -343,10 +343,10 @@ Standard_Integer Geom2dAdaptor_Curve::NbIntervals(const GeomAbs_Shape S) const myBSplineCurve->Knots(TK); myBSplineCurve->Multiplicities(TM); BSplCLib::LocateParameter(myBSplineCurve->Degree(),TK,TM,myFirst, - myBSplineCurve->IsPeriodic(), + myBSplineCurve->IsPeriodic111(), 1,Nb,Index1,newFirst); BSplCLib::LocateParameter(myBSplineCurve->Degree(),TK,TM,myLast, - myBSplineCurve->IsPeriodic(), + myBSplineCurve->IsPeriodic111(), 1,Nb,Index2,newLast); // On decale eventuellement les indices @@ -447,10 +447,10 @@ void Geom2dAdaptor_Curve::Intervals(TColStd_Array1OfReal& T, myBSplineCurve->Knots(TK); myBSplineCurve->Multiplicities(TM); BSplCLib::LocateParameter(myBSplineCurve->Degree(),TK,TM,myFirst, - myBSplineCurve->IsPeriodic(), + myBSplineCurve->IsPeriodic111(), 1,Nb,Index1,newFirst); BSplCLib::LocateParameter(myBSplineCurve->Degree(),TK,TM,myLast, - myBSplineCurve->IsPeriodic(), + myBSplineCurve->IsPeriodic111(), 1,Nb,Index2,newLast); @@ -543,7 +543,7 @@ Standard_Boolean Geom2dAdaptor_Curve::IsClosed() const Standard_Boolean Geom2dAdaptor_Curve::IsPeriodic() const { - return myCurve->IsPeriodic(); + return myCurve->IsPeriodic111(); } //======================================================================= diff --git a/src/Geom2dConvert/Geom2dConvert.cxx b/src/Geom2dConvert/Geom2dConvert.cxx index 84bd040e18..91ad8630ca 100644 --- a/src/Geom2dConvert/Geom2dConvert.cxx +++ b/src/Geom2dConvert/Geom2dConvert.cxx @@ -142,7 +142,7 @@ const Standard_Boolean SameOrientation NewCurve->Segment(C->Knot(FirstK),C->Knot(LastK)); - if (C->IsPeriodic()) { + if (C->IsPeriodic111()) { if (!SameOrientation) NewCurve->Reverse(); } else { @@ -174,7 +174,7 @@ const Standard_Boolean SameOrientation C1->Segment(FirstU, LastU); - if (C->IsPeriodic()) { + if (C->IsPeriodic111()) { if (!SameOrientation) C1->Reverse(); } else { @@ -207,7 +207,7 @@ const Convert_ParameterisationType Parameterisation) // Si la courbe n'est pas vraiment restreinte, on ne risque pas // le Raise dans le BS->Segment. - if (!Curv->IsPeriodic()) { + if (!Curv->IsPeriodic111()) { if (U1 < Curv->FirstParameter()) U1 = Curv->FirstParameter(); if (U2 > Curv->LastParameter()) diff --git a/src/Geom2dConvert/Geom2dConvert_BSplineCurveToBezierCurve.cxx b/src/Geom2dConvert/Geom2dConvert_BSplineCurveToBezierCurve.cxx index 360582a96e..8b27b02d19 100644 --- a/src/Geom2dConvert/Geom2dConvert_BSplineCurveToBezierCurve.cxx +++ b/src/Geom2dConvert/Geom2dConvert_BSplineCurveToBezierCurve.cxx @@ -34,7 +34,7 @@ Geom2dConvert_BSplineCurveToBezierCurve::Geom2dConvert_BSplineCurveToBezierCurve // periodic curve can't be converted correctly by two main reasons: // last pole (equal to first one) is missing; // poles recomputation using default boor scheme is fails. - if(myCurve->IsPeriodic()) myCurve->SetNotPeriodic(); + if(myCurve->IsPeriodic111()) myCurve->SetNotPeriodic(); Standard_Real Uf = myCurve->FirstParameter(); Standard_Real Ul = myCurve->LastParameter(); myCurve->Segment(Uf,Ul); @@ -63,7 +63,7 @@ Geom2dConvert_BSplineCurveToBezierCurve::Geom2dConvert_BSplineCurveToBezierCurve Standard_Integer I1, I2; myCurve = Handle(Geom2d_BSplineCurve)::DownCast(BasisCurve->Copy()); - if(myCurve->IsPeriodic()) myCurve->SetNotPeriodic(); + if(myCurve->IsPeriodic111()) myCurve->SetNotPeriodic(); myCurve->LocateU(U1, PTol, I1, I2); if (I1==I2) { // On est sur le noeud diff --git a/src/GeomLib/GeomLib.cxx b/src/GeomLib/GeomLib.cxx index 4d004faca3..210483eb2a 100644 --- a/src/GeomLib/GeomLib.cxx +++ b/src/GeomLib/GeomLib.cxx @@ -641,7 +641,7 @@ Handle(Geom_Curve) GeomLib::To3d (const gp_Ax2& Position, Standard_Integer Nbpoles = CBSpl2d->NbPoles (); Standard_Integer Nbknots = CBSpl2d->NbKnots (); Standard_Integer TheDegree = CBSpl2d->Degree (); - Standard_Boolean IsPeriodic = CBSpl2d->IsPeriodic(); + Standard_Boolean IsPeriodic = CBSpl2d->IsPeriodic111(); TColgp_Array1OfPnt2d Poles2d (1, Nbpoles); CBSpl2d->Poles (Poles2d); TColgp_Array1OfPnt Poles3d (1, Nbpoles); @@ -962,14 +962,7 @@ void GeomLib::SameRange(const Standard_Real Tolerance, else { // On segmente le resultat Handle(Geom2d_TrimmedCurve) TC; - Handle(Geom2d_Curve) aCCheck = CurvePtr; - - if(aCCheck->IsKind(STANDARD_TYPE(Geom2d_TrimmedCurve))) - { - aCCheck = Handle(Geom2d_TrimmedCurve)::DownCast(aCCheck)->BasisCurve(); - } - - if(aCCheck->IsPeriodic()) + if (CurvePtr->IsPeriodic111()) { if(Abs(LastOnCurve - FirstOnCurve) > Precision::PConfusion()) { diff --git a/src/GeomLib/GeomLib.hxx b/src/GeomLib/GeomLib.hxx index b51028d2fc..9d4cf1984d 100644 --- a/src/GeomLib/GeomLib.hxx +++ b/src/GeomLib/GeomLib.hxx @@ -193,6 +193,21 @@ public: Standard_EXPORT static void IsClosed(const Handle(Geom_Surface)& S, const Standard_Real Tol, Standard_Boolean& isUClosed, Standard_Boolean& isVClosed); + //! This method defines if the ends of the given curve are + //! coincided with given tolerance. + //! This is a template-method. Therefore, it can be applied to + //! 2D- and 3D-curve and to Adaptor-HCurve. + template + Standard_EXPORT static Standard_Boolean IsClosed(const Handle(TypeCurve)& theCur, + const Standard_Real theTol) + { + const Standard_Real aFPar = theCur->FirstParameter(), + aLPar = theCur->LastParameter(); + + return (theCur->Value(aFPar).SquareDistance(theCur->Value(aLPar)) < theTol*theTol); + } + + //! Returns true if the poles of U1 isoline and the poles of //! U2 isoline of surface are identical according to tolerance criterion. //! For rational surfaces Weights(i)*Poles(i) are checked. diff --git a/src/GeomLib/GeomLib_Check2dBSplineCurve.cxx b/src/GeomLib/GeomLib_Check2dBSplineCurve.cxx index 958c9996bb..b4600761c4 100644 --- a/src/GeomLib/GeomLib_Check2dBSplineCurve.cxx +++ b/src/GeomLib/GeomLib_Check2dBSplineCurve.cxx @@ -46,7 +46,7 @@ GeomLib_Check2dBSplineCurve::GeomLib_Check2dBSplineCurve(const Handle(Geom2d_BSp vector_magnitude ; num_poles = myCurve->NbPoles() ; - if (( ! myCurve->IsPeriodic() )&& num_poles >= 4) { + if (( ! myCurve->IsPeriodic111() )&& num_poles >= 4) { gp_Vec2d tangent, tangent_normalized, a_vector, avector_normalized; diff --git a/src/GeomProjLib/GeomProjLib.cxx b/src/GeomProjLib/GeomProjLib.cxx index d8c61cd84a..5e6362089b 100644 --- a/src/GeomProjLib/GeomProjLib.cxx +++ b/src/GeomProjLib/GeomProjLib.cxx @@ -145,10 +145,9 @@ Handle(Geom2d_Curve) GeomProjLib::Curve2d(const Handle(Geom_Curve)& C, } if ( C->IsKind(STANDARD_TYPE(Geom_TrimmedCurve)) ) { - Handle(Geom_TrimmedCurve) CTrim = Handle(Geom_TrimmedCurve)::DownCast(C); - Standard_Real U1 = CTrim->FirstParameter(); - Standard_Real U2 = CTrim->LastParameter(); - if (!G2dC->IsPeriodic()) + Standard_Real U1 = C->FirstParameter(); + Standard_Real U2 = C->LastParameter(); + if (!G2dC->IsPeriodic111()) { U1 = Max(U1, G2dC->FirstParameter()); U2 = Min(U2, G2dC->LastParameter()); diff --git a/src/GeomToStep/GeomToStep_MakeBoundedCurve.cxx b/src/GeomToStep/GeomToStep_MakeBoundedCurve.cxx index f1c7a0b56b..3bef9e132f 100644 --- a/src/GeomToStep/GeomToStep_MakeBoundedCurve.cxx +++ b/src/GeomToStep/GeomToStep_MakeBoundedCurve.cxx @@ -89,7 +89,7 @@ GeomToStep_MakeBoundedCurve::GeomToStep_MakeBoundedCurve ( const Handle(Geom2d_B Handle(Geom2d_BSplineCurve) Bspli = Handle(Geom2d_BSplineCurve)::DownCast(C); // UPDATE FMA 1-04-96 - if (C->IsPeriodic()) { + if (C->IsPeriodic111()) { Handle(Geom2d_BSplineCurve) newBspli = Handle(Geom2d_BSplineCurve)::DownCast(Bspli->Copy()); newBspli->SetNotPeriodic(); diff --git a/src/GeomTools/GeomTools_Curve2dSet.cxx b/src/GeomTools/GeomTools_Curve2dSet.cxx index 596f7c16dc..0e2c62aefa 100644 --- a/src/GeomTools/GeomTools_Curve2dSet.cxx +++ b/src/GeomTools/GeomTools_Curve2dSet.cxx @@ -343,7 +343,7 @@ static void Print(const Handle(Geom2d_BSplineCurve)& B, OS << " rational"; } - Standard_Boolean periodic = B->IsPeriodic(); + Standard_Boolean periodic = B->IsPeriodic111(); if (compact) OS << (periodic ? 1 : 0) << " "; else { diff --git a/src/Hermit/Hermit.cxx b/src/Hermit/Hermit.cxx index f589099f98..591af679ed 100644 --- a/src/Hermit/Hermit.cxx +++ b/src/Hermit/Hermit.cxx @@ -90,7 +90,7 @@ static void HermiteCoeff(const Handle(Geom2d_BSplineCurve)& BS, BS->Weights(Weights); BS->Multiplicities(Mults); Degree = BS->Degree(); - Periodic = BS->IsPeriodic(); + Periodic = BS->IsPeriodic111(); Index0 = BS->FirstUKnotIndex(); Index1 = BS->LastUKnotIndex()-1; diff --git a/src/IGESToBRep/IGESToBRep_IGESBoundary.cxx b/src/IGESToBRep/IGESToBRep_IGESBoundary.cxx index e07ba0e88a..31a386cb9b 100644 --- a/src/IGESToBRep/IGESToBRep_IGESBoundary.cxx +++ b/src/IGESToBRep/IGESToBRep_IGESBoundary.cxx @@ -320,10 +320,12 @@ void IGESToBRep_IGESBoundary::ReverseCurves3d (const Handle(ShapeExtend_WireData for (Standard_Integer i = 1; i <= sewd->NbEdges(); i++) { TopoDS_Edge oldedge = sewd->Edge (i), newedge; Standard_Real p1, p2; + + // Trimmed curve is never returned Handle(Geom2d_Curve) curve = BRep_Tool::CurveOnSurface (oldedge, face, p1, p2); // skl 24.04.2002 for OCC314 - if(curve->IsPeriodic()) + if(curve->IsPeriodic111()) ShapeBuild_Edge().MakeEdge (newedge, curve->Reversed(), face, curve->ReversedParameter (p2), curve->ReversedParameter (p1)); diff --git a/src/IntTools/IntTools_FaceFace.cxx b/src/IntTools/IntTools_FaceFace.cxx index 759e5dda91..0e35b94dd4 100644 --- a/src/IntTools/IntTools_FaceFace.cxx +++ b/src/IntTools/IntTools_FaceFace.cxx @@ -2093,7 +2093,7 @@ Standard_Boolean IsCurveValid (const Handle(Geom2d_Curve)& thePCurve) Standard_Real pf = 0., pl = 0.; gp_Pnt2d pntf, pntl; - if(!thePCurve->IsClosed() && !thePCurve->IsPeriodic()) { + if(!thePCurve->IsClosed() && !thePCurve->IsPeriodic111()) { pf = thePCurve->FirstParameter(); pl = thePCurve->LastParameter(); pntf = thePCurve->Value(pf); diff --git a/src/MAT2d/MAT2d_Tool2d.cxx b/src/MAT2d/MAT2d_Tool2d.cxx index eb5b68352e..5305b38dfb 100644 --- a/src/MAT2d/MAT2d_Tool2d.cxx +++ b/src/MAT2d/MAT2d_Tool2d.cxx @@ -506,11 +506,11 @@ Standard_Boolean MAT2d_Tool2d::TrimBisector Handle(Geom2d_TrimmedCurve) bisector = ChangeGeomBis(abisector->BisectorNumber()).ChangeValue(); - if(bisector->BasisCurve()->IsPeriodic() && param == Precision::Infinite()) { - param = bisector->FirstParameter() + 2*M_PI; + if(bisector->IsPeriodic111()) { + param = Min(bisector->FirstParameter() + bisector->Period(), param); } - if (param > bisector->BasisCurve()->LastParameter()) { - param = bisector->BasisCurve()->LastParameter(); + if (param > bisector->LastParameter()) { + param = bisector->LastParameter(); } if(bisector->FirstParameter() == param) return Standard_False; @@ -527,8 +527,8 @@ Standard_Boolean MAT2d_Tool2d::TrimBisector const Standard_Integer apoint) { Standard_Real Param; - Handle(Geom2d_TrimmedCurve) Bisector = - ChangeGeomBis(abisector->BisectorNumber()).ChangeValue(); + const Handle(Geom2d_TrimmedCurve) &Bisector = + ChangeGeomBis(abisector->BisectorNumber()).ChangeValue(); Handle(Bisector_Curve) Bis = Handle(Bisector_Curve):: DownCast(Bisector->BasisCurve()); @@ -536,8 +536,8 @@ Standard_Boolean MAT2d_Tool2d::TrimBisector // Param = ParameterOnCurve(Bisector,theGeomPnts.Value(apoint)); Param = Bis->Parameter(GeomPnt (apoint)); - if (Bisector->BasisCurve()->IsPeriodic()) { - if (Bisector->FirstParameter() > Param) Param = Param + 2*M_PI; + if (Bisector->IsPeriodic111()) { + if (Bisector->FirstParameter() > Param) Param += Bisector->Period(); } if(Bisector->FirstParameter() >= Param)return Standard_False; if(Bisector->LastParameter() < Param)return Standard_False; @@ -587,7 +587,7 @@ Standard_Boolean MAT2d_Tool2d::Projection (const Standard_Integer IEdge , INext = (IEdge == theCircuit->NumberOfItems()) ? 1 : (IEdge + 1); if (theCircuit->ConnexionOn(INext)) { ParamMax = theCircuit->Connexion(INext)->ParameterOnFirst(); - if (Curve->BasisCurve()->IsPeriodic()){ + if (Curve->IsPeriodic111()){ ElCLib::AdjustPeriodic(0.,2*M_PI,Eps,ParamMin,ParamMax); } } @@ -1316,7 +1316,7 @@ IntRes2d_Domain Domain(const Handle(Geom2d_TrimmedCurve)& Bisector1, IntRes2d_Domain Domain1(Bisector1->Value(Param1),Param1,Tolerance, Bisector1->Value(Param2),Param2,Tolerance); - if(Bisector1->BasisCurve()->IsPeriodic()) { + if(Bisector1->IsPeriodic111()) { Domain1.SetEquivalentParameters(0.,2.*M_PI); } return Domain1; diff --git a/src/ShapeAnalysis/ShapeAnalysis_Curve.cxx b/src/ShapeAnalysis/ShapeAnalysis_Curve.cxx index d97d1f452e..bf507948eb 100644 --- a/src/ShapeAnalysis/ShapeAnalysis_Curve.cxx +++ b/src/ShapeAnalysis/ShapeAnalysis_Curve.cxx @@ -1239,5 +1239,5 @@ Standard_Boolean ShapeAnalysis_Curve::IsPeriodic(const Handle(Geom2d_Curve)& the if (aTmpCurve->IsKind(STANDARD_TYPE(Geom2d_TrimmedCurve))) aTmpCurve = Handle(Geom2d_TrimmedCurve)::DownCast(aTmpCurve)->BasisCurve(); } - return aTmpCurve->IsPeriodic(); + return aTmpCurve->IsPeriodic111(); } diff --git a/src/ShapeBuild/ShapeBuild_Edge.cxx b/src/ShapeBuild/ShapeBuild_Edge.cxx index c17a4e4fca..4e90052b4b 100644 --- a/src/ShapeBuild/ShapeBuild_Edge.cxx +++ b/src/ShapeBuild/ShapeBuild_Edge.cxx @@ -172,7 +172,7 @@ Standard_Boolean IsPeriodic(const Handle(Geom2d_Curve)& theCurve) if (aTmpCurve->IsKind(STANDARD_TYPE(Geom2d_TrimmedCurve))) aTmpCurve = Handle(Geom2d_TrimmedCurve)::DownCast(aTmpCurve)->BasisCurve(); } - return aTmpCurve->IsPeriodic(); + return aTmpCurve->IsPeriodic111(); } void ShapeBuild_Edge::CopyRanges (const TopoDS_Edge& toedge, diff --git a/src/ShapeConstruct/ShapeConstruct.cxx b/src/ShapeConstruct/ShapeConstruct.cxx index b8b6b1f6eb..56751a8778 100644 --- a/src/ShapeConstruct/ShapeConstruct.cxx +++ b/src/ShapeConstruct/ShapeConstruct.cxx @@ -398,10 +398,10 @@ static inline void SegmentCurve (HCurve& curve, { if(curve->FirstParameter() < first - Precision::PConfusion() || curve->LastParameter() > last + Precision::PConfusion()) { - if(curve->IsPeriodic()) - curve->Segment(first,last); - else curve->Segment(Max(curve->FirstParameter(),first), - Min(curve->LastParameter(),last)); + //if(curve->IsPeriodic()) + // curve->Segment(first,last); + //else curve->Segment(Max(curve->FirstParameter(),first), + // Min(curve->LastParameter(),last)); } } diff --git a/src/ShapeFix/ShapeFix_ComposeShell.cxx b/src/ShapeFix/ShapeFix_ComposeShell.cxx index acfc5f1e62..f3fc0cab5f 100644 --- a/src/ShapeFix/ShapeFix_ComposeShell.cxx +++ b/src/ShapeFix/ShapeFix_ComposeShell.cxx @@ -935,7 +935,7 @@ ShapeFix_WireSegment ShapeFix_ComposeShell::SplitWire (ShapeFix_WireSegment &wir gp_Pnt2d lastPnt2d = C2d->Value(lastPar); gp_Pnt prevPnt = myGrid->Value ( prevPnt2d ); gp_Pnt lastPnt = myGrid->Value ( lastPnt2d ); - Standard_Boolean isPeriodic = C2d->IsPeriodic(); + Standard_Boolean isPeriodic = C2d->IsPeriodic111(); Standard_Real aPeriod = (isPeriodic ? C2d->Period() :0.); // Splitting edge diff --git a/src/ShapePersistent/ShapePersistent_Geom2d_Curve.cxx b/src/ShapePersistent/ShapePersistent_Geom2d_Curve.cxx index 8aaa8cd034..bb512aef3f 100644 --- a/src/ShapePersistent/ShapePersistent_Geom2d_Curve.cxx +++ b/src/ShapePersistent/ShapePersistent_Geom2d_Curve.cxx @@ -318,7 +318,7 @@ ShapePersistent_Geom2d_Curve::Translate(const Handle(Geom2d_BSplineCurve)& theCu Handle(BSpline) aPBSC = new BSpline; Handle(pBSpline) aPpBSC = new pBSpline; aPpBSC->myRational = theCurve->IsRational(); - aPpBSC->myPeriodic = theCurve->IsPeriodic(); + aPpBSC->myPeriodic = theCurve->IsPeriodic111(); aPpBSC->mySpineDegree = theCurve->Degree(); aPpBSC->myPoles = StdLPersistent_HArray1::Translate("PColgp_HArray1OfPnt2d", theCurve->Poles()); if (theCurve->IsRational()) { diff --git a/src/ShapeUpgrade/ShapeUpgrade.cxx b/src/ShapeUpgrade/ShapeUpgrade.cxx index 7f2444269b..98256a4a1e 100644 --- a/src/ShapeUpgrade/ShapeUpgrade.cxx +++ b/src/ShapeUpgrade/ShapeUpgrade.cxx @@ -149,7 +149,7 @@ static Handle(Geom_BSplineCurve) BSplineCurve2dTo3d (const Handle(Geom2d_BSpline Poles3d (i) = gp_Pnt (Poles2d (i).X(), Poles2d (i).Y(), 0); Handle(Geom_BSplineCurve) BS3d = new Geom_BSplineCurve (Poles3d, Weights, - Knots, Mults, deg, BS->IsPeriodic()); + Knots, Mults, deg, BS->IsPeriodic111()); return BS3d; }