0030346: Modeling Algorithms - BRepPrimAPI_MakeRevol throws "BRepSweep_Translation...
[occt.git] / src / BRepSweep / BRepSweep_Prism.cxx
CommitLineData
b311480e 1// Created on: 1993-06-25
2// Created by: Laurent BOURESCHE
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 <BRepSweep_Prism.hxx>
19#include <BRepSweep_Translation.hxx>
20#include <gp_Dir.hxx>
7fd59977 21#include <gp_Trsf.hxx>
42cf5bc1 22#include <gp_Vec.hxx>
7fd59977 23#include <Precision.hxx>
42cf5bc1 24#include <Standard_ConstructionError.hxx>
25#include <Sweep_NumShape.hxx>
26#include <TopLoc_Location.hxx>
27#include <TopoDS_Shape.hxx>
28
7fd59977 29//=======================================================================
30//function : BRepSweep_Prism
31//purpose :
32//=======================================================================
7fd59977 33BRepSweep_Prism::BRepSweep_Prism
34 (const TopoDS_Shape& S,
35 const gp_Vec& V,
36 const Standard_Boolean C,
37 const Standard_Boolean Canonize):
38 myTranslation(S,
39 NumShape(),
40 Location(V),
41 V,
42 C,
43 Canonize)
44{
45 Standard_ConstructionError_Raise_if
46 (V.Magnitude()<=Precision::Confusion(),"BRepSweep_Prism::Constructor");
47}
48
49//=======================================================================
50//function : BRepSweep_Prism
51//purpose :
52//=======================================================================
53
54BRepSweep_Prism::BRepSweep_Prism
55 (const TopoDS_Shape& S,
56 const gp_Dir& D,
57 const Standard_Boolean Inf,
58 const Standard_Boolean C,
59 const Standard_Boolean Canonize):
60 myTranslation(S,
61 NumShape(Inf),
62 Location(D),
63 D,
64 C,
65 Canonize)
66{
67}
68
69
70//=======================================================================
71//function : Shape
72//purpose :
73//=======================================================================
74
75TopoDS_Shape BRepSweep_Prism::Shape()
76{
77 return myTranslation.Shape();
78}
79
80
81//=======================================================================
82//function : Shape
83//purpose :
84//=======================================================================
85
86TopoDS_Shape BRepSweep_Prism::Shape(const TopoDS_Shape& aGenS)
87{
88 return myTranslation.Shape(aGenS);
89}
90
91
92//=======================================================================
93//function : FirstShape
94//purpose :
95//=======================================================================
96
97TopoDS_Shape BRepSweep_Prism::FirstShape()
98{
99 return myTranslation.FirstShape();
100}
101
102
103//=======================================================================
104//function : FirstShape
105//purpose :
106//=======================================================================
107
108TopoDS_Shape BRepSweep_Prism::FirstShape(const TopoDS_Shape& aGenS)
109{
110 return myTranslation.FirstShape(aGenS);
111}
112
113
114//=======================================================================
115//function : LastShape
116//purpose :
117//=======================================================================
118
119TopoDS_Shape BRepSweep_Prism::LastShape()
120{
121 return myTranslation.LastShape();
122}
123
124
125//=======================================================================
126//function : LastShape
127//purpose :
128//=======================================================================
129
130TopoDS_Shape BRepSweep_Prism::LastShape(const TopoDS_Shape& aGenS)
131{
132 return myTranslation.LastShape(aGenS);
133}
134
135
136//=======================================================================
137//function : Vec
138//purpose :
139//=======================================================================
140
141gp_Vec BRepSweep_Prism::Vec()const
142{
143 return myTranslation.Vec();
144}
145
146
147//=======================================================================
148//function : NumShape
149//purpose :
150//=======================================================================
151
152Sweep_NumShape BRepSweep_Prism::NumShape()const
153{
154 return Sweep_NumShape(2,TopAbs_EDGE);
155}
156
157
158//=======================================================================
159//function : NumShape
160//purpose :
161//=======================================================================
162
163Sweep_NumShape BRepSweep_Prism::NumShape(const Standard_Boolean Inf)const
164{
165 Sweep_NumShape N;
166 if(Inf){
167 N.Init(0,TopAbs_EDGE,Standard_False,Standard_True,Standard_True);
168 }
169 else{
170 N.Init(1,TopAbs_EDGE,Standard_False,Standard_False,Standard_True);
171 }
172 return N;
173}
174
175
176//=======================================================================
177//function : Location
178//purpose :
179//=======================================================================
180
181TopLoc_Location BRepSweep_Prism::Location(const gp_Vec& V)const
182{
183 gp_Trsf gpt;
184 gpt.SetTranslation(V);
185 TopLoc_Location L(gpt);
186 return L;
187}
80eeb3ce 188
189//=======================================================================
190//function : IsUsed
191//purpose :
192//=======================================================================
193Standard_Boolean BRepSweep_Prism::IsUsed(const TopoDS_Shape& aGenS) const
194{
195 return myTranslation.IsUsed(aGenS);
196}
197
198//=======================================================================
199//function : GenIsUsed
200//purpose :
201//=======================================================================
202Standard_Boolean BRepSweep_Prism::GenIsUsed(const TopoDS_Shape& aGenS) const
203{
204 return myTranslation.GenIsUsed(aGenS);
205}