0026937: Eliminate NO_CXX_EXCEPTION macro support
[occt.git] / src / Extrema / Extrema_ExtElSS.cxx
CommitLineData
b311480e 1// Copyright (c) 1995-1999 Matra Datavision
973c2be1 2// Copyright (c) 1999-2014 OPEN CASCADE SAS
b311480e 3//
973c2be1 4// This file is part of Open CASCADE Technology software library.
b311480e 5//
d5f74e42 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
973c2be1 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.
b311480e 11//
973c2be1 12// Alternatively, this file may be used under the terms of Open CASCADE
13// commercial license or contractual agreement.
7fd59977 14
42cf5bc1 15
16#include <Extrema_ExtElSS.hxx>
7fd59977 17#include <Extrema_ExtPElS.hxx>
42cf5bc1 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>
7fd59977 25#include <Standard_NotImplemented.hxx>
42cf5bc1 26#include <Standard_OutOfRange.hxx>
7fd59977 27#include <StdFail_InfiniteSolutions.hxx>
42cf5bc1 28#include <StdFail_NotDone.hxx>
7fd59977 29
30Extrema_ExtElSS::Extrema_ExtElSS()
31{
32 myDone = Standard_False;
33 myIsPar = Standard_False;
34}
35
36
37Extrema_ExtElSS::Extrema_ExtElSS(const gp_Pln& S1, const gp_Pln& S2)
38{
39 Perform(S1, S2);
40}
41
42
43void 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
60Extrema_ExtElSS::Extrema_ExtElSS(const gp_Pln& S1, const gp_Sphere& S2)
9775fa61 61{ Perform(S1, S2);}
7fd59977 62
63
64//void Extrema_ExtElSS::Perform(const gp_Pln& S1, const gp_Sphere& S2)
65void Extrema_ExtElSS::Perform(const gp_Pln& , const gp_Sphere& )
66{
67
68 myDone = Standard_True;
69 myIsPar = Standard_False;
70 myNbExt = 0;
9775fa61 71 throw Standard_NotImplemented();
7fd59977 72}
73
74Extrema_ExtElSS::Extrema_ExtElSS(const gp_Sphere& S1, const gp_Sphere& S2)
9775fa61 75{ Perform(S1, S2);}
7fd59977 76
77
78//void Extrema_ExtElSS::Perform(const gp_Sphere& S1, const gp_Sphere& S2)
79void Extrema_ExtElSS::Perform(const gp_Sphere& , const gp_Sphere& )
80{
7fd59977 81 myDone = Standard_True;
82 myIsPar = Standard_False;
83 myNbExt = 0;
9775fa61 84 throw Standard_NotImplemented();
7fd59977 85}
86
87
88Extrema_ExtElSS::Extrema_ExtElSS(const gp_Sphere& S1, const gp_Cylinder& S2)
9775fa61 89{ Perform(S1, S2);}
7fd59977 90
91
92//void Extrema_ExtElSS::Perform(const gp_Sphere& S1, const gp_Cylinder& S2)
93void Extrema_ExtElSS::Perform(const gp_Sphere& , const gp_Cylinder& )
94{
95
96 myDone = Standard_True;
97 myIsPar = Standard_False;
98 myNbExt = 0;
9775fa61 99 throw Standard_NotImplemented();
7fd59977 100}
101
102Extrema_ExtElSS::Extrema_ExtElSS(const gp_Sphere& S1, const gp_Cone& S2)
9775fa61 103{ Perform(S1, S2);}
7fd59977 104
105
106//void Extrema_ExtElSS::Perform(const gp_Sphere& S1, const gp_Cone& S2)
107void Extrema_ExtElSS::Perform(const gp_Sphere& , const gp_Cone& )
108{
109
110 myDone = Standard_True;
111 myIsPar = Standard_False;
112 myNbExt = 0;
9775fa61 113 throw Standard_NotImplemented();
7fd59977 114}
115
116
117Extrema_ExtElSS::Extrema_ExtElSS(const gp_Sphere& S1, const gp_Torus& S2)
9775fa61 118{ Perform(S1, S2);}
7fd59977 119
120
121//void Extrema_ExtElSS::Perform(const gp_Sphere& S1, const gp_Torus& S2)
122void Extrema_ExtElSS::Perform(const gp_Sphere& , const gp_Torus& )
123{
124
125 myDone = Standard_True;
126 myIsPar = Standard_False;
127 myNbExt = 0;
9775fa61 128 throw Standard_NotImplemented();
7fd59977 129}
130
131
132Standard_Boolean Extrema_ExtElSS::IsDone() const
133{
134 return myDone;
135}
136
137
138Standard_Boolean Extrema_ExtElSS::IsParallel() const
139{
9775fa61 140 if(!myDone) throw StdFail_NotDone();
7fd59977 141 return myIsPar;
142}
143
144
145Standard_Integer Extrema_ExtElSS::NbExt() const
146{
9775fa61 147 if(!myDone) throw StdFail_NotDone();
148 if (myIsPar) throw StdFail_InfiniteSolutions();
7fd59977 149 return myNbExt;
150}
151
152
153Standard_Real Extrema_ExtElSS::SquareDistance(const Standard_Integer N) const
154{
9775fa61 155 if(!myDone) throw StdFail_NotDone();
156 if (myIsPar && N != 1) throw StdFail_InfiniteSolutions();
7fd59977 157 return mySqDist->Value(N);
158}
159
160
161void Extrema_ExtElSS::Points(const Standard_Integer N,
162 Extrema_POnSurf& P1,
163 Extrema_POnSurf& P2) const
164{
9775fa61 165 if(!myDone) throw StdFail_NotDone();
166 if (myIsPar) throw StdFail_InfiniteSolutions();
7fd59977 167 P1 = myPOnS1->Value(N);
168 P2 = myPOnS2->Value(N);
169}
170
171