0022312: Translation of french commentaries in OCCT files
[occt.git] / src / BRepPrimAPI / BRepPrimAPI_MakeSphere.cxx
CommitLineData
7fd59977 1// File: BRepPrimAPI_MakeSphere.cxx
2// Created: Fri Jul 23 15:51:53 1993
3// Author: Remi LEQUETTE
4// <rle@nonox>
5
6
7#include <BRepPrimAPI_MakeSphere.ixx>
8#include <BRepBuilderAPI.hxx>
9
10
11#include <gp.hxx>
12#include <gp_Dir.hxx>
13#include <gp_Ax2.hxx>
14
15
7fd59977 16static gp_Ax2 SphereComputeAxes() {
17 static Standard_Integer firsttime=1;
18 static Standard_Integer modif=0;
19 static Standard_Real cosa=cos(0.111);
20 static Standard_Real sina=sin(0.111);
21 static Standard_Real ux=1.0;
22 static Standard_Real uy=0.0;
23
24 if(firsttime) {
25 modif = getenv("PRIM_SPHERE") != NULL;
26 firsttime = 0;
27 }
28 if(modif) {
29 Standard_Real nux = cosa*ux+sina*uy;
30 Standard_Real nuy =-sina*ux+cosa*uy;
31 ux=nux; uy=nuy;
32 return(gp_Ax2(gp::Origin(),gp::DZ(),gp_Dir(ux,uy,0.0)));
33 }
34 else {
35 return(gp::XOY());
36 }
37}
38
39
40//=======================================================================
41//function : BRepPrimAPI_MakeSphere
42//purpose :
43//=======================================================================
44
45BRepPrimAPI_MakeSphere::BRepPrimAPI_MakeSphere(const Standard_Real R) :
46 mySphere(SphereComputeAxes(),R)
47{
48}
49
50
51//=======================================================================
52//function : BRepPrimAPI_MakeSphere
53//purpose :
54//=======================================================================
55
56BRepPrimAPI_MakeSphere::BRepPrimAPI_MakeSphere(const Standard_Real R,
57 const Standard_Real angle) :
58 mySphere(gp_Ax2(gp::Origin(), (angle<0.?-1:1)*gp::DZ(), gp::DX()),
59 R)
60{
61 mySphere.Angle(Abs(angle));
62}
63
64
65//=======================================================================
66//function : BRepPrimAPI_MakeSphere
67//purpose :
68//=======================================================================
69
70BRepPrimAPI_MakeSphere::BRepPrimAPI_MakeSphere(const Standard_Real R,
71 const Standard_Real angle1,
72 const Standard_Real angle2) :
73 mySphere(R)
74{
75 mySphere.VMin(angle1);
76 mySphere.VMax(angle2);
77}
78
79
80//=======================================================================
81//function : BRepPrimAPI_MakeSphere
82//purpose :
83//=======================================================================
84
85BRepPrimAPI_MakeSphere::BRepPrimAPI_MakeSphere(const Standard_Real R,
86 const Standard_Real angle1,
87 const Standard_Real angle2,
88 const Standard_Real angle3) :
89 mySphere(R)
90{
91 mySphere.VMin(angle1);
92 mySphere.VMax(angle2);
93 mySphere.Angle(angle3);
94}
95
96//=======================================================================
97//function : BRepPrimAPI_MakeSphere
98//purpose :
99//=======================================================================
100
101BRepPrimAPI_MakeSphere::BRepPrimAPI_MakeSphere(const gp_Pnt& Center,
102 const Standard_Real R) :
103 mySphere(gp_Ax2(Center, gp_Dir(0,0,1), gp_Dir(1,0,0)),
104 R)
105{
106}
107
108
109//=======================================================================
110//function : BRepPrimAPI_MakeSphere
111//purpose :
112//=======================================================================
113
114BRepPrimAPI_MakeSphere::BRepPrimAPI_MakeSphere(const gp_Pnt& Center,
115 const Standard_Real R,
116 const Standard_Real angle) :
117 mySphere(gp_Ax2(Center, gp_Dir(0,0,1), gp_Dir(1,0,0)),
118 R)
119{
120 mySphere.Angle(angle);
121}
122
123
124//=======================================================================
125//function : BRepPrimAPI_MakeSphere
126//purpose :
127//=======================================================================
128
129BRepPrimAPI_MakeSphere::BRepPrimAPI_MakeSphere(const gp_Pnt& Center,
130 const Standard_Real R,
131 const Standard_Real angle1,
132 const Standard_Real angle2) :
133 mySphere(gp_Ax2(Center, gp_Dir(0,0,1), gp_Dir(1,0,0)),
134 R)
135{
136 mySphere.VMin(angle1);
137 mySphere.VMax(angle2);
138}
139
140
141//=======================================================================
142//function : BRepPrimAPI_MakeSphere
143//purpose :
144//=======================================================================
145
146BRepPrimAPI_MakeSphere::BRepPrimAPI_MakeSphere(const gp_Pnt& Center,
147 const Standard_Real R,
148 const Standard_Real angle1,
149 const Standard_Real angle2,
150 const Standard_Real angle3) :
151 mySphere(gp_Ax2(Center, gp_Dir(0,0,1), gp_Dir(1,0,0)),
152 R)
153{
154 mySphere.VMin(angle1);
155 mySphere.VMax(angle2);
156 mySphere.Angle(angle3);
157}
158
159
160//=======================================================================
161//function : BRepPrimAPI_MakeSphere
162//purpose :
163//=======================================================================
164
165BRepPrimAPI_MakeSphere::BRepPrimAPI_MakeSphere(const gp_Ax2& Axis,
166 const Standard_Real R) :
167 mySphere(Axis, R)
168{
169}
170
171
172//=======================================================================
173//function : BRepPrimAPI_MakeSphere
174//purpose :
175//=======================================================================
176
177BRepPrimAPI_MakeSphere::BRepPrimAPI_MakeSphere(const gp_Ax2& Axis,
178 const Standard_Real R,
179 const Standard_Real angle) :
180 mySphere( Axis, R)
181{
182 mySphere.Angle(angle);
183}
184
185
186//=======================================================================
187//function : BRepPrimAPI_MakeSphere
188//purpose :
189//=======================================================================
190
191BRepPrimAPI_MakeSphere::BRepPrimAPI_MakeSphere(const gp_Ax2& Axis,
192 const Standard_Real R,
193 const Standard_Real angle1,
194 const Standard_Real angle2) :
195 mySphere(Axis, R)
196{
197 mySphere.VMin(angle1);
198 mySphere.VMax(angle2);
199}
200
201
202//=======================================================================
203//function : BRepPrimAPI_MakeSphere
204//purpose :
205//=======================================================================
206
207BRepPrimAPI_MakeSphere::BRepPrimAPI_MakeSphere(const gp_Ax2& Axis,
208 const Standard_Real R,
209 const Standard_Real angle1,
210 const Standard_Real angle2,
211 const Standard_Real angle3) :
212 mySphere( Axis, R)
213{
214 mySphere.VMin(angle1);
215 mySphere.VMax(angle2);
216 mySphere.Angle(angle3);
217}
218
219
220
221//=======================================================================
222//function : OneAxis
223//purpose :
224//=======================================================================
225
226Standard_Address BRepPrimAPI_MakeSphere::OneAxis()
227{
228 return &mySphere;
229}
230
231
232//=======================================================================
233//function : Sphere
234//purpose :
235//=======================================================================
236
237BRepPrim_Sphere& BRepPrimAPI_MakeSphere::Sphere()
238{
239 return mySphere;
240}
241
242