b311480e |
1 | // Created on: 1993-07-23 |
2 | // Created by: Remi LEQUETTE |
3 | // Copyright (c) 1993-1999 Matra Datavision |
973c2be1 |
4 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
5 | // |
973c2be1 |
6 | // This file is part of Open CASCADE Technology software library. |
b311480e |
7 | // |
d5f74e42 |
8 | // This library is free software; you can redistribute it and/or modify it under |
9 | // the terms of the GNU Lesser General Public License version 2.1 as published |
973c2be1 |
10 | // by the Free Software Foundation, with special exception defined in the file |
11 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
12 | // distribution for complete text of the license and disclaimer of any warranty. |
b311480e |
13 | // |
973c2be1 |
14 | // Alternatively, this file may be used under the terms of Open CASCADE |
15 | // commercial license or contractual agreement. |
7fd59977 |
16 | |
7fd59977 |
17 | |
42cf5bc1 |
18 | #include <BRepBuilderAPI.hxx> |
19 | #include <BRepPrim_Sphere.hxx> |
20 | #include <BRepPrimAPI_MakeSphere.hxx> |
7fd59977 |
21 | #include <gp.hxx> |
7fd59977 |
22 | #include <gp_Ax2.hxx> |
42cf5bc1 |
23 | #include <gp_Dir.hxx> |
24 | #include <gp_Pnt.hxx> |
25 | #include <Standard_DomainError.hxx> |
7fd59977 |
26 | |
7fd59977 |
27 | //======================================================================= |
28 | //function : BRepPrimAPI_MakeSphere |
29 | //purpose : |
30 | //======================================================================= |
31 | |
32 | BRepPrimAPI_MakeSphere::BRepPrimAPI_MakeSphere(const Standard_Real R) : |
742cc8b0 |
33 | mySphere(gp::XOY(),R) |
7fd59977 |
34 | { |
35 | } |
36 | |
37 | |
38 | //======================================================================= |
39 | //function : BRepPrimAPI_MakeSphere |
40 | //purpose : |
41 | //======================================================================= |
42 | |
43 | BRepPrimAPI_MakeSphere::BRepPrimAPI_MakeSphere(const Standard_Real R, |
44 | const Standard_Real angle) : |
45 | mySphere(gp_Ax2(gp::Origin(), (angle<0.?-1:1)*gp::DZ(), gp::DX()), |
46 | R) |
47 | { |
48 | mySphere.Angle(Abs(angle)); |
49 | } |
50 | |
51 | |
52 | //======================================================================= |
53 | //function : BRepPrimAPI_MakeSphere |
54 | //purpose : |
55 | //======================================================================= |
56 | |
57 | BRepPrimAPI_MakeSphere::BRepPrimAPI_MakeSphere(const Standard_Real R, |
58 | const Standard_Real angle1, |
59 | const Standard_Real angle2) : |
60 | mySphere(R) |
61 | { |
62 | mySphere.VMin(angle1); |
63 | mySphere.VMax(angle2); |
64 | } |
65 | |
66 | |
67 | //======================================================================= |
68 | //function : BRepPrimAPI_MakeSphere |
69 | //purpose : |
70 | //======================================================================= |
71 | |
72 | BRepPrimAPI_MakeSphere::BRepPrimAPI_MakeSphere(const Standard_Real R, |
73 | const Standard_Real angle1, |
74 | const Standard_Real angle2, |
75 | const Standard_Real angle3) : |
76 | mySphere(R) |
77 | { |
78 | mySphere.VMin(angle1); |
79 | mySphere.VMax(angle2); |
80 | mySphere.Angle(angle3); |
81 | } |
82 | |
83 | //======================================================================= |
84 | //function : BRepPrimAPI_MakeSphere |
85 | //purpose : |
86 | //======================================================================= |
87 | |
88 | BRepPrimAPI_MakeSphere::BRepPrimAPI_MakeSphere(const gp_Pnt& Center, |
89 | const Standard_Real R) : |
90 | mySphere(gp_Ax2(Center, gp_Dir(0,0,1), gp_Dir(1,0,0)), |
91 | R) |
92 | { |
93 | } |
94 | |
95 | |
96 | //======================================================================= |
97 | //function : BRepPrimAPI_MakeSphere |
98 | //purpose : |
99 | //======================================================================= |
100 | |
101 | BRepPrimAPI_MakeSphere::BRepPrimAPI_MakeSphere(const gp_Pnt& Center, |
102 | const Standard_Real R, |
103 | const Standard_Real angle) : |
104 | mySphere(gp_Ax2(Center, gp_Dir(0,0,1), gp_Dir(1,0,0)), |
105 | R) |
106 | { |
107 | mySphere.Angle(angle); |
108 | } |
109 | |
110 | |
111 | //======================================================================= |
112 | //function : BRepPrimAPI_MakeSphere |
113 | //purpose : |
114 | //======================================================================= |
115 | |
116 | BRepPrimAPI_MakeSphere::BRepPrimAPI_MakeSphere(const gp_Pnt& Center, |
117 | const Standard_Real R, |
118 | const Standard_Real angle1, |
119 | const Standard_Real angle2) : |
120 | mySphere(gp_Ax2(Center, gp_Dir(0,0,1), gp_Dir(1,0,0)), |
121 | R) |
122 | { |
123 | mySphere.VMin(angle1); |
124 | mySphere.VMax(angle2); |
125 | } |
126 | |
127 | |
128 | //======================================================================= |
129 | //function : BRepPrimAPI_MakeSphere |
130 | //purpose : |
131 | //======================================================================= |
132 | |
133 | BRepPrimAPI_MakeSphere::BRepPrimAPI_MakeSphere(const gp_Pnt& Center, |
134 | const Standard_Real R, |
135 | const Standard_Real angle1, |
136 | const Standard_Real angle2, |
137 | const Standard_Real angle3) : |
138 | mySphere(gp_Ax2(Center, gp_Dir(0,0,1), gp_Dir(1,0,0)), |
139 | R) |
140 | { |
141 | mySphere.VMin(angle1); |
142 | mySphere.VMax(angle2); |
143 | mySphere.Angle(angle3); |
144 | } |
145 | |
146 | |
147 | //======================================================================= |
148 | //function : BRepPrimAPI_MakeSphere |
149 | //purpose : |
150 | //======================================================================= |
151 | |
152 | BRepPrimAPI_MakeSphere::BRepPrimAPI_MakeSphere(const gp_Ax2& Axis, |
153 | const Standard_Real R) : |
154 | mySphere(Axis, R) |
155 | { |
156 | } |
157 | |
158 | |
159 | //======================================================================= |
160 | //function : BRepPrimAPI_MakeSphere |
161 | //purpose : |
162 | //======================================================================= |
163 | |
164 | BRepPrimAPI_MakeSphere::BRepPrimAPI_MakeSphere(const gp_Ax2& Axis, |
165 | const Standard_Real R, |
166 | const Standard_Real angle) : |
167 | mySphere( Axis, R) |
168 | { |
169 | mySphere.Angle(angle); |
170 | } |
171 | |
172 | |
173 | //======================================================================= |
174 | //function : BRepPrimAPI_MakeSphere |
175 | //purpose : |
176 | //======================================================================= |
177 | |
178 | BRepPrimAPI_MakeSphere::BRepPrimAPI_MakeSphere(const gp_Ax2& Axis, |
179 | const Standard_Real R, |
180 | const Standard_Real angle1, |
181 | const Standard_Real angle2) : |
182 | mySphere(Axis, R) |
183 | { |
184 | mySphere.VMin(angle1); |
185 | mySphere.VMax(angle2); |
186 | } |
187 | |
188 | |
189 | //======================================================================= |
190 | //function : BRepPrimAPI_MakeSphere |
191 | //purpose : |
192 | //======================================================================= |
193 | |
194 | BRepPrimAPI_MakeSphere::BRepPrimAPI_MakeSphere(const gp_Ax2& Axis, |
195 | const Standard_Real R, |
196 | const Standard_Real angle1, |
197 | const Standard_Real angle2, |
198 | const Standard_Real angle3) : |
199 | mySphere( Axis, R) |
200 | { |
201 | mySphere.VMin(angle1); |
202 | mySphere.VMax(angle2); |
203 | mySphere.Angle(angle3); |
204 | } |
205 | |
206 | |
207 | |
208 | //======================================================================= |
209 | //function : OneAxis |
210 | //purpose : |
211 | //======================================================================= |
212 | |
213 | Standard_Address BRepPrimAPI_MakeSphere::OneAxis() |
214 | { |
215 | return &mySphere; |
216 | } |
217 | |
218 | |
219 | //======================================================================= |
220 | //function : Sphere |
221 | //purpose : |
222 | //======================================================================= |
223 | |
224 | BRepPrim_Sphere& BRepPrimAPI_MakeSphere::Sphere() |
225 | { |
226 | return mySphere; |
227 | } |
228 | |
229 | |