7fd59977 |
1 | // File: IntCurve_IntConicConic_Tool.hxx |
2 | // Created: Wed May 6 16:02:53 1992 |
3 | // Author: Laurent BUCHARD |
4 | // <lbr@topsn3> |
5 | |
6 | |
7 | |
8 | #ifndef IntCurve_IntConicConic_Tool_HeaderFile |
9 | #define IntCurve_IntConicConic_Tool_HeaderFile |
10 | |
11 | |
12 | #include <IntCurve_IntImpConicParConic.hxx> |
13 | #include <IntCurve_IConicTool.hxx> |
14 | #include <IntCurve_PConic.hxx> |
15 | // #include <IntCurve_IConicPConicTool.hxx> |
16 | #include <IntRes2d_Domain.hxx> |
17 | #include <IntRes2d_Transition.hxx> |
18 | #include <IntRes2d_Position.hxx> |
19 | #include <gp_Vec2d.hxx> |
20 | #include <gp.hxx> |
21 | |
22 | |
c6541a0c |
23 | static Standard_Real PIpPI = M_PI + M_PI; |
7fd59977 |
24 | |
25 | //====================================================================== |
26 | //========== P R O T O T Y P E S ============ |
27 | //====================================================================== |
28 | |
29 | void Determine_Transition_LC(const IntRes2d_Position, |
30 | gp_Vec2d&, |
31 | const gp_Vec2d&, |
32 | IntRes2d_Transition&, |
33 | const IntRes2d_Position, |
34 | gp_Vec2d&, |
35 | const gp_Vec2d&, |
36 | IntRes2d_Transition&, |
37 | const Standard_Real); |
38 | //====================================================================== |
39 | Standard_Real NormalizeOnCircleDomain(const Standard_Real Param,const IntRes2d_Domain& Domain); |
40 | //===================================================================== |
41 | //==== C l a s s e I n t e r v a l !! Specifique !! ======== |
42 | //===================================================================== |
43 | class Interval { |
44 | public: |
45 | Standard_Real Binf; |
46 | Standard_Real Bsup; |
47 | Standard_Boolean HasFirstBound; |
48 | Standard_Boolean HasLastBound; |
49 | Standard_Boolean IsNull; |
50 | |
51 | Interval(); |
52 | Interval(const Standard_Real a,const Standard_Real b); |
53 | Interval(const IntRes2d_Domain& Domain); |
54 | Interval( const Standard_Real a,const Standard_Boolean hf |
55 | ,const Standard_Real b,const Standard_Boolean hl); |
56 | Standard_Real Length(); |
57 | Interval IntersectionWithBounded(const Interval& Inter); |
58 | }; |
59 | |
60 | |
61 | |
62 | //====================================================================== |
63 | //== C L A S S E P E R I O D I C I N T E R V A L (Specifique) |
64 | //====================================================================== |
65 | class PeriodicInterval { |
66 | public: |
67 | Standard_Real Binf; |
68 | Standard_Real Bsup; |
69 | Standard_Boolean isnull; |
70 | |
71 | void SetNull() { isnull=Standard_True; } |
72 | Standard_Boolean IsNull() { return(isnull); } |
73 | |
74 | void Complement() { if(!isnull) { |
75 | Standard_Real t=Binf; Binf=Bsup; Bsup=t+PIpPI; |
76 | if(Binf>PIpPI) { |
77 | Binf-=PIpPI; |
78 | Bsup-=PIpPI; |
79 | } |
80 | } |
81 | } |
82 | |
83 | Standard_Real Length() { return((isnull)? -100.0: Abs(Bsup-Binf)); } |
84 | |
85 | |
86 | PeriodicInterval(const IntRes2d_Domain& Domain) { |
87 | isnull=Standard_False; |
88 | if(Domain.HasFirstPoint()) |
89 | Binf=Domain.FirstParameter(); |
90 | else |
91 | Binf=-1.0; |
92 | if(Domain.HasLastPoint()) |
93 | Bsup=Domain.LastParameter(); |
94 | else |
95 | Bsup=20.0; |
96 | } |
97 | PeriodicInterval() { isnull=Standard_True; Binf=Bsup=0.0; } |
98 | PeriodicInterval(const Standard_Real a,const Standard_Real b) |
99 | { |
100 | isnull=Standard_False; |
101 | Binf=a; |
102 | Bsup=b; |
103 | if((b-a) < PIpPI) |
104 | this->Normalize(); |
105 | } |
106 | void SetValues(const Standard_Real a,const Standard_Real b) |
107 | { |
108 | isnull=Standard_False; |
109 | Binf=a; |
110 | Bsup=b; |
111 | if((b-a) < PIpPI) |
112 | this->Normalize(); |
113 | } |
114 | void Normalize() { |
115 | if(!isnull) { |
116 | while(Binf>PIpPI) Binf-=PIpPI; |
117 | while(Binf<0.0) Binf+=PIpPI; |
118 | while(Bsup<Binf) Bsup+=PIpPI; |
119 | while(Bsup>=(Binf+PIpPI)) Bsup-=PIpPI; |
120 | } |
121 | } |
122 | |
123 | PeriodicInterval FirstIntersection(PeriodicInterval& I1); |
124 | PeriodicInterval SecondIntersection(PeriodicInterval& I2); |
125 | }; |
126 | |
127 | |
128 | #endif |