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 | |
17 | #include <BRepPrimAPI_MakeRevolution.ixx> |
18 | #include <BRepBuilderAPI.hxx> |
19 | #include <GeomProjLib.hxx> |
20 | #include <Geom2d_Curve.hxx> |
21 | #include <Geom_Plane.hxx> |
22 | |
23 | //======================================================================= |
24 | //function : Project |
25 | //purpose : |
26 | //======================================================================= |
27 | |
28 | static Handle(Geom2d_Curve) Project(const Handle(Geom_Curve)& M, |
29 | const gp_Ax3 Axis) |
30 | { |
31 | Handle(Geom2d_Curve) C; |
32 | C = GeomProjLib::Curve2d(M,new Geom_Plane(Axis)); |
33 | return C; |
34 | } |
35 | |
36 | static Handle(Geom2d_Curve) Project(const Handle(Geom_Curve)& M) |
37 | { |
38 | return Project(M,gp_Ax2(gp::Origin(),-gp::DY(),gp::DX())); |
39 | } |
40 | |
41 | //======================================================================= |
42 | //function : BRepPrimAPI_MakeRevolution |
43 | //purpose : |
44 | //======================================================================= |
45 | |
46 | BRepPrimAPI_MakeRevolution::BRepPrimAPI_MakeRevolution |
47 | (const Handle(Geom_Curve)& Meridian) : |
48 | myRevolution(gp::XOY(), |
49 | Meridian->FirstParameter(), |
50 | Meridian->LastParameter(), |
51 | Meridian, |
52 | Project(Meridian)) |
53 | { |
54 | } |
55 | |
56 | |
57 | //======================================================================= |
58 | //function : BRepPrimAPI_MakeRevolution |
59 | //purpose : |
60 | //======================================================================= |
61 | |
62 | BRepPrimAPI_MakeRevolution::BRepPrimAPI_MakeRevolution |
63 | (const Handle(Geom_Curve)& Meridian, |
64 | const Standard_Real angle) : |
65 | myRevolution(gp_Ax2(gp_Pnt(0,0,0),gp_Dir(0,0,1),gp_Dir(1,0,0)), |
66 | Meridian->FirstParameter(), |
67 | Meridian->LastParameter(), |
68 | Meridian, |
69 | Project(Meridian)) |
70 | { |
71 | myRevolution.Angle(angle); |
72 | } |
73 | |
74 | |
75 | //======================================================================= |
76 | //function : BRepPrimAPI_MakeRevolution |
77 | //purpose : |
78 | //======================================================================= |
79 | |
80 | BRepPrimAPI_MakeRevolution::BRepPrimAPI_MakeRevolution |
81 | (const Handle(Geom_Curve)& Meridian, |
82 | const Standard_Real VMin, |
83 | const Standard_Real VMax) : |
84 | myRevolution(gp_Ax2(gp_Pnt(0,0,0),gp_Dir(0,0,1),gp_Dir(1,0,0)), |
85 | VMin, |
86 | VMax, |
87 | Meridian, |
88 | Project(Meridian)) |
89 | { |
90 | } |
91 | |
92 | |
93 | //======================================================================= |
94 | //function : BRepPrimAPI_MakeRevolution |
95 | //purpose : |
96 | //======================================================================= |
97 | |
98 | BRepPrimAPI_MakeRevolution::BRepPrimAPI_MakeRevolution |
99 | (const Handle(Geom_Curve)& Meridian, |
100 | const Standard_Real VMin, |
101 | const Standard_Real VMax, |
102 | const Standard_Real angle) : |
103 | myRevolution(gp_Ax2(gp_Pnt(0,0,0),gp_Dir(0,0,1),gp_Dir(1,0,0)), |
104 | VMin, |
105 | VMax, |
106 | Meridian, |
107 | Project(Meridian)) |
108 | { |
109 | myRevolution.Angle(angle); |
110 | } |
111 | |
112 | |
113 | //======================================================================= |
114 | //function : BRepPrimAPI_MakeRevolution |
115 | //purpose : |
116 | //======================================================================= |
117 | |
118 | BRepPrimAPI_MakeRevolution::BRepPrimAPI_MakeRevolution |
119 | (const gp_Ax2& Axes, |
120 | const Handle(Geom_Curve)& Meridian) : |
121 | myRevolution(Axes, |
122 | Meridian->FirstParameter(), |
123 | Meridian->LastParameter(), |
124 | Meridian, |
125 | Project(Meridian)) |
126 | { |
127 | } |
128 | |
129 | |
130 | //======================================================================= |
131 | //function : BRepPrimAPI_MakeRevolution |
132 | //purpose : |
133 | //======================================================================= |
134 | |
135 | BRepPrimAPI_MakeRevolution::BRepPrimAPI_MakeRevolution |
136 | (const gp_Ax2& Axes, |
137 | const Handle(Geom_Curve)& Meridian, |
138 | const Standard_Real angle) : |
139 | myRevolution(Axes, |
140 | Meridian->FirstParameter(), |
141 | Meridian->LastParameter(), |
142 | Meridian, |
143 | Project(Meridian)) |
144 | { |
145 | myRevolution.Angle(angle); |
146 | } |
147 | |
148 | |
149 | //======================================================================= |
150 | //function : BRepPrimAPI_MakeRevolution |
151 | //purpose : |
152 | //======================================================================= |
153 | |
154 | BRepPrimAPI_MakeRevolution::BRepPrimAPI_MakeRevolution |
155 | (const gp_Ax2& Axes, |
156 | const Handle(Geom_Curve)& Meridian, |
157 | const Standard_Real VMin, |
158 | const Standard_Real VMax) : |
159 | myRevolution(Axes, |
160 | VMin, |
161 | VMax, |
162 | Meridian, |
163 | Project(Meridian)) |
164 | { |
165 | } |
166 | |
167 | |
168 | //======================================================================= |
169 | //function : BRepPrimAPI_MakeRevolution |
170 | //purpose : |
171 | //======================================================================= |
172 | |
173 | BRepPrimAPI_MakeRevolution::BRepPrimAPI_MakeRevolution |
174 | (const gp_Ax2& Axes, |
175 | const Handle(Geom_Curve)& Meridian, |
176 | const Standard_Real VMin, |
177 | const Standard_Real VMax, |
178 | const Standard_Real angle) : |
179 | myRevolution(Axes, |
180 | VMin, |
181 | VMax, |
182 | Meridian, |
183 | Project(Meridian)) |
184 | { |
185 | myRevolution.Angle(angle); |
186 | } |
187 | |
188 | |
189 | //======================================================================= |
190 | //function : OneAxis |
191 | //purpose : |
192 | //======================================================================= |
193 | |
194 | Standard_Address BRepPrimAPI_MakeRevolution::OneAxis() |
195 | { |
196 | return &myRevolution; |
197 | } |
198 | |
199 | |
200 | //======================================================================= |
201 | //function : Revolution |
202 | //purpose : |
203 | //======================================================================= |
204 | |
205 | BRepPrim_Revolution& BRepPrimAPI_MakeRevolution::Revolution() |
206 | { |
207 | return myRevolution; |
208 | } |
209 | |
210 | |