0031035: Coding - uninitialized class fields reported by Visual Studio Code Analysis
[occt.git] / src / Extrema / Extrema_ExtElSS.cxx
1 // Copyright (c) 1995-1999 Matra Datavision
2 // Copyright (c) 1999-2014 OPEN CASCADE SAS
3 //
4 // This file is part of Open CASCADE Technology software library.
5 //
6 // This library is free software; you can redistribute it and/or modify it under
7 // the terms of the GNU Lesser General Public License version 2.1 as published
8 // by the Free Software Foundation, with special exception defined in the file
9 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
10 // distribution for complete text of the license and disclaimer of any warranty.
11 //
12 // Alternatively, this file may be used under the terms of Open CASCADE
13 // commercial license or contractual agreement.
14
15
16 #include <Extrema_ExtElSS.hxx>
17 #include <Extrema_ExtPElS.hxx>
18 #include <Extrema_POnSurf.hxx>
19 #include <gp_Cone.hxx>
20 #include <gp_Cylinder.hxx>
21 #include <gp_Pln.hxx>
22 #include <gp_Sphere.hxx>
23 #include <gp_Torus.hxx>
24 #include <Precision.hxx>
25 #include <Standard_NotImplemented.hxx>
26 #include <Standard_OutOfRange.hxx>
27 #include <StdFail_NotDone.hxx>
28
29 Extrema_ExtElSS::Extrema_ExtElSS()
30 {
31   myDone = Standard_False;
32   myIsPar = Standard_False;
33   myNbExt = 0;
34 }
35
36
37 Extrema_ExtElSS::Extrema_ExtElSS(const gp_Pln& S1, const gp_Pln& S2)
38 {
39   Perform(S1, S2);
40 }
41
42
43 void Extrema_ExtElSS::Perform(const gp_Pln& S1, const gp_Pln& S2)
44 {
45
46   myDone = Standard_True;
47   myIsPar = Standard_False;
48   myNbExt = 0;
49
50   if ((S1.Axis().Direction()).IsParallel(S2.Axis().Direction(),
51                                          Precision::Angular())) {
52     myIsPar = Standard_True;
53     myNbExt = 1;
54     mySqDist = new TColStd_HArray1OfReal(1, 1);
55     mySqDist->SetValue(1, S1.SquareDistance(S2));
56   }
57 }
58
59
60 Extrema_ExtElSS::Extrema_ExtElSS(const gp_Pln& S1, const gp_Sphere& S2)
61 {  Perform(S1, S2);}
62
63
64 //void Extrema_ExtElSS::Perform(const gp_Pln& S1, const gp_Sphere& S2)
65 void Extrema_ExtElSS::Perform(const gp_Pln& , const gp_Sphere& )
66 {
67
68   myDone = Standard_True;
69   myIsPar = Standard_False;
70   myNbExt = 0;
71   throw Standard_NotImplemented();
72 }
73
74 Extrema_ExtElSS::Extrema_ExtElSS(const gp_Sphere& S1, const gp_Sphere& S2)
75 {  Perform(S1, S2);}
76
77
78 //void Extrema_ExtElSS::Perform(const gp_Sphere& S1, const gp_Sphere& S2)
79 void Extrema_ExtElSS::Perform(const gp_Sphere& , const gp_Sphere& )
80 {
81   myDone = Standard_True;
82   myIsPar = Standard_False;
83   myNbExt = 0;
84   throw Standard_NotImplemented();
85 }
86
87
88 Extrema_ExtElSS::Extrema_ExtElSS(const gp_Sphere& S1, const gp_Cylinder& S2)
89 {  Perform(S1, S2);}
90
91
92 //void Extrema_ExtElSS::Perform(const gp_Sphere& S1, const gp_Cylinder& S2)
93 void Extrema_ExtElSS::Perform(const gp_Sphere& , const gp_Cylinder& )
94 {
95
96   myDone = Standard_True;
97   myIsPar = Standard_False;
98   myNbExt = 0;
99   throw Standard_NotImplemented();
100 }
101
102 Extrema_ExtElSS::Extrema_ExtElSS(const gp_Sphere& S1, const gp_Cone& S2)
103 {  Perform(S1, S2);}
104
105
106 //void Extrema_ExtElSS::Perform(const gp_Sphere& S1, const gp_Cone& S2)
107 void Extrema_ExtElSS::Perform(const gp_Sphere& , const gp_Cone& )
108 {
109
110   myDone = Standard_True;
111   myIsPar = Standard_False;
112   myNbExt = 0;
113   throw Standard_NotImplemented();
114 }
115
116
117 Extrema_ExtElSS::Extrema_ExtElSS(const gp_Sphere& S1, const gp_Torus& S2)
118 {  Perform(S1, S2);}
119
120
121 //void Extrema_ExtElSS::Perform(const gp_Sphere& S1, const gp_Torus& S2)
122 void Extrema_ExtElSS::Perform(const gp_Sphere& , const gp_Torus& )
123 {
124
125   myDone = Standard_True;
126   myIsPar = Standard_False;
127   myNbExt = 0;
128   throw Standard_NotImplemented();
129 }
130
131
132 Standard_Boolean Extrema_ExtElSS::IsDone() const
133 {
134   return myDone;
135 }
136
137
138 Standard_Boolean Extrema_ExtElSS::IsParallel() const
139 {
140   if (!IsDone()) throw StdFail_NotDone();
141   return myIsPar;
142 }
143
144
145 Standard_Integer Extrema_ExtElSS::NbExt() const
146 {
147   if (!IsDone()) throw StdFail_NotDone();
148   return myNbExt;
149 }
150
151
152 Standard_Real Extrema_ExtElSS::SquareDistance(const Standard_Integer N) const
153 {
154   if (N < 1 || N > NbExt())
155   {
156     throw Standard_OutOfRange();
157   }
158
159   return mySqDist->Value(N);
160 }
161
162
163 void Extrema_ExtElSS::Points(const Standard_Integer N,
164                              Extrema_POnSurf&       P1,
165                              Extrema_POnSurf&       P2) const
166 {
167   if (N < 1 || N > NbExt())
168   {
169     throw Standard_OutOfRange();
170   }
171
172   P1 = myPOnS1->Value(N);
173   P2 = myPOnS2->Value(N);
174 }
175
176