0024166: Unable to create file with "Save" menu of voxeldemo Qt sample
[occt.git] / src / IntCurve / IntCurve_IntConicConic_Tool.hxx
CommitLineData
b311480e 1// Created on: 1992-05-06
2// Created by: Laurent BUCHARD
3// Copyright (c) 1992-1999 Matra Datavision
4// Copyright (c) 1999-2012 OPEN CASCADE SAS
5//
6// The content of this file is subject to the Open CASCADE Technology Public
7// License Version 6.5 (the "License"). You may not use the content of this file
8// except in compliance with the License. Please obtain a copy of the License
9// at http://www.opencascade.org and read it completely before using this file.
10//
11// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
12// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
13//
14// The Original Code and all software distributed under the License is
15// distributed on an "AS IS" basis, without warranty of any kind, and the
16// Initial Developer hereby disclaims all such warranties, including without
17// limitation, any warranties of merchantability, fitness for a particular
18// purpose or non-infringement. Please see the License for the specific terms
19// and conditions governing the rights and limitations under the License.
20
7fd59977 21
22
23
24#ifndef IntCurve_IntConicConic_Tool_HeaderFile
25#define IntCurve_IntConicConic_Tool_HeaderFile
26
27
28#include <IntCurve_IntImpConicParConic.hxx>
29#include <IntCurve_IConicTool.hxx>
30#include <IntCurve_PConic.hxx>
31// #include <IntCurve_IConicPConicTool.hxx>
32#include <IntRes2d_Domain.hxx>
33#include <IntRes2d_Transition.hxx>
34#include <IntRes2d_Position.hxx>
35#include <gp_Vec2d.hxx>
36#include <gp.hxx>
37
38
c6541a0c 39static Standard_Real PIpPI = M_PI + M_PI;
7fd59977 40
41//======================================================================
42//========== P R O T O T Y P E S ============
43//======================================================================
44
45void Determine_Transition_LC(const IntRes2d_Position,
46 gp_Vec2d&,
47 const gp_Vec2d&,
48 IntRes2d_Transition&,
49 const IntRes2d_Position,
50 gp_Vec2d&,
51 const gp_Vec2d&,
52 IntRes2d_Transition&,
53 const Standard_Real);
54//======================================================================
55Standard_Real NormalizeOnCircleDomain(const Standard_Real Param,const IntRes2d_Domain& Domain);
56//=====================================================================
57//==== C l a s s e I n t e r v a l !! Specifique !! ========
58//=====================================================================
59class Interval {
60 public:
61 Standard_Real Binf;
62 Standard_Real Bsup;
63 Standard_Boolean HasFirstBound;
64 Standard_Boolean HasLastBound;
65 Standard_Boolean IsNull;
66
67 Interval();
68 Interval(const Standard_Real a,const Standard_Real b);
69 Interval(const IntRes2d_Domain& Domain);
70 Interval( const Standard_Real a,const Standard_Boolean hf
71 ,const Standard_Real b,const Standard_Boolean hl);
72 Standard_Real Length();
73 Interval IntersectionWithBounded(const Interval& Inter);
74};
75
76
77
78//======================================================================
79//== C L A S S E P E R I O D I C I N T E R V A L (Specifique)
80//======================================================================
81class PeriodicInterval {
82 public:
83 Standard_Real Binf;
84 Standard_Real Bsup;
85 Standard_Boolean isnull;
86
87 void SetNull() { isnull=Standard_True; }
88 Standard_Boolean IsNull() { return(isnull); }
89
90 void Complement() { if(!isnull) {
91 Standard_Real t=Binf; Binf=Bsup; Bsup=t+PIpPI;
92 if(Binf>PIpPI) {
93 Binf-=PIpPI;
94 Bsup-=PIpPI;
95 }
96 }
97 }
98
99 Standard_Real Length() { return((isnull)? -100.0: Abs(Bsup-Binf)); }
100
101
102 PeriodicInterval(const IntRes2d_Domain& Domain) {
103 isnull=Standard_False;
104 if(Domain.HasFirstPoint())
105 Binf=Domain.FirstParameter();
106 else
107 Binf=-1.0;
108 if(Domain.HasLastPoint())
109 Bsup=Domain.LastParameter();
110 else
111 Bsup=20.0;
112 }
113 PeriodicInterval() { isnull=Standard_True; Binf=Bsup=0.0; }
114 PeriodicInterval(const Standard_Real a,const Standard_Real b)
115 {
116 isnull=Standard_False;
117 Binf=a;
118 Bsup=b;
119 if((b-a) < PIpPI)
120 this->Normalize();
121 }
122 void SetValues(const Standard_Real a,const Standard_Real b)
123 {
124 isnull=Standard_False;
125 Binf=a;
126 Bsup=b;
127 if((b-a) < PIpPI)
128 this->Normalize();
129 }
130 void Normalize() {
131 if(!isnull) {
132 while(Binf>PIpPI) Binf-=PIpPI;
133 while(Binf<0.0) Binf+=PIpPI;
134 while(Bsup<Binf) Bsup+=PIpPI;
135 while(Bsup>=(Binf+PIpPI)) Bsup-=PIpPI;
136 }
137 }
138
139 PeriodicInterval FirstIntersection(PeriodicInterval& I1);
140 PeriodicInterval SecondIntersection(PeriodicInterval& I2);
141};
142
143
144#endif