0029915: Porting to VC 2017 : Regressions in Modeling Algorithms on VC 2017
[occt.git] / src / BRepSweep / BRepSweep_Prism.cxx
1 // Created on: 1993-06-25
2 // Created by: Laurent BOURESCHE
3 // Copyright (c) 1993-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
5 //
6 // This file is part of Open CASCADE Technology software library.
7 //
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
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.
13 //
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
16
17
18 #include <BRepSweep_Prism.hxx>
19 #include <BRepSweep_Translation.hxx>
20 #include <gp_Dir.hxx>
21 #include <gp_Trsf.hxx>
22 #include <gp_Vec.hxx>
23 #include <Precision.hxx>
24 #include <Standard_ConstructionError.hxx>
25 #include <Sweep_NumShape.hxx>
26 #include <TopLoc_Location.hxx>
27 #include <TopoDS_Shape.hxx>
28
29 //=======================================================================
30 //function : BRepSweep_Prism
31 //purpose  : 
32 //=======================================================================
33 BRepSweep_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
54 BRepSweep_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
75 TopoDS_Shape  BRepSweep_Prism::Shape()
76 {
77   return myTranslation.Shape();
78 }
79
80
81 //=======================================================================
82 //function : Shape
83 //purpose  : 
84 //=======================================================================
85
86 TopoDS_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
97 TopoDS_Shape  BRepSweep_Prism::FirstShape()
98 {
99   return myTranslation.FirstShape();
100 }
101
102
103 //=======================================================================
104 //function : FirstShape
105 //purpose  : 
106 //=======================================================================
107
108 TopoDS_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
119 TopoDS_Shape  BRepSweep_Prism::LastShape()
120 {
121   return myTranslation.LastShape();
122 }
123
124
125 //=======================================================================
126 //function : LastShape
127 //purpose  : 
128 //=======================================================================
129
130 TopoDS_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
141 gp_Vec BRepSweep_Prism::Vec()const
142 {
143   return myTranslation.Vec();
144 }
145
146
147 //=======================================================================
148 //function : NumShape
149 //purpose  : 
150 //=======================================================================
151
152 Sweep_NumShape  BRepSweep_Prism::NumShape()const 
153 {
154   return Sweep_NumShape(2,TopAbs_EDGE);
155 }
156
157
158 //=======================================================================
159 //function : NumShape
160 //purpose  : 
161 //=======================================================================
162
163 Sweep_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
181 TopLoc_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 }