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;
}
{
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;
}
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);
#include <TopTools_MapIteratorOfMapOfShape.hxx>
#include <TopTools_MapOfShape.hxx>
#include <TopTools_SequenceOfShape.hxx>
+#include <GeomLib.hxx>
#include <stdio.h>
#ifdef OCCT_DEBUG
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();
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() ||
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() ||
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;
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;
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))
{
}
}
}
- else if (theCurve->IsPeriodic())
+ else if (theCurve->IsPeriodic111())
{
Standard_Real delta = (theCurve->Period() - (anEl - anEf))*0.5;
delta *= 0.95;
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());
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;
//! Evals real tolerance of edge <theE>.
//! <theC3d>, <theC2d>, <theS>, <theF>, <theL> are
- //! correspondently 3d curve of edge, 2d curve on surface <theS> and
+ //! correspondingly 3d curve of edge, 2d curve on surface <theS> and
//! rang of edge
//! If calculated tolerance is more then current edge tolerance, edge is updated.
//! Method returns actual tolerance of edge
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;
}
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())
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;
//function : IsPeriodic
//purpose :
//=============================================================================
-Standard_Boolean Bisector_BisecAna::IsPeriodic() const
+Standard_Boolean Bisector_BisecAna::IsPeriodic111() const
{
- return thebisector->BasisCurve()->IsPeriodic();
+ return thebisector->IsPeriodic111();
}
//=============================================================================
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;
//function : IsPeriodic
//purpose :
//=============================================================================
-Standard_Boolean Bisector_BisecCC::IsPeriodic() const
+Standard_Boolean Bisector_BisecCC::IsPeriodic111() const
{
return Standard_False;
}
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
//function : IsPeriodic
//purpose :
//=============================================================================
-Standard_Boolean Bisector_BisecPC::IsPeriodic() const
+Standard_Boolean Bisector_BisecPC::IsPeriodic111() const
{
return Standard_False;
}
//------------------------------------------------------------------------
// 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.
// => 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++) {
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 <me> and my point or my curve.
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())
{
// 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));
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();
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;
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)
{
}
else
{
- if (!PCurve->IsPeriodic())
+ if (!PCurve->IsPeriodic111())
{
Handle (Geom2d_TrimmedCurve) TrimPCurve = Handle(Geom2d_TrimmedCurve)::DownCast (PCurve);
if (!TrimPCurve.IsNull())
for (Standard_Integer i = 2; i <= NbPoles; i++) {
dis.DrawTo(CPoles(i));
}
- if (C->IsPeriodic())
+ if (C->IsPeriodic111() && C->IsClosed())
dis.DrawTo(CPoles(1));
}
Standard_Integer& ErrorStatus)
{
Standard_Integer ii ;
- if (IsPeriodic()) {
+ if (IsPeriodic111()) {
//
// for the time being do not deal with periodic curves
//
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.
return Standard_False;
}
- if(!IsPeriodic())
+ if(!IsPeriodic111())
return Standard_True;
const Standard_Real aFirstParam = FirstParameter(),
//purpose :
//=======================================================================
-Standard_Boolean Geom2d_BSplineCurve::IsPeriodic () const
+Standard_Boolean Geom2d_BSplineCurve::IsPeriodic111 () const
{ return periodic; }
//=======================================================================
//purpose :
//=======================================================================
-Standard_Boolean Geom2d_BezierCurve::IsPeriodic () const
+Standard_Boolean Geom2d_BezierCurve::IsPeriodic111 () const
{
return Standard_False;
}
//! 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
//purpose :
//=======================================================================
-Standard_Boolean Geom2d_Circle::IsPeriodic () const
+Standard_Boolean Geom2d_Circle::IsPeriodic111 () const
{
return Standard_True;
}
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
Standard_Real Geom2d_Curve::Period() const
{
Standard_NoSuchObject_Raise_if
- ( !IsPeriodic(),"Geom2d_Curve::Period");
+ ( !IsPeriodic111(),"Geom2d_Curve::Period");
return ( LastParameter() - FirstParameter());
}
//! 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
//purpose :
//=======================================================================
-Standard_Boolean Geom2d_Ellipse::IsPeriodic () const
+Standard_Boolean Geom2d_Ellipse::IsPeriodic111 () const
{
return Standard_True;
}
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
//purpose :
//=======================================================================
-Standard_Boolean Geom2d_Hyperbola::IsPeriodic () const
+Standard_Boolean Geom2d_Hyperbola::IsPeriodic111 () const
{
return Standard_False;
}
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
//purpose :
//=======================================================================
-Standard_Boolean Geom2d_Line::IsPeriodic () const { return Standard_False; }
+Standard_Boolean Geom2d_Line::IsPeriodic111 () const { return Standard_False; }
//=======================================================================
//function : Continuity
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;
//purpose :
//=======================================================================
-Standard_Boolean Geom2d_OffsetCurve::IsPeriodic () const
+Standard_Boolean Geom2d_OffsetCurve::IsPeriodic111 () const
{
- return basisCurve->IsPeriodic();
+ return basisCurve->IsPeriodic111();
}
//=======================================================================
//! 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.
//purpose :
//=======================================================================
-Standard_Boolean Geom2d_Parabola::IsPeriodic () const
+Standard_Boolean Geom2d_Parabola::IsPeriodic111 () const
{
return Standard_False;
}
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
Standard_Real Udeb = basisCurve->FirstParameter();
Standard_Real Ufin = basisCurve->LastParameter();
- if (basisCurve->IsPeriodic()) {
+ if (IsPeriodic111()) {
sameSense = Sense;
// set uTrim1 in the range Udeb , Ufin
//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());
}
//=======================================================================
//purpose :
//=======================================================================
-Standard_Boolean Geom2d_TrimmedCurve::IsPeriodic () const
+Standard_Boolean Geom2d_TrimmedCurve::IsPeriodic111() const
{
- //return basisCurve->IsPeriodic();
- return Standard_False;
+ return basisCurve->IsPeriodic111();
}
//=======================================================================
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
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))<Precision::PConfusion()) {
if (Index1 < Nb)Index1++;
Index2--;
Standard_Integer MultMax;
// attention aux courbes peridiques.
- if ( myBSplineCurve->IsPeriodic() && Index1 == Nb )
+ if ( myBSplineCurve->IsPeriodic111() && Index1 == Nb )
Index1 = 1;
if ( Index2 - Index1 <= 0) {
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
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);
Standard_Boolean Geom2dAdaptor_Curve::IsPeriodic() const
{
- return myCurve->IsPeriodic();
+ return myCurve->IsPeriodic111();
}
//=======================================================================
NewCurve->Segment(C->Knot(FirstK),C->Knot(LastK));
- if (C->IsPeriodic()) {
+ if (C->IsPeriodic111()) {
if (!SameOrientation) NewCurve->Reverse();
}
else {
C1->Segment(FirstU, LastU);
- if (C->IsPeriodic()) {
+ if (C->IsPeriodic111()) {
if (!SameOrientation) C1->Reverse();
}
else {
// 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())
// 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);
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
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);
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())
{
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 <typename TypeCurve>
+ 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.
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;
}
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());
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();
OS << " rational";
}
- Standard_Boolean periodic = B->IsPeriodic();
+ Standard_Boolean periodic = B->IsPeriodic111();
if (compact)
OS << (periodic ? 1 : 0) << " ";
else {
BS->Weights(Weights);
BS->Multiplicities(Mults);
Degree = BS->Degree();
- Periodic = BS->IsPeriodic();
+ Periodic = BS->IsPeriodic111();
Index0 = BS->FirstUKnotIndex();
Index1 = BS->LastUKnotIndex()-1;
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));
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);
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;
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());
// 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;
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);
}
}
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;
if (aTmpCurve->IsKind(STANDARD_TYPE(Geom2d_TrimmedCurve)))
aTmpCurve = Handle(Geom2d_TrimmedCurve)::DownCast(aTmpCurve)->BasisCurve();
}
- return aTmpCurve->IsPeriodic();
+ return aTmpCurve->IsPeriodic111();
}
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,
{
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));
}
}
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
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<TColgp_HArray1OfPnt2d>("PColgp_HArray1OfPnt2d", theCurve->Poles());
if (theCurve->IsRational()) {
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;
}