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
6 // This file is part of Open CASCADE Technology software library.
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.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #ifndef IntCurve_IntConicConic_Tool_HeaderFile
18 #define IntCurve_IntConicConic_Tool_HeaderFile
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>
32 static Standard_Real PIpPI = M_PI + M_PI;
34 //======================================================================
35 //========== P R O T O T Y P E S ============
36 //======================================================================
38 void Determine_Transition_LC(const IntRes2d_Position,
42 const IntRes2d_Position,
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 //=====================================================================
56 Standard_Boolean HasFirstBound;
57 Standard_Boolean HasLastBound;
58 Standard_Boolean IsNull;
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);
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 {
78 Standard_Boolean isnull;
80 void SetNull() { isnull=Standard_True; }
81 Standard_Boolean IsNull() { return(isnull); }
83 void Complement() { if(!isnull) {
84 Standard_Real t=Binf; Binf=Bsup; Bsup=t+PIpPI;
92 Standard_Real Length() { return((isnull)? -100.0: Abs(Bsup-Binf)); }
95 PeriodicInterval(const IntRes2d_Domain& Domain) {
96 isnull=Standard_False;
97 if(Domain.HasFirstPoint())
98 Binf=Domain.FirstParameter();
101 if(Domain.HasLastPoint())
102 Bsup=Domain.LastParameter();
106 PeriodicInterval() { isnull=Standard_True; Binf=Bsup=0.0; }
107 PeriodicInterval(const Standard_Real a,const Standard_Real b)
109 isnull=Standard_False;
115 void SetValues(const Standard_Real a,const Standard_Real b)
117 isnull=Standard_False;
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;
132 PeriodicInterval FirstIntersection(PeriodicInterval& I1);
133 PeriodicInterval SecondIntersection(PeriodicInterval& I2);