b311480e |
1 | // Created on: 1992-05-06 |
2 | // Created by: Laurent BUCHARD |
3 | // Copyright (c) 1992-1999 Matra Datavision |
973c2be1 |
4 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
5 | // |
973c2be1 |
6 | // This file is part of Open CASCADE Technology software library. |
b311480e |
7 | // |
d5f74e42 |
8 | // This library is free software; you can redistribute it and/or modify it under |
9 | // the terms of the GNU Lesser General Public License version 2.1 as published |
973c2be1 |
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. |
b311480e |
13 | // |
973c2be1 |
14 | // Alternatively, this file may be used under the terms of Open CASCADE |
15 | // commercial license or contractual agreement. |
7fd59977 |
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 | |
c6541a0c |
32 | static Standard_Real PIpPI = M_PI + M_PI; |
7fd59977 |
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 |