1 // Copyright (c) 1995-1999 Matra Datavision
2 // Copyright (c) 1999-2014 OPEN CASCADE SAS
4 // This file is part of Open CASCADE Technology software library.
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.
12 // Alternatively, this file may be used under the terms of Open CASCADE
13 // commercial license or contractual agreement.
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>
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>
29 Extrema_ExtElSS::Extrema_ExtElSS()
31 myDone = Standard_False;
32 myIsPar = Standard_False;
37 Extrema_ExtElSS::Extrema_ExtElSS(const gp_Pln& S1, const gp_Pln& S2)
43 void Extrema_ExtElSS::Perform(const gp_Pln& S1, const gp_Pln& S2)
46 myDone = Standard_True;
47 myIsPar = Standard_False;
50 if ((S1.Axis().Direction()).IsParallel(S2.Axis().Direction(),
51 Precision::Angular())) {
52 myIsPar = Standard_True;
54 mySqDist = new TColStd_HArray1OfReal(1, 1);
55 mySqDist->SetValue(1, S1.SquareDistance(S2));
60 Extrema_ExtElSS::Extrema_ExtElSS(const gp_Pln& S1, const gp_Sphere& S2)
64 //void Extrema_ExtElSS::Perform(const gp_Pln& S1, const gp_Sphere& S2)
65 void Extrema_ExtElSS::Perform(const gp_Pln& , const gp_Sphere& )
68 myDone = Standard_True;
69 myIsPar = Standard_False;
71 throw Standard_NotImplemented();
74 Extrema_ExtElSS::Extrema_ExtElSS(const gp_Sphere& S1, const gp_Sphere& S2)
78 //void Extrema_ExtElSS::Perform(const gp_Sphere& S1, const gp_Sphere& S2)
79 void Extrema_ExtElSS::Perform(const gp_Sphere& , const gp_Sphere& )
81 myDone = Standard_True;
82 myIsPar = Standard_False;
84 throw Standard_NotImplemented();
88 Extrema_ExtElSS::Extrema_ExtElSS(const gp_Sphere& S1, const gp_Cylinder& S2)
92 //void Extrema_ExtElSS::Perform(const gp_Sphere& S1, const gp_Cylinder& S2)
93 void Extrema_ExtElSS::Perform(const gp_Sphere& , const gp_Cylinder& )
96 myDone = Standard_True;
97 myIsPar = Standard_False;
99 throw Standard_NotImplemented();
102 Extrema_ExtElSS::Extrema_ExtElSS(const gp_Sphere& S1, const gp_Cone& S2)
106 //void Extrema_ExtElSS::Perform(const gp_Sphere& S1, const gp_Cone& S2)
107 void Extrema_ExtElSS::Perform(const gp_Sphere& , const gp_Cone& )
110 myDone = Standard_True;
111 myIsPar = Standard_False;
113 throw Standard_NotImplemented();
117 Extrema_ExtElSS::Extrema_ExtElSS(const gp_Sphere& S1, const gp_Torus& S2)
121 //void Extrema_ExtElSS::Perform(const gp_Sphere& S1, const gp_Torus& S2)
122 void Extrema_ExtElSS::Perform(const gp_Sphere& , const gp_Torus& )
125 myDone = Standard_True;
126 myIsPar = Standard_False;
128 throw Standard_NotImplemented();
132 Standard_Boolean Extrema_ExtElSS::IsDone() const
138 Standard_Boolean Extrema_ExtElSS::IsParallel() const
140 if (!IsDone()) throw StdFail_NotDone();
145 Standard_Integer Extrema_ExtElSS::NbExt() const
147 if (!IsDone()) throw StdFail_NotDone();
152 Standard_Real Extrema_ExtElSS::SquareDistance(const Standard_Integer N) const
154 if (N < 1 || N > NbExt())
156 throw Standard_OutOfRange();
159 return mySqDist->Value(N);
163 void Extrema_ExtElSS::Points(const Standard_Integer N,
165 Extrema_POnSurf& P2) const
167 if (N < 1 || N > NbExt())
169 throw Standard_OutOfRange();
172 P1 = myPOnS1->Value(N);
173 P2 = myPOnS2->Value(N);