diff --git a/src/IntCurveSurface/IntCurveSurface_Inter.gxx b/src/IntCurveSurface/IntCurveSurface_Inter.gxx index 150a8b1545..56a4f243d9 100755 --- a/src/IntCurveSurface/IntCurveSurface_Inter.gxx +++ b/src/IntCurveSurface/IntCurveSurface_Inter.gxx @@ -18,10 +18,10 @@ // purpose or non-infringement. Please see the License for the specific terms // and conditions governing the rights and limitations under the License. -#ifndef DEB -#define No_Standard_RangeError -#define No_Standard_OutOfRange -#endif +//#ifndef DEB +//#define No_Standard_RangeError +//#define No_Standard_OutOfRange +//#endif #define TOLTANGENCY 0.00000001 @@ -60,11 +60,7 @@ #include #include -#if 0 -//-- jgv patch (from) -#include -//-- jgv patch (to) -#endif + #include #include @@ -77,146 +73,120 @@ #include #include -#if 0 -//-- jgv patch (from) -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -//-- jgv patch (to) -#endif #include #include #include #include -//================================================================================ -static void EstLimForInfExtr(const gp_Lin& Line, - const TheSurface& surface, - const Standard_Boolean IsOffSurf, - const Standard_Integer nbsu, - const Standard_Boolean U1inf, - const Standard_Boolean U2inf, - const Standard_Boolean V1inf, - const Standard_Boolean V2inf, - Standard_Real& U1new, - Standard_Real& U2new, - Standard_Real& V1new, - Standard_Real& V2new, - Standard_Boolean& NoIntersection); +static + void EstLimForInfExtr(const gp_Lin& Line, + const TheSurface& surface, + const Standard_Boolean IsOffSurf, + const Standard_Integer nbsu, + const Standard_Boolean U1inf, + const Standard_Boolean U2inf, + const Standard_Boolean V1inf, + const Standard_Boolean V2inf, + Standard_Real& U1new, + Standard_Real& U2new, + Standard_Real& V1new, + Standard_Real& V2new, + Standard_Boolean& NoIntersection); -//================================================================================ -static void EstLimForInfRevl(const gp_Lin& Line, - const TheSurface& surface, - const Standard_Boolean U1inf, - const Standard_Boolean U2inf, - const Standard_Boolean V1inf, - const Standard_Boolean V2inf, - Standard_Real& U1new, - Standard_Real& U2new, - Standard_Real& V1new, - Standard_Real& V2new, - Standard_Boolean& NoIntersection); +static + void EstLimForInfRevl(const gp_Lin& Line, + const TheSurface& surface, + const Standard_Boolean U1inf, + const Standard_Boolean U2inf, + const Standard_Boolean V1inf, + const Standard_Boolean V2inf, + Standard_Real& U1new, + Standard_Real& U2new, + Standard_Real& V1new, + Standard_Real& V2new, + Standard_Boolean& NoIntersection); -//================================================================================ -static void EstLimForInfOffs(const gp_Lin& Line, - const TheSurface& surface, - const Standard_Integer nbsu, - const Standard_Boolean U1inf, - const Standard_Boolean U2inf, - const Standard_Boolean V1inf, - const Standard_Boolean V2inf, - Standard_Real& U1new, - Standard_Real& U2new, - Standard_Real& V1new, - Standard_Real& V2new, - Standard_Boolean& NoIntersection); +static + void EstLimForInfOffs(const gp_Lin& Line, + const TheSurface& surface, + const Standard_Integer nbsu, + const Standard_Boolean U1inf, + const Standard_Boolean U2inf, + const Standard_Boolean V1inf, + const Standard_Boolean V2inf, + Standard_Real& U1new, + Standard_Real& U2new, + Standard_Real& V1new, + Standard_Real& V2new, + Standard_Boolean& NoIntersection); -//================================================================================ -static void EstLimForInfSurf(Standard_Real& U1new, - Standard_Real& U2new, - Standard_Real& V1new, - Standard_Real& V2new); +static + void EstLimForInfSurf(Standard_Real& U1new, + Standard_Real& U2new, + Standard_Real& V1new, + Standard_Real& V2new); -//================================================================================ -static void SectionPointToParameters(const Intf_SectionPoint& Sp, - const IntCurveSurface_ThePolyhedron& Surf, - const IntCurveSurface_ThePolygon& Curv, - Standard_Real& u, - Standard_Real& v, - Standard_Real& w); -//================================================================================ -static void IntCurveSurface_ComputeTransitions(const TheCurve& curve, - const Standard_Real w, - IntCurveSurface_TransitionOnCurve& TransOnCurve, - const TheSurface& surface, - const Standard_Real u, - const Standard_Real v); -//================================================================================ -static void IntCurveSurface_ComputeParamsOnQuadric(const TheSurface& surface, - const gp_Pnt& P, - Standard_Real& u, - Standard_Real& v); -//================================================================================ -#if 0 -static Handle(Geom_Curve) GetCurve(const Handle(Adaptor3d_HCurve) AdCurve); -//================================================================================ -static Handle(Geom_Surface) GetSurface(const Handle(Adaptor3d_HSurface) AdSurface); -#endif -//================================================================================ -//== -IntCurveSurface_Inter::IntCurveSurface_Inter() { +static + void SectionPointToParameters(const Intf_SectionPoint& Sp, + const IntCurveSurface_ThePolyhedron& Surf, + const IntCurveSurface_ThePolygon& Curv, + Standard_Real& u, + Standard_Real& v, + Standard_Real& w); + +static + void IntCurveSurface_ComputeTransitions(const TheCurve& curve, + const Standard_Real w, + IntCurveSurface_TransitionOnCurve& TransOnCurve, + const TheSurface& surface, + const Standard_Real u, + const Standard_Real v); + +static + void IntCurveSurface_ComputeParamsOnQuadric(const TheSurface& surface, + const gp_Pnt& P, + Standard_Real& u, + Standard_Real& v); + +static + Standard_Boolean DoTrim(const TheCurve& curve, + const TheSurface& surface); +static + void DoCurve(const TheCurve& curve, + Bnd_Box& boxCurve); + +static + void DoCommon(TColStd_Array1OfReal& Coords, + Standard_Real& Cmin, + Standard_Real& Cmax); + +static + void DoCommonBox(const Bnd_Box& boxSurface, + const Bnd_Box& boxCurve, + TColStd_Array1OfReal& X, + TColStd_Array1OfReal& Y, + TColStd_Array1OfReal& Z); + +static + void ProjectIntersectAndEstLim(const gp_Lin& theLine, + const gp_Pln& thePln, + const ProjLib_Plane& theBasCurvProj, + Standard_Real& theVmin, + Standard_Real& theVmax, + Standard_Boolean& theNoIntersection); + +//======================================================================= +//function : IntCurveSurface_Inter +//purpose : +//======================================================================= +IntCurveSurface_Inter::IntCurveSurface_Inter() +{ } - -static Standard_Boolean DoTrim(const TheCurve& curve, - const TheSurface& surface) -{ - Standard_Boolean isAnaCurve = Standard_False, isAnaSurface = Standard_False; - GeomAbs_CurveType CurveType = TheCurveTool::GetType(curve); - switch (CurveType) { - case GeomAbs_Line: - case GeomAbs_Circle: - case GeomAbs_Ellipse: - case GeomAbs_Hyperbola: - case GeomAbs_Parabola: isAnaCurve = Standard_True; break; - default: break; - } - GeomAbs_SurfaceType SurfaceType = TheSurfaceTool::GetType(surface); - switch (SurfaceType) { - case GeomAbs_Plane: - case GeomAbs_Cylinder: - case GeomAbs_Cone: - case GeomAbs_Sphere: - case GeomAbs_Torus: isAnaSurface = Standard_True; break; - default: break; - } - Standard_Boolean result = (isAnaCurve && isAnaSurface) ? Standard_False : Standard_True; - if(result) { - Standard_Boolean isUClosed = (TheSurfaceTool::IsUClosed(surface) || TheSurfaceTool::IsUPeriodic(surface)); - Standard_Boolean isVClosed = (TheSurfaceTool::IsVClosed(surface) || TheSurfaceTool::IsVPeriodic(surface)); - if(isUClosed && isVClosed) - result = Standard_False; - } - return result; -} - -// modified by NIZHNY-MKK Tue Jul 26 14:41:59 2005 -// static void DoSurface(const TheSurface& surface, +//======================================================================= +//function : DoSurface +//purpose : +//======================================================================= void IntCurveSurface_Inter::DoSurface(const TheSurface& surface, const Standard_Real u0, const Standard_Real u1, @@ -261,8 +231,12 @@ void IntCurveSurface_Inter::DoSurface(const TheSurface& surface, gap = Max(Ures,Vres); } -static void DoCurve(const TheCurve& curve, - Bnd_Box& boxCurve) +//======================================================================= +//function : DoCurve +//purpose : +//======================================================================= +void DoCurve(const TheCurve& curve, + Bnd_Box& boxCurve) { Standard_Real CF = TheCurveTool::FirstParameter(curve); Standard_Real CL = TheCurveTool::LastParameter(curve); @@ -282,9 +256,14 @@ static void DoCurve(const TheCurve& curve, boxCurve.Add(aPnt); } } -static void DoCommon(TColStd_Array1OfReal& Coords, - Standard_Real& Cmin, - Standard_Real& Cmax) + +//======================================================================= +//function : DoCommon +//purpose : +//======================================================================= +void DoCommon(TColStd_Array1OfReal& Coords, + Standard_Real& Cmin, + Standard_Real& Cmax) { Standard_Integer i = 0, j = 0; for(i = 1; i <= 4; i++) { @@ -300,6 +279,10 @@ static void DoCommon(TColStd_Array1OfReal& Coords, Cmin = Coords(3); } +//======================================================================= +//function : DoCommonBox +//purpose : +//======================================================================= static void DoCommonBox(const Bnd_Box& boxSurface, const Bnd_Box& boxCurve, TColStd_Array1OfReal& X, @@ -333,9 +316,11 @@ static void DoCommonBox(const Bnd_Box& boxSurface, Z.SetValue(1,CZmin); Z.SetValue(2,CZmax); } -// modified by NIZHNY-MKK Tue Jul 26 14:41:42 2005 +//======================================================================= +//function : DoNewBounds +//purpose : +//======================================================================= void IntCurveSurface_Inter::DoNewBounds( -// static void DoNewBounds( const TheSurface& surface, const Standard_Real u0, const Standard_Real u1, @@ -424,22 +409,17 @@ void IntCurveSurface_Inter::DoNewBounds( } } -//================================================================================ -//== P e r f o r m g e n e r a l -//== -//== Decompose la surface si besoin est -//================================================================================ +//======================================================================= +//function : Perform +//purpose : Decompose la surface si besoin est +//======================================================================= void IntCurveSurface_Inter::Perform(const TheCurve& curve, const TheSurface& surface) { ResetFields(); done = Standard_True; Standard_Integer NbUOnS = TheSurfaceTool::NbUIntervals(surface,GeomAbs_C2); Standard_Integer NbVOnS = TheSurfaceTool::NbVIntervals(surface,GeomAbs_C2); -#ifdef DEB Standard_Integer NbOnC = TheCurveTool::NbIntervals(curve,GeomAbs_C2); -#else - TheCurveTool::NbIntervals(curve,GeomAbs_C2); -#endif Standard_Real U0,U1,V0,V1; if(NbUOnS > 1) { @@ -653,8 +633,10 @@ void IntCurveSurface_Inter::Perform(const TheCurve& curve, Perform(curve,surface,U0,V0,U1,V1); } } -//================================================================================ -//================================================================================ +//======================================================================= +//function : Perform +//purpose : +//======================================================================= void IntCurveSurface_Inter::Perform(const TheCurve& curve, const TheSurface& surface, const Standard_Real U1,const Standard_Real V1, @@ -736,7 +718,10 @@ void IntCurveSurface_Inter::Perform(const TheCurve& curve, } } } -//================================================================================ +//======================================================================= +//function : Perform +//purpose : +//======================================================================= void IntCurveSurface_Inter::Perform(const TheCurve& curve, const IntCurveSurface_ThePolygon& polygon, const TheSurface& surface) { @@ -755,7 +740,10 @@ void IntCurveSurface_Inter::Perform(const TheCurve& curve, IntCurveSurface_ThePolyhedron polyhedron(surface,nbsu,nbsv,u1,v1,u2,v2); Perform(curve,polygon,surface,polyhedron); } -//================================================================================ +//======================================================================= +//function : Perform +//purpose : +//======================================================================= void IntCurveSurface_Inter::Perform(const TheCurve& curve, const TheSurface& surface, const IntCurveSurface_ThePolyhedron& polyhedron) { @@ -766,7 +754,10 @@ void IntCurveSurface_Inter::Perform(const TheCurve& curve, IntCurveSurface_ThePolygon polygon(curve,TheCurveTool::NbSamples(curve,u1,u2)); Perform(curve,polygon,surface,polyhedron); } -//================================================================================ +//======================================================================= +//function : Perform +//purpose : +//======================================================================= void IntCurveSurface_Inter::Perform(const TheCurve& curve, const IntCurveSurface_ThePolygon& polygon, const TheSurface& surface, @@ -781,6 +772,10 @@ void IntCurveSurface_Inter::Perform(const TheCurve& curve, InternalPerform(curve,polygon,surface,polyhedron,u1,v1,u2,v2); } +//======================================================================= +//function : Perform +//purpose : +//======================================================================= void IntCurveSurface_Inter::Perform(const TheCurve& curve, const IntCurveSurface_ThePolygon& polygon, const TheSurface& surface, @@ -795,10 +790,11 @@ void IntCurveSurface_Inter::Perform(const TheCurve& curve, v2 = TheSurfaceTool::LastVParameter(surface); InternalPerform(curve,polygon,surface,polyhedron,u1,v1,u2,v2,BndBSB); } -//================================================================================ -//== C a l c u l d u p o i n t a p p r o c h e == -//== p u i s d u p o i n t E x a c t == -//================================================================================ +//======================================================================= +//function : InternalPerform +//purpose : C a l c u l d u p o i n t a p p r o c h e +//== p u i s d u p o i n t E x a c t +//======================================================================= void IntCurveSurface_Inter::InternalPerform(const TheCurve& curve, const IntCurveSurface_ThePolygon& polygon, const TheSurface& surface, @@ -940,6 +936,10 @@ void IntCurveSurface_Inter::InternalPerform(const TheCurve& curve, } } +//======================================================================= +//function : InternalPerform +//purpose : +//======================================================================= void IntCurveSurface_Inter::InternalPerform(const TheCurve& curve, const IntCurveSurface_ThePolygon& polygon, const TheSurface& surface, @@ -1079,7 +1079,10 @@ void IntCurveSurface_Inter::InternalPerform(const TheCurve& curve, delete [] TabU; } } -//================================================================================ +//======================================================================= +//function : InternalPerformCurveQuadric +//purpose : +//======================================================================= void IntCurveSurface_Inter::InternalPerformCurveQuadric(const TheCurve& curve, const TheSurface& surface) { IntCurveSurface_TheQuadCurvExactInter QuadCurv(surface,curve); @@ -1095,7 +1098,10 @@ void IntCurveSurface_Inter::InternalPerformCurveQuadric(const TheCurve& } } -//================================================================================ +//======================================================================= +//function : InternalPerform +//purpose : +//======================================================================= void IntCurveSurface_Inter::InternalPerform(const TheCurve& curve, const IntCurveSurface_ThePolygon& polygon, const TheSurface& surface, @@ -1148,7 +1154,10 @@ void IntCurveSurface_Inter::InternalPerform(const TheCurve& curve, } } //-- Fin : la Surface est une quadrique } -//================================================================================ +//======================================================================= +//function : PerformConicSurf +//purpose : +//======================================================================= void IntCurveSurface_Inter::PerformConicSurf(const gp_Lin& Line, const TheCurve& curve, const TheSurface& surface, @@ -1275,7 +1284,10 @@ void IntCurveSurface_Inter::PerformConicSurf(const gp_Lin& Line, } } } -//================================================================================ +//======================================================================= +//function : PerformConicSurf +//purpose : +//======================================================================= void IntCurveSurface_Inter::PerformConicSurf(const gp_Circ& Circle, const TheCurve& curve, const TheSurface& surface, @@ -1317,7 +1329,10 @@ void IntCurveSurface_Inter::PerformConicSurf(const gp_Circ& Circle, } } } -//================================================================================ +//======================================================================= +//function : PerformConicSurf +//purpose : +//======================================================================= void IntCurveSurface_Inter::PerformConicSurf(const gp_Elips& Ellipse, const TheCurve& curve, const TheSurface& surface, @@ -1359,7 +1374,10 @@ void IntCurveSurface_Inter::PerformConicSurf(const gp_Elips& Ellipse, } } } -//================================================================================ +//======================================================================= +//function : PerformConicSurf +//purpose : +//======================================================================= void IntCurveSurface_Inter::PerformConicSurf(const gp_Parab& Parab, const TheCurve& curve, const TheSurface& surface, @@ -1415,7 +1433,10 @@ void IntCurveSurface_Inter::PerformConicSurf(const gp_Parab& Parab, } } } -//================================================================================ +//======================================================================= +//function : PerformConicSurf +//purpose : +//======================================================================= void IntCurveSurface_Inter::PerformConicSurf(const gp_Hypr& Hypr, const TheCurve& curve, const TheSurface& surface, @@ -1471,7 +1492,10 @@ void IntCurveSurface_Inter::PerformConicSurf(const gp_Hypr& Hypr, } } } -//================================================================================ +//======================================================================= +//function : AppendIntAna +//purpose : +//======================================================================= void IntCurveSurface_Inter::AppendIntAna(const TheCurve& curve, const TheSurface& surface, const IntAna_IntConicQuad& intana_ConicQuad) { @@ -1497,7 +1521,10 @@ void IntCurveSurface_Inter::AppendIntAna(const TheCurve& curve, //-- cout<<" IntAna Conic Quad Not Done "< U , V e t W == -//================================================================================ +//======================================================================= +//function : SectionPointToParameters +//purpose : P o i n t d i n t e r f e r e n c e - - > +// U , V e t W +//======================================================================= void SectionPointToParameters(const Intf_SectionPoint& Sp, const IntCurveSurface_ThePolyhedron& Polyhedron, const IntCurveSurface_ThePolygon& Polygon, @@ -1633,7 +1666,10 @@ void SectionPointToParameters(const Intf_SectionPoint& Sp, U = u1; V = v1; } -//================================================================================ +//======================================================================= +//function : IntCurveSurface_ComputeTransitions +//purpose : +//======================================================================= void IntCurveSurface_ComputeTransitions(const TheCurve& curve, const Standard_Real w, IntCurveSurface_TransitionOnCurve& TransOnCurve, @@ -1670,7 +1706,10 @@ void IntCurveSurface_ComputeTransitions(const TheCurve& curve, TransOnCurve = IntCurveSurface_Tangent; } } -//================================================================================ +//======================================================================= +//function : IntCurveSurface_ComputeParamsOnQuadric +//purpose : +//======================================================================= void IntCurveSurface_ComputeParamsOnQuadric(const TheSurface& surface, const gp_Pnt& P, Standard_Real& u, @@ -1702,42 +1741,23 @@ void IntCurveSurface_ComputeParamsOnQuadric(const TheSurface& surface, #endif } } -//================================================================================ - - - - -/* - - Standard_Real u1,v1,u2,v2; - u1 = TheSurfaceTool::FirstUParameter(surface); - v1 = TheSurfaceTool::FirstVParameter(surface); - u2 = TheSurfaceTool::LastUParameter(surface); - v2 = TheSurfaceTool::LastVParameter(surface); - Standard_Integer nbsu,nbsv; - nbsu = TheSurfaceTool::NbSamplesU(surface,u1,u2); - nbsv = TheSurfaceTool::NbSamplesV(surface,v1,v2); - IntCurveSurface_ThePolyhedron polyhedron(surface,nbsu,nbsv,u1,v1,u2,v2); - -*/ -//==================================================================================== -// Estimation of limits for infinite surfaces -//==================================================================================== - -//================================================================================ -static void EstLimForInfExtr(const gp_Lin& Line, - const TheSurface& surface, - const Standard_Boolean IsOffSurf, - const Standard_Integer nbsu, - const Standard_Boolean U1inf, - const Standard_Boolean U2inf, - const Standard_Boolean V1inf, - const Standard_Boolean V2inf, - Standard_Real& U1new, - Standard_Real& U2new, - Standard_Real& V1new, - Standard_Real& V2new, - Standard_Boolean& NoIntersection) +//======================================================================= +//function : EstLimForInfExtr +//purpose : Estimation of limits for infinite surfaces +//======================================================================= +void EstLimForInfExtr(const gp_Lin& Line, + const TheSurface& surface, + const Standard_Boolean IsOffSurf, + const Standard_Integer nbsu, + const Standard_Boolean U1inf, + const Standard_Boolean U2inf, + const Standard_Boolean V1inf, + const Standard_Boolean V2inf, + Standard_Real& U1new, + Standard_Real& U2new, + Standard_Real& V1new, + Standard_Real& V2new, + Standard_Boolean& NoIntersection) { @@ -1904,8 +1924,6 @@ static void EstLimForInfExtr(const gp_Lin& Line, return; } - -//================================================================================ //======================================================================= //function : ProjectIntersectAndEstLim //purpose : project and it's X-axe symmetric line to and @@ -1914,20 +1932,19 @@ static void EstLimForInfExtr(const gp_Lin& Line, // . // Is called from EstLimForInfRevl() //======================================================================= - -static void ProjectIntersectAndEstLim(const gp_Lin& theLine, - const gp_Pln& thePln, - const ProjLib_Plane& theBasCurvProj, - Standard_Real& theVmin, - Standard_Real& theVmax, - Standard_Boolean& theNoIntersection) +void ProjectIntersectAndEstLim(const gp_Lin& theLine, + const gp_Pln& thePln, + const ProjLib_Plane& theBasCurvProj, + Standard_Real& theVmin, + Standard_Real& theVmax, + Standard_Boolean& theNoIntersection) { ProjLib_Plane aLineProj( thePln, theLine ); if (!aLineProj.IsDone()) { #ifdef DEB - cout - << "Info: IntCurveSurface_Inter::ProjectIntersectAndEstLim(), !aLineProj.IsDone()" - << endl; + cout + << "Info: IntCurveSurface_Inter::ProjectIntersectAndEstLim(), !aLineProj.IsDone()" + << endl; #endif return; } @@ -1995,18 +2012,17 @@ static void ProjectIntersectAndEstLim(const gp_Lin& theLine, // Algo: intersect projections of Line and basis curve on the // plane passing through revolution axe //======================================================================= - -static void EstLimForInfRevl(const gp_Lin& Line, - const TheSurface& surface, - const Standard_Boolean U1inf, - const Standard_Boolean U2inf, - const Standard_Boolean V1inf, - const Standard_Boolean V2inf, - Standard_Real& U1new, - Standard_Real& U2new, - Standard_Real& V1new, - Standard_Real& V2new, - Standard_Boolean& NoIntersection) +void EstLimForInfRevl(const gp_Lin& Line, + const TheSurface& surface, + const Standard_Boolean U1inf, + const Standard_Boolean U2inf, + const Standard_Boolean V1inf, + const Standard_Boolean V2inf, + Standard_Real& U1new, + Standard_Real& U2new, + Standard_Real& V1new, + Standard_Real& V2new, + Standard_Boolean& NoIntersection) { NoIntersection = Standard_False; @@ -2096,19 +2112,22 @@ static void EstLimForInfRevl(const gp_Lin& Line, return; } -//================================================================================ -static void EstLimForInfOffs(const gp_Lin& Line, - const TheSurface& surface, - const Standard_Integer nbsu, - const Standard_Boolean U1inf, - const Standard_Boolean U2inf, - const Standard_Boolean V1inf, - const Standard_Boolean V2inf, - Standard_Real& U1new, - Standard_Real& U2new, - Standard_Real& V1new, - Standard_Real& V2new, - Standard_Boolean& NoIntersection) +//======================================================================= +//function : EstLimForInfOffs +//purpose : +//======================================================================= +void EstLimForInfOffs(const gp_Lin& Line, + const TheSurface& surface, + const Standard_Integer nbsu, + const Standard_Boolean U1inf, + const Standard_Boolean U2inf, + const Standard_Boolean V1inf, + const Standard_Boolean V2inf, + Standard_Real& U1new, + Standard_Real& U2new, + Standard_Real& V1new, + Standard_Real& V2new, + Standard_Boolean& NoIntersection) { NoIntersection = Standard_False; @@ -2311,117 +2330,93 @@ static void EstLimForInfOffs(const gp_Lin& Line, V1new = Max(V1new, -1.e10); V2new = Min(V2new, 1.e10); - } - } - -//================================================================================ -static void EstLimForInfSurf(Standard_Real& U1new, - Standard_Real& U2new, - Standard_Real& V1new, - Standard_Real& V2new) +//======================================================================= +//function : EstLimForInfSurf +//purpose : +//======================================================================= +void EstLimForInfSurf(Standard_Real& U1new, + Standard_Real& U2new, + Standard_Real& V1new, + Standard_Real& V2new) { U1new = Max(U1new, -1.e10); U2new = Min(U2new, 1.e10); V1new = Max(V1new, -1.e10); V2new = Min(V2new, 1.e10); } - -#if 0 -//-- jgv patch (from) -static Handle(Geom_Curve) GetCurve(const Handle(Adaptor3d_HCurve) AdCurve) +//======================================================================= +//function : DoTrim +//purpose : +//======================================================================= +Standard_Boolean DoTrim(const TheCurve& curve, + const TheSurface& surface) { - Handle(Geom_Curve) theCurve; - GeomAbs_CurveType CurveType = AdCurve->GetType(); - switch (CurveType) - { - case GeomAbs_Line: - theCurve = new Geom_Line( AdCurve->Line() ); - break; - case GeomAbs_Circle: - theCurve = new Geom_Circle( AdCurve->Circle() ); - break; - case GeomAbs_Ellipse: - theCurve = new Geom_Ellipse( AdCurve->Ellipse() ); - break; - case GeomAbs_Hyperbola: - theCurve = new Geom_Hyperbola( AdCurve->Hyperbola() ); - break; - case GeomAbs_Parabola: - theCurve = new Geom_Parabola( AdCurve->Parabola() ); - break; - case GeomAbs_BezierCurve: - theCurve = AdCurve->Bezier(); - break; - case GeomAbs_BSplineCurve: - theCurve = AdCurve->BSpline(); - break; + Standard_Boolean isAnaCurve, isAnaSurface, result; + GeomAbs_CurveType aCT; + GeomAbs_SurfaceType aST; + + isAnaCurve = Standard_False; + isAnaSurface = Standard_False; + // + aCT=TheCurveTool::GetType(curve); + // + isAnaCurve= (aCT==GeomAbs_Line || + aCT==GeomAbs_Circle || + aCT==GeomAbs_Ellipse || + aCT==GeomAbs_Hyperbola || + aCT==GeomAbs_Parabola); + // + aST=TheSurfaceTool::GetType(surface); + isAnaSurface=(aST==GeomAbs_Plane || + aST==GeomAbs_Cylinder || + aST==GeomAbs_Cone || + aST==GeomAbs_Sphere || + aST==GeomAbs_Torus); + // + result = !(isAnaCurve && isAnaSurface); + // + if(result) { + Standard_Boolean isUClosed, isVClosed; + + isUClosed=(TheSurfaceTool::IsUClosed(surface) || + TheSurfaceTool::IsUPeriodic(surface)); + isVClosed=(TheSurfaceTool::IsVClosed(surface) + || TheSurfaceTool::IsVPeriodic(surface)); + if(isUClosed && isVClosed) { + result =!result; } - if (!theCurve.IsNull()) - { - Standard_Real f = AdCurve->FirstParameter(); - Standard_Real l = AdCurve->LastParameter(); - theCurve = new Geom_TrimmedCurve( theCurve, f, l ); + } + //modified by NIZNHY-PKV Wed Apr 04 12:11:01 2012f + if (result) { + Standard_Real aU0,aU1,aV0,aV1, dU, dV, dA, dB, aR, aTresh; + // + aTresh=100.; + aV0 = TheSurfaceTool::FirstVParameter(surface); + aV1 = TheSurfaceTool::LastVParameter(surface); + aU0 = TheSurfaceTool::FirstUParameter(surface); + aU1 = TheSurfaceTool::LastUParameter(surface); + dU=aU1-aU0; + dV=aV1-aV0; + // + dA=dU; + dB=dV; + if (dV>dU) { + dA=dV; + dB=dU; } - return theCurve; + // + aR=dA/dB; + if (dBaTresh) { + result=!result; + } + + } + //modified by NIZNHY-PKV Wed Apr 04 12:11:03 2012t + return result; } - -static Handle(Geom_Surface) GetSurface(const Handle(Adaptor3d_HSurface) AdSurface) -{ - Handle(Geom_Surface) theSurface; - GeomAbs_SurfaceType SurfaceType = AdSurface->GetType(); - switch (SurfaceType) - { - case GeomAbs_Plane: - theSurface = new Geom_Plane( AdSurface->Plane() ); - break; - case GeomAbs_Cylinder: - theSurface = new Geom_CylindricalSurface( AdSurface->Cylinder() ); - break; - case GeomAbs_Cone: - theSurface = new Geom_ConicalSurface( AdSurface->Cone() ); - break; - case GeomAbs_Torus: - theSurface = new Geom_ToroidalSurface( AdSurface->Torus() ); - break; - case GeomAbs_Sphere: - theSurface = new Geom_SphericalSurface( AdSurface->Sphere() ); - break; - case GeomAbs_BezierSurface: - theSurface = AdSurface->Bezier(); - break; - case GeomAbs_BSplineSurface: - theSurface = AdSurface->BSpline(); - break; - case GeomAbs_SurfaceOfRevolution: - { - gp_Ax1 Axis = AdSurface->AxeOfRevolution(); - Handle(Adaptor3d_HCurve) AdBC = AdSurface->BasisCurve(); - Handle(Geom_Curve) BC = GetCurve(AdBC); - if (!BC.IsNull()) - theSurface = new Geom_SurfaceOfRevolution( BC, Axis ); - break; - } - case GeomAbs_SurfaceOfExtrusion: - { - gp_Dir Direction = AdSurface->Direction(); - Handle(Adaptor3d_HCurve) AdBC = AdSurface->BasisCurve(); - Handle(Geom_Curve) BC = GetCurve(AdBC); - if (!BC.IsNull()) - theSurface = new Geom_SurfaceOfLinearExtrusion( BC, Direction ); - break; - } - } - if (!theSurface.IsNull()) - { - Standard_Real uf = AdSurface->FirstUParameter(); - Standard_Real ul = AdSurface->LastUParameter(); - Standard_Real vf = AdSurface->FirstVParameter(); - Standard_Real vl = AdSurface->LastVParameter(); - theSurface = new Geom_RectangularTrimmedSurface( theSurface, uf, ul, vf, vl ); - } - return theSurface; -} -//-- jgv patch (to) -#endif