else if (SBasis->IsKind (STANDARD_TYPE(Geom_SurfaceOfRevolution))) {
UClosed = Standard_True;
}
- else { UClosed = Standard_False; }
+ else
+ {
+ UClosed = SBasis->IsUClosed();
+ }
}
return UClosed;
}
if (SBasis->IsKind (STANDARD_TYPE(Geom_ElementarySurface))) {
VClosed = SBasis->IsVClosed();
}
- else { VClosed = Standard_False; }
+ else
+ {
+ VClosed = SBasis->IsVClosed();
+ }
}
return VClosed;
}
//purpose :
//=======================================================================
-Standard_Boolean Geom_RectangularTrimmedSurface::IsUClosed () const {
-
- if (isutrimmed)
+Standard_Boolean Geom_RectangularTrimmedSurface::IsUClosed() const
+{
+ if (!basisSurf->IsUClosed())
return Standard_False;
- else
- return basisSurf->IsUClosed();
+
+ if (!isutrimmed)
+ return Standard_True;
+
+ Standard_Real aU1 = 0.0, aU2 = 0.0, aV1 = 0.0, aV2 = 0.0;
+ basisSurf->Bounds(aU1, aU2, aV1, aV2);
+
+ return (Abs((utrim2 + aU1) - (utrim1 + aU2)) < Precision::PConfusion());
}
//purpose :
//=======================================================================
-Standard_Boolean Geom_RectangularTrimmedSurface::IsVClosed () const {
-
- if (isvtrimmed)
+Standard_Boolean Geom_RectangularTrimmedSurface::IsVClosed() const
+{
+ if (!basisSurf->IsVClosed())
return Standard_False;
- else
- return basisSurf->IsVClosed();
+
+ if (!isvtrimmed)
+ return Standard_True;
+
+ Standard_Real aU1 = 0.0, aU2 = 0.0, aV1 = 0.0, aV2 = 0.0;
+ basisSurf->Bounds(aU1, aU2, aV1, aV2);
+
+ return (Abs((vtrim2 + aV1) - (vtrim1 + aV2)) < Precision::PConfusion());
}
//=======================================================================
// through the sphere pole
return Standard_False;
}
- break;
}
+ break;
case GeomAbs_SurfaceOfRevolution:
{
const Handle(Adaptor3d_HCurve) aCurv = theS.BasisCurve();
}
}
}
- break;
}
+ break;
+ default:
+ break;
}
return Standard_True;
#include <GeomAdaptor_Surface.hxx>
#include <GeomAPI_ProjectPointOnCurve.hxx>
#include <GeomAPI_ProjectPointOnSurf.hxx>
+#include <GeomLib.hxx>
#include <gp.hxx>
#include <gp_Ax1.hxx>
#include <gp_Dir.hxx>
return !bFlag;
}
-//=======================================================================
-//function : IsClosed
-//purpose :
-//=======================================================================
- Standard_Boolean IntTools_Tools::IsClosed (const Handle(Geom_Curve)& aC3D)
-{
- Standard_Boolean bRet;
- Standard_Real aF, aL, aDist, aPC;
- gp_Pnt aP1, aP2;
-
- Handle (Geom_BoundedCurve) aGBC=
- Handle (Geom_BoundedCurve)::DownCast(aC3D);
- if (aGBC.IsNull()) {
- return Standard_False;
- }
-
- aF=aC3D->FirstParameter();
- aL=aC3D-> LastParameter();
-
- aC3D->D0(aF, aP1);
- aC3D->D0(aL, aP2);
-
-
- //
- aPC=Precision::Confusion();
- aPC=aPC*aPC;
- aDist=aP1.SquareDistance(aP2);
- bRet=aDist<aPC;
- return bRet;
-}
-
//=======================================================================
//function : RejectLines
//purpose :
Handle (Geom2d_Curve) aC2D2=IC.SecondCurve2d();
Standard_Boolean bIsClosed;
- bIsClosed=IntTools_Tools::IsClosed(aC3D);
- if (!bIsClosed) {
+ bIsClosed = GeomLib::IsClosed(aC3D, Precision::Confusion());
+ if (!bIsClosed)
+ {
return 0;
}
//! Returns True if D1 and D2 coinside with given tolerance
Standard_EXPORT static Standard_Boolean IsDirsCoinside (const gp_Dir& D1, const gp_Dir& D2, const Standard_Real aTol);
-
- //! Returns True if aC is BoundedCurve from Geom and
- //! the distance between first point
- //! of the curve aC and last point
- //! is less than 1.e-12
- Standard_EXPORT static Standard_Boolean IsClosed (const Handle(Geom_Curve)& aC);
-
-
//! Returns adaptive tolerance for given aTolBase
//! if aC is trimmed curve and basis curve is parabola,
//! otherwise returns value of aTolBase
if(bisector->IsPeriodic111()) {
param = Min(bisector->FirstParameter() + bisector->Period(), param);
}
- if (param > bisector->LastParameter()) {
- param = bisector->LastParameter();
+ if (param > bisector->BasisCurve()->LastParameter()) {
+ param = bisector->BasisCurve()->LastParameter();
}
if(bisector->FirstParameter() == param) return Standard_False;
}
// 15.11.2002 PTV OCC966
- if(theCurve->IsPeriodic111())
+ if(theCurve->IsPeriodic111() && theCurve->IsClosed())
{
ElCLib::AdjustPeriodic(cf,cl,Precision::PConfusion(),First,Last); //:a7 abv 11 Feb 98: preci -> PConfusion()
}
return result;
}
- //! Fix possible period jump and handle walking period parameter.
+//=======================================================================
+//function : fixPeriodictyTroubles
+//purpose : Fix possible period jump and handle walking period parameter.
+// This function will adjust only first and last point of thePnt-array
+//=======================================================================
static Standard_Boolean fixPeriodictyTroubles(gp_Pnt2d *thePnt, // pointer to gp_Pnt2d[4] beginning
Standard_Integer theIdx, // Index of objective coord: 1 ~ X, 2 ~ Y
Standard_Real thePeriod, // Period on objective coord
Standard_Integer i = 0;
Standard_Real aTol2 = theTol * theTol;
- Standard_Boolean isPeriodicU = mySurf->Surface()->IsUPeriodic111();
- Standard_Boolean isPeriodicV = mySurf->Surface()->IsVPeriodic111();
+ const Standard_Boolean isPeriodicU = mySurf->Surface()->IsUPeriodic111() &&
+ mySurf->Surface()->IsUClosed(),
+ isPeriodicV = mySurf->Surface()->IsVPeriodic111() &&
+ mySurf->Surface()->IsVClosed();
// Workaround:
// Protection against bad "tolerance" shapes.
Standard_Real preci2d = Precision::PConfusion(); //:S4136: Parametric(preci, 0.01);
// 15.11.2002 PTV OCC966
- if(theCurve2d->IsPeriodic111())
+ if(theCurve2d->IsPeriodic111() && theCurve2d->IsClosed())
{
ElCLib::AdjustPeriodic(cf,cl,preci2d,myFirstParam,myLastParam);
}
Standard_Real aMult = RealLast();
for(Standard_Integer anIdx = 1; anIdx <= myLeft.Upper(); anIdx++)
{
+ const Standard_Real anAbsStep = Abs(TheStep(anIdx));
+ if (anAbsStep < gp::Resolution())
+ continue;
+
if (suivant->Value(anIdx) < myLeft(anIdx))
{
- Standard_Real aValue = Abs(precedent->Value(anIdx) - myLeft(anIdx)) / Abs(TheStep(anIdx));
+ Standard_Real aValue = Abs(precedent->Value(anIdx) - myLeft(anIdx)) / anAbsStep;
aMult = Min (aValue, aMult);
}
if (suivant->Value(anIdx) > myRight(anIdx))
{
- Standard_Real aValue = Abs(precedent->Value(anIdx) - myRight(anIdx)) / Abs(TheStep(anIdx));
+ Standard_Real aValue = Abs(precedent->Value(anIdx) - myRight(anIdx)) / anAbsStep;
aMult = Min (aValue, aMult);
}
}