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