summaryrefslogtreecommitdiff
path: root/src/Extrema/Extrema_ExtElSS.cxx
blob: 5235237f8a47c78e537fd3bab5d342d0b91f890a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
// File Extrema_ExtElSS.cxx


#include <Extrema_ExtElSS.ixx>
#include <Extrema_ExtPElS.hxx>
#include <Standard_NotImplemented.hxx>
#include <StdFail_NotDone.hxx>
#include <StdFail_InfiniteSolutions.hxx>
#include <Precision.hxx>


Extrema_ExtElSS::Extrema_ExtElSS()
{
  myDone = Standard_False;
  myIsPar = Standard_False;
}


Extrema_ExtElSS::Extrema_ExtElSS(const gp_Pln& S1, const gp_Pln& S2)
{
  Perform(S1, S2);
}


void Extrema_ExtElSS::Perform(const gp_Pln& S1, const gp_Pln& S2)
{

  myDone = Standard_True;
  myIsPar = Standard_False;
  myNbExt = 0;

  if ((S1.Axis().Direction()).IsParallel(S2.Axis().Direction(),
					 Precision::Angular())) {
    myIsPar = Standard_True;
    myNbExt = 1;
    mySqDist = new TColStd_HArray1OfReal(1, 1);
    mySqDist->SetValue(1, S1.SquareDistance(S2));
  }
}


Extrema_ExtElSS::Extrema_ExtElSS(const gp_Pln& S1, const gp_Sphere& S2)
{
  Perform(S1, S2);
}


//void Extrema_ExtElSS::Perform(const gp_Pln& S1, const gp_Sphere& S2)
void Extrema_ExtElSS::Perform(const gp_Pln& , const gp_Sphere& )
{

  myDone = Standard_True;
  myIsPar = Standard_False;
  myNbExt = 0;
  Standard_NotImplemented::Raise();
}

Extrema_ExtElSS::Extrema_ExtElSS(const gp_Sphere& S1, const gp_Sphere& S2)
{
  Perform(S1, S2);
}


//void Extrema_ExtElSS::Perform(const gp_Sphere& S1, const gp_Sphere& S2)
void Extrema_ExtElSS::Perform(const gp_Sphere& , const gp_Sphere& )
{

  myDone = Standard_True;
  myIsPar = Standard_False;
  myNbExt = 0;
  Standard_NotImplemented::Raise();
}


Extrema_ExtElSS::Extrema_ExtElSS(const gp_Sphere& S1, const gp_Cylinder& S2)
{
  Perform(S1, S2);
}


//void Extrema_ExtElSS::Perform(const gp_Sphere& S1, const gp_Cylinder& S2)
void Extrema_ExtElSS::Perform(const gp_Sphere& , const gp_Cylinder& )
{

  myDone = Standard_True;
  myIsPar = Standard_False;
  myNbExt = 0;
  Standard_NotImplemented::Raise();
}

Extrema_ExtElSS::Extrema_ExtElSS(const gp_Sphere& S1, const gp_Cone& S2)
{
  Perform(S1, S2);
}


//void Extrema_ExtElSS::Perform(const gp_Sphere& S1, const gp_Cone& S2)
void Extrema_ExtElSS::Perform(const gp_Sphere& , const gp_Cone& )
{

  myDone = Standard_True;
  myIsPar = Standard_False;
  myNbExt = 0;
  Standard_NotImplemented::Raise();
}


Extrema_ExtElSS::Extrema_ExtElSS(const gp_Sphere& S1, const gp_Torus& S2)
{
  Perform(S1, S2);
}


//void Extrema_ExtElSS::Perform(const gp_Sphere& S1, const gp_Torus& S2)
void Extrema_ExtElSS::Perform(const gp_Sphere& , const gp_Torus& )
{

  myDone = Standard_True;
  myIsPar = Standard_False;
  myNbExt = 0;
  Standard_NotImplemented::Raise();
}


Standard_Boolean Extrema_ExtElSS::IsDone() const
{
  return myDone;
}


Standard_Boolean Extrema_ExtElSS::IsParallel() const
{
  if(!myDone) StdFail_NotDone::Raise();
  return myIsPar;
}


Standard_Integer Extrema_ExtElSS::NbExt() const
{
  if(!myDone) StdFail_NotDone::Raise();
  if (myIsPar) StdFail_InfiniteSolutions::Raise();
  return myNbExt;
}


Standard_Real Extrema_ExtElSS::SquareDistance(const Standard_Integer N) const
{
  if(!myDone) StdFail_NotDone::Raise();
  if (myIsPar && N != 1) StdFail_InfiniteSolutions::Raise();
  return mySqDist->Value(N);
}


void Extrema_ExtElSS::Points(const Standard_Integer N,
			     Extrema_POnSurf&       P1,
			     Extrema_POnSurf&       P2) const
{
  if(!myDone) StdFail_NotDone::Raise();
  if (myIsPar) StdFail_InfiniteSolutions::Raise();
  P1 = myPOnS1->Value(N);
  P2 = myPOnS2->Value(N);
}