Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:04:06

0001 // Created on: 1992-05-06
0002 // Created by: Laurent BUCHARD
0003 // Copyright (c) 1992-1999 Matra Datavision
0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0005 //
0006 // This file is part of Open CASCADE Technology software library.
0007 //
0008 // This library is free software; you can redistribute it and/or modify it under
0009 // the terms of the GNU Lesser General Public License version 2.1 as published
0010 // by the Free Software Foundation, with special exception defined in the file
0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0012 // distribution for complete text of the license and disclaimer of any warranty.
0013 //
0014 // Alternatively, this file may be used under the terms of Open CASCADE
0015 // commercial license or contractual agreement.
0016 
0017 #ifndef IntCurve_IntConicConic_Tool_HeaderFile
0018 #define IntCurve_IntConicConic_Tool_HeaderFile
0019 
0020 
0021 #include <IntCurve_IntImpConicParConic.hxx>
0022 // #include <IntCurve_IConicPConicTool.hxx>
0023 #include <IntRes2d_Domain.hxx>
0024 #include <IntRes2d_Transition.hxx>
0025 #include <IntRes2d_Position.hxx>
0026 
0027 
0028 static Standard_Real PIpPI = M_PI + M_PI;
0029 
0030 //======================================================================
0031 //==========          P R O T O T Y P E S                   ============
0032 //======================================================================
0033 
0034 void Determine_Transition_LC(const IntRes2d_Position,
0035                  gp_Vec2d&,
0036                  const gp_Vec2d&,
0037                  IntRes2d_Transition&,
0038                  const IntRes2d_Position,
0039                  gp_Vec2d&,
0040                  const gp_Vec2d&,
0041                  IntRes2d_Transition&,
0042                  const Standard_Real);
0043 //======================================================================
0044 Standard_Real NormalizeOnCircleDomain(const Standard_Real Param,const IntRes2d_Domain& Domain);
0045 //=====================================================================
0046 //====   C l a s s e     I n t e r v a l      !! Specifique !! ========
0047 //=====================================================================
0048 class Interval {
0049  public:
0050   Standard_Real Binf;
0051   Standard_Real Bsup;
0052   Standard_Boolean HasFirstBound;
0053   Standard_Boolean HasLastBound;
0054   Standard_Boolean IsNull;
0055   
0056   Interval();
0057   Interval(const Standard_Real a,const Standard_Real b);
0058   Interval(const IntRes2d_Domain& Domain);
0059   Interval( const Standard_Real a,const Standard_Boolean hf
0060        ,const Standard_Real b,const Standard_Boolean hl);
0061   Standard_Real Length(); 
0062   Interval IntersectionWithBounded(const Interval& Inter);
0063 };
0064 
0065 
0066 
0067 //======================================================================
0068 //==  C L A S S E    P E R I O D I C    I N T E R V A L  (Specifique)
0069 //======================================================================
0070 class PeriodicInterval {
0071  public:
0072   Standard_Real Binf;
0073   Standard_Real Bsup;
0074   Standard_Boolean isnull;
0075 
0076   void SetNull()      { isnull=Standard_True; }
0077   Standard_Boolean IsNull()    { return(isnull); }
0078 
0079   void Complement()   { if(!isnull) {
0080                           Standard_Real t=Binf; Binf=Bsup; Bsup=t+PIpPI;
0081               if(Binf>PIpPI) {
0082                 Binf-=PIpPI;
0083                 Bsup-=PIpPI;
0084               }
0085             }
0086               }
0087 
0088   Standard_Real Length()       { return((isnull)? -100.0: Abs(Bsup-Binf)); }
0089 
0090 
0091   PeriodicInterval(const IntRes2d_Domain& Domain) {  
0092                         isnull=Standard_False;
0093                         if(Domain.HasFirstPoint())  
0094               Binf=Domain.FirstParameter();
0095             else
0096               Binf=-1.0;
0097             if(Domain.HasLastPoint()) 
0098               Bsup=Domain.LastParameter();
0099             else
0100               Bsup=20.0;
0101               }
0102   PeriodicInterval()  { isnull=Standard_True; Binf=Bsup=0.0; }
0103   PeriodicInterval(const Standard_Real a,const Standard_Real b) 
0104                       {
0105             isnull=Standard_False;
0106             Binf=a;
0107             Bsup=b;
0108             if((b-a) < PIpPI)
0109               this->Normalize();
0110               }
0111   void SetValues(const Standard_Real a,const Standard_Real b)
0112                       {
0113             isnull=Standard_False;
0114             Binf=a;
0115             Bsup=b;
0116             if((b-a) < PIpPI)
0117               this->Normalize();
0118               }
0119   void Normalize() {
0120                    if(!isnull) {
0121              while(Binf>PIpPI) Binf-=PIpPI;
0122              while(Binf<0.0)   Binf+=PIpPI;
0123              while(Bsup<Binf)  Bsup+=PIpPI;
0124              while(Bsup>=(Binf+PIpPI)) Bsup-=PIpPI;
0125            }
0126          }
0127     
0128   PeriodicInterval FirstIntersection(PeriodicInterval& I1);
0129   PeriodicInterval SecondIntersection(PeriodicInterval& I2);
0130 };
0131 
0132 
0133 #endif