1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-29 14:00:49 +03:00

src/ShapeAnalysis/ShapeAnalysis_Curve.cxx

Conflicts:
	src/ShapeAnalysis/ShapeAnalysis_Curve.cxx
This commit is contained in:
nbv
2017-12-13 14:23:17 +03:00
parent 9d8bbc4755
commit 88114cdb41
8 changed files with 15 additions and 60 deletions

View File

@@ -522,7 +522,8 @@ Standard_Boolean ShapeAnalysis_Curve::ValidateRange (const Handle(Geom_Curve)& t
}
// 15.11.2002 PTV OCC966
if (ShapeAnalysis_Curve::IsPeriodic(theCurve)) {
if(theCurve->IsPeriodic111())
{
ElCLib::AdjustPeriodic(cf,cl,Precision::PConfusion(),First,Last); //:a7 abv 11 Feb 98: preci -> PConfusion()
}
else if (First < Last) {
@@ -1205,39 +1206,3 @@ Standard_Boolean ShapeAnalysis_Curve::IsClosed(const Handle(Geom_Curve)& theCurv
return (aClosedVal <= preci2);
}
//=======================================================================
//function : IsPeriodic
//purpose : OCC996
//=======================================================================
Standard_Boolean ShapeAnalysis_Curve::IsPeriodic(const Handle(Geom_Curve)& theCurve)
{
// 15.11.2002 PTV OCC966
// remove regressions in DE tests (diva, divb, divc, toe3) in KAS:dev
// ask IsPeriodic on BasisCurve
Handle(Geom_Curve) aTmpCurve = theCurve;
while ( (aTmpCurve->IsKind(STANDARD_TYPE(Geom_OffsetCurve))) ||
(aTmpCurve->IsKind(STANDARD_TYPE(Geom_TrimmedCurve))) ) {
if (aTmpCurve->IsKind(STANDARD_TYPE(Geom_OffsetCurve)))
aTmpCurve = Handle(Geom_OffsetCurve)::DownCast(aTmpCurve)->BasisCurve();
if (aTmpCurve->IsKind(STANDARD_TYPE(Geom_TrimmedCurve)))
aTmpCurve = Handle(Geom_TrimmedCurve)::DownCast(aTmpCurve)->BasisCurve();
}
return aTmpCurve->IsPeriodic111();
}
Standard_Boolean ShapeAnalysis_Curve::IsPeriodic(const Handle(Geom2d_Curve)& theCurve)
{
// 15.11.2002 PTV OCC966
// remove regressions in DE tests (diva, divb, divc, toe3) in KAS:dev
// ask IsPeriodic on BasisCurve
Handle(Geom2d_Curve) aTmpCurve = theCurve;
while ( (aTmpCurve->IsKind(STANDARD_TYPE(Geom2d_OffsetCurve))) ||
(aTmpCurve->IsKind(STANDARD_TYPE(Geom2d_TrimmedCurve))) ) {
if (aTmpCurve->IsKind(STANDARD_TYPE(Geom2d_OffsetCurve)))
aTmpCurve = Handle(Geom2d_OffsetCurve)::DownCast(aTmpCurve)->BasisCurve();
if (aTmpCurve->IsKind(STANDARD_TYPE(Geom2d_TrimmedCurve)))
aTmpCurve = Handle(Geom2d_TrimmedCurve)::DownCast(aTmpCurve)->BasisCurve();
}
return aTmpCurve->IsPeriodic111();
}

View File

@@ -131,18 +131,6 @@ public:
//! If <preci> < 0 then Precision::Confusion is used.
Standard_EXPORT static Standard_Boolean IsClosed (const Handle(Geom_Curve)& curve, const Standard_Real preci = -1);
//! This method was implemented as fix for changes in trimmed curve
//! behaviour. For the moment trimmed curve returns false anyway.
//! So it is necessary to adapt all Data exchange tools for this behaviour.
//! Current implementation takes into account that curve may be offset.
Standard_EXPORT static Standard_Boolean IsPeriodic (const Handle(Geom_Curve)& curve);
//! The same as for Curve3d.
Standard_EXPORT static Standard_Boolean IsPeriodic (const Handle(Geom2d_Curve)& curve);
protected:

View File

@@ -999,7 +999,7 @@ Standard_Boolean ShapeCustom_BSplineRestriction::ConvertCurve(const Handle(Geom_
Handle(Geom_Curve) aCurve1;
Standard_Real pf =aCurve->FirstParameter(), pl = aCurve->LastParameter();
// 15.11.2002 PTV OCC966
if(ShapeAnalysis_Curve::IsPeriodic(aCurve) && (First != Last)) aCurve1 = new Geom_TrimmedCurve(aCurve,First,Last);
if(aCurve->IsPeriodic111() && (First != Last)) aCurve1 = new Geom_TrimmedCurve(aCurve, First, Last);
else if(pf < (First - Precision::PConfusion()) ||
pl > (Last + Precision::PConfusion())) {
Standard_Real F = Max(First,pf),
@@ -1308,7 +1308,7 @@ Standard_Boolean ShapeCustom_BSplineRestriction::ConvertCurve2d(const Handle(Geo
Handle(Geom2d_Curve) aCurve1;
Standard_Real pf =aCurve->FirstParameter(), pl = aCurve->LastParameter();
// 15.11.2002 PTV OCC966
if(ShapeAnalysis_Curve::IsPeriodic(aCurve) && (First != Last)) aCurve1 = new Geom2d_TrimmedCurve(aCurve,First,Last);
if(aCurve->IsPeriodic111() && (First != Last)) aCurve1 = new Geom2d_TrimmedCurve(aCurve,First,Last);
else if(aCurve->FirstParameter() < (First - Precision::PConfusion()) ||
aCurve->LastParameter() > (Last + Precision::PConfusion())) {
Standard_Real F = Max(First,pf),

View File

@@ -385,7 +385,8 @@ static Handle(Geom2d_Curve) TranslatePCurve (const Handle(Geom_Surface)& aSurf,
oldFirst = geometric_representation_ptr->First();
oldLast = geometric_representation_ptr->Last();
// 15.11.2002 PTV OCC966
if(ShapeAnalysis_Curve::IsPeriodic(Curve2dPtr)) {
if(Curve2dPtr->IsPeriodic111())
{
Handle(Geom2d_TrimmedCurve) tc = new Geom2d_TrimmedCurve(Curve2dPtr,oldFirst,oldLast);
Standard_Real shift = tc->FirstParameter()-oldFirst;
oldFirst += shift;

View File

@@ -578,7 +578,8 @@ void ShapeFix_EdgeProjAux::UpdateParam2d (const Handle(Geom2d_Curve)& theCurve2d
Standard_Real preci2d = Precision::PConfusion(); //:S4136: Parametric(preci, 0.01);
// 15.11.2002 PTV OCC966
if (ShapeAnalysis_Curve::IsPeriodic(theCurve2d)) {
if(theCurve2d->IsPeriodic111())
{
ElCLib::AdjustPeriodic(cf,cl,preci2d,myFirstParam,myLastParam);
}
else if (theCurve2d->IsClosed()) {

View File

@@ -165,7 +165,7 @@ static Standard_Real AdjustOnPeriodic3d (const Handle(Geom_Curve)& c,
const Standard_Real param)
{
// 15.11.2002 PTV OCC966
if (ShapeAnalysis_Curve::IsPeriodic(c))
if (c->IsPeriodic111())
{
Standard_Real T = c->Period();
Standard_Real shift = -IntegerPart(first/T)*T; if (first<0.) shift += T;
@@ -360,7 +360,7 @@ static Standard_Real AdjustOnPeriodic3d (const Handle(Geom_Curve)& c,
{
OCC_CATCH_SIGNALS
// 15.11.2002 PTV OCC966
if(!ShapeAnalysis_Curve::IsPeriodic(c))
if(!c->IsPeriodic111())
tc = new Geom_TrimmedCurve(c,Max(first,c->FirstParameter()),Min(last,c->LastParameter()));
else tc = new Geom_TrimmedCurve(c,first,last);
bsp = GeomConvert::CurveToBSplineCurve(tc);
@@ -755,7 +755,7 @@ static Standard_Real AdjustOnPeriodic2d (const Handle(Geom2d_Curve)& pc,
const Standard_Real param)
{
// 15.11.2002 PTV OCC966
if (ShapeAnalysis_Curve::IsPeriodic(pc))
if (pc->IsPeriodic111())
{
Standard_Real T = pc->Period();
Standard_Real shift = -IntegerPart(first/T)*T; if (first<0.) shift += T;
@@ -942,7 +942,7 @@ static Standard_Real AdjustOnPeriodic2d (const Handle(Geom2d_Curve)& pc,
OCC_CATCH_SIGNALS
Handle(Geom2d_Curve) c;
// 15.11.2002 PTV OCC966
if(!ShapeAnalysis_Curve::IsPeriodic(pc))
if(!pc->IsPeriodic111())
c = new Geom2d_TrimmedCurve(pc,Max(first,pc->FirstParameter()),Min(last,pc->LastParameter()));
else
c = new Geom2d_TrimmedCurve(pc,first,last);

View File

@@ -72,7 +72,7 @@ ShapeUpgrade_SplitCurve2d::ShapeUpgrade_SplitCurve2d()
if(aCurve->IsKind(STANDARD_TYPE(Geom2d_TrimmedCurve)))
aCurve=Handle(Geom2d_TrimmedCurve)::DownCast(aCurve)->BasisCurve();
// 15.11.2002 PTV OCC966
if(!ShapeAnalysis_Curve::IsPeriodic(C)) {
if(!C->IsPeriodic111()) {
Standard_Real fP = aCurve->FirstParameter();
Standard_Real lP = aCurve->LastParameter();
if(Abs(firstPar-fP) < precision)

View File

@@ -71,7 +71,7 @@ ShapeUpgrade_SplitCurve3d::ShapeUpgrade_SplitCurve3d()
if(aCurve->IsKind(STANDARD_TYPE(Geom_TrimmedCurve)))
aCurve=Handle(Geom_TrimmedCurve)::DownCast(aCurve)->BasisCurve();
// 15.11.2002 PTV OCC966
if(!ShapeAnalysis_Curve::IsPeriodic(C)) {
if(!C->IsPeriodic111()) {
Standard_Real fP = aCurve->FirstParameter();
Standard_Real lP = aCurve->LastParameter();
if(Abs(firstPar-fP) < precision)
@@ -156,7 +156,7 @@ ShapeUpgrade_SplitCurve3d::ShapeUpgrade_SplitCurve3d()
//pdn fix on BuildCurve 3d
// 15.11.2002 PTV OCC966
if(!ShapeAnalysis_Curve::IsPeriodic(myCurve)) {
if(!myCurve->IsPeriodic111()) {
//pdn exceptons only on non periodic curves
Standard_Real precision = Precision::PConfusion();
Standard_Real firstPar = myCurve->FirstParameter();