0024510: Remove unused local variables
[occt.git] / src / IntCurve / IntCurve_IntConicConic_Tool.hxx
1 // Created on: 1992-05-06
2 // Created by: Laurent BUCHARD
3 // Copyright (c) 1992-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
5 //
6 // This file is part of Open CASCADE Technology software library.
7 //
8 // This library is free software; you can redistribute it and / or modify it
9 // under the terms of the GNU Lesser General Public version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
13 //
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
16
17 #ifndef IntCurve_IntConicConic_Tool_HeaderFile
18 #define IntCurve_IntConicConic_Tool_HeaderFile
19
20
21 #include <IntCurve_IntImpConicParConic.hxx>
22 #include <IntCurve_IConicTool.hxx>
23 #include <IntCurve_PConic.hxx>
24 // #include <IntCurve_IConicPConicTool.hxx>
25 #include <IntRes2d_Domain.hxx>
26 #include <IntRes2d_Transition.hxx>
27 #include <IntRes2d_Position.hxx>
28 #include <gp_Vec2d.hxx>
29 #include <gp.hxx>
30
31
32 static Standard_Real PIpPI = M_PI + M_PI;
33
34 //======================================================================
35 //==========          P R O T O T Y P E S                   ============
36 //======================================================================
37
38 void Determine_Transition_LC(const IntRes2d_Position,
39                              gp_Vec2d&,
40                              const gp_Vec2d&,
41                              IntRes2d_Transition&,
42                              const IntRes2d_Position,
43                              gp_Vec2d&,
44                              const gp_Vec2d&,
45                              IntRes2d_Transition&,
46                              const Standard_Real);
47 //======================================================================
48 Standard_Real NormalizeOnCircleDomain(const Standard_Real Param,const IntRes2d_Domain& Domain);
49 //=====================================================================
50 //====   C l a s s e     I n t e r v a l      !! Specifique !! ========
51 //=====================================================================
52 class Interval {
53  public:
54   Standard_Real Binf;
55   Standard_Real Bsup;
56   Standard_Boolean HasFirstBound;
57   Standard_Boolean HasLastBound;
58   Standard_Boolean IsNull;
59   
60   Interval();
61   Interval(const Standard_Real a,const Standard_Real b);
62   Interval(const IntRes2d_Domain& Domain);
63   Interval( const Standard_Real a,const Standard_Boolean hf
64            ,const Standard_Real b,const Standard_Boolean hl);
65   Standard_Real Length(); 
66   Interval IntersectionWithBounded(const Interval& Inter);
67 };
68
69
70
71 //======================================================================
72 //==  C L A S S E    P E R I O D I C    I N T E R V A L  (Specifique)
73 //======================================================================
74 class PeriodicInterval {
75  public:
76   Standard_Real Binf;
77   Standard_Real Bsup;
78   Standard_Boolean isnull;
79
80   void SetNull()      { isnull=Standard_True; }
81   Standard_Boolean IsNull()    { return(isnull); }
82
83   void Complement()   { if(!isnull) {
84                           Standard_Real t=Binf; Binf=Bsup; Bsup=t+PIpPI;
85                           if(Binf>PIpPI) {
86                             Binf-=PIpPI;
87                             Bsup-=PIpPI;
88                           }
89                         }
90                       }
91
92   Standard_Real Length()       { return((isnull)? -100.0: Abs(Bsup-Binf)); }
93
94
95   PeriodicInterval(const IntRes2d_Domain& Domain) {  
96                         isnull=Standard_False;
97                         if(Domain.HasFirstPoint())  
98                           Binf=Domain.FirstParameter();
99                         else
100                           Binf=-1.0;
101                         if(Domain.HasLastPoint()) 
102                           Bsup=Domain.LastParameter();
103                         else
104                           Bsup=20.0;
105                       }
106   PeriodicInterval()  { isnull=Standard_True; Binf=Bsup=0.0; }
107   PeriodicInterval(const Standard_Real a,const Standard_Real b) 
108                       {
109                         isnull=Standard_False;
110                         Binf=a;
111                         Bsup=b;
112                         if((b-a) < PIpPI)
113                           this->Normalize();
114                       }
115   void SetValues(const Standard_Real a,const Standard_Real b)
116                       {
117                         isnull=Standard_False;
118                         Binf=a;
119                         Bsup=b;
120                         if((b-a) < PIpPI)
121                           this->Normalize();
122                       }
123   void Normalize() {
124                    if(!isnull) {
125                      while(Binf>PIpPI) Binf-=PIpPI;
126                      while(Binf<0.0)   Binf+=PIpPI;
127                      while(Bsup<Binf)  Bsup+=PIpPI;
128                      while(Bsup>=(Binf+PIpPI)) Bsup-=PIpPI;
129                    }
130                  }
131     
132   PeriodicInterval FirstIntersection(PeriodicInterval& I1);
133   PeriodicInterval SecondIntersection(PeriodicInterval& I2);
134 };
135
136
137 #endif