Integration of OCCT 6.5.0 from SVN
[occt.git] / src / BRepSweep / BRepSweep_Revol.cxx
CommitLineData
7fd59977 1// File: BRepSweep_Revol.cxx
2// Created: Fri Jun 25 10:25:05 1993
3// Author: Laurent BOURESCHE
4// <lbo@phylox>
5
6
7#include <BRepSweep_Revol.ixx>
8#include <BRepSweep_Rotation.hxx>
9#include <Sweep_NumShape.hxx>
10
11#include <gp_Trsf.hxx>
12#include <Precision.hxx>
13//=======================================================================
14//function : BRepSweep_Revol
15//purpose :
16//=======================================================================
17
18BRepSweep_Revol::BRepSweep_Revol
19 (const TopoDS_Shape& S,
20 const gp_Ax1& Ax,
21 const Standard_Real D,
22 const Standard_Boolean C):
23 myRotation(S.Oriented(TopAbs_FORWARD),
24 NumShape(D),
25 Location(Ax,D),
26 Axe(Ax,D),
27 Angle(D),
28 C)
29{
30 Standard_ConstructionError_Raise_if
31 (Angle(D)<=Precision::Angular(),"BRepSweep_Revol::Constructor");
32}
33
34//=======================================================================
35//function : BRepSweep_Revol
36//purpose :
37//=======================================================================
38
39BRepSweep_Revol::BRepSweep_Revol
40 (const TopoDS_Shape& S,
41 const gp_Ax1& Ax,
42 const Standard_Boolean C):
43 myRotation(S.Oriented(TopAbs_FORWARD),
44 NumShape(2*PI),
45 Location(Ax,2*PI),
46 Axe(Ax,2*PI),
47 Angle(2*PI),
48 C)
49
50{
51}
52
53
54//=======================================================================
55//function : Shape
56//purpose :
57//=======================================================================
58
59TopoDS_Shape BRepSweep_Revol::Shape()
60{
61 return myRotation.Shape();
62}
63
64
65//=======================================================================
66//function : Shape
67//purpose :
68//=======================================================================
69
70TopoDS_Shape BRepSweep_Revol::Shape(const TopoDS_Shape& aGenS)
71{
72 return myRotation.Shape(aGenS);
73}
74
75
76//=======================================================================
77//function : FirstShape
78//purpose :
79//=======================================================================
80
81TopoDS_Shape BRepSweep_Revol::FirstShape()
82{
83 return myRotation.FirstShape();
84}
85
86
87//=======================================================================
88//function : FirstShape
89//purpose :
90//=======================================================================
91
92TopoDS_Shape BRepSweep_Revol::FirstShape(const TopoDS_Shape& aGenS)
93{
94 return myRotation.FirstShape(aGenS);
95}
96
97
98//=======================================================================
99//function : LastShape
100//purpose :
101//=======================================================================
102
103TopoDS_Shape BRepSweep_Revol::LastShape()
104{
105 return myRotation.LastShape();
106}
107
108
109//=======================================================================
110//function : LastShape
111//purpose :
112//=======================================================================
113
114TopoDS_Shape BRepSweep_Revol::LastShape(const TopoDS_Shape& aGenS)
115{
116 return myRotation.LastShape(aGenS);
117}
118
119
120//=======================================================================
121//function : NumShape
122//purpose :
123//=======================================================================
124
125Sweep_NumShape BRepSweep_Revol::NumShape(const Standard_Real D)const
126{
127 Sweep_NumShape N;
128 if (Abs(Angle(D) - 2*PI)<=Precision::Angular()){
129 N.Init(2,TopAbs_EDGE,Standard_True,
130 Standard_False,Standard_False);
131 }
132 else{
133 N.Init(2,TopAbs_EDGE);
134 }
135 return N;
136}
137
138
139//=======================================================================
140//function : Location
141//purpose :
142//=======================================================================
143
144TopLoc_Location BRepSweep_Revol::Location(const gp_Ax1& Ax,
145 const Standard_Real D)const
146{
147 gp_Trsf gpt;
148 gpt.SetRotation(Axe(Ax,D),Angle(D));
149 TopLoc_Location L(gpt);
150 return L;
151}
152
153
154//=======================================================================
155//function : Axe
156//purpose :
157//=======================================================================
158
159gp_Ax1 BRepSweep_Revol::Axe(const gp_Ax1& Ax, const Standard_Real D)const
160{
161 gp_Ax1 A = Ax;
162 if ( D < 0. ) A.Reverse();
163 return A;
164}
165
166
167//=======================================================================
168//function : Angle
169//purpose :
170//=======================================================================
171
172Standard_Real BRepSweep_Revol::Angle(const Standard_Real D)const
173{
174 Standard_Real d = Abs(D);
175 while(d>(2*PI + Precision::Angular())){
176 d = d - 2*PI;
177 }
178 return d;
179}
180
181
182//=======================================================================
183//function : Angle
184//purpose :
185//=======================================================================
186
187Standard_Real BRepSweep_Revol::Angle()const
188{
189 return myRotation.Angle();
190}
191
192
193//=======================================================================
194//function : Axe
195//purpose :
196//=======================================================================
197
198gp_Ax1 BRepSweep_Revol::Axe()const
199{
200 return myRotation.Axe();
201}
202
203