1 // Created on: 1993-07-23
2 // Created by: Remi LEQUETTE
3 // Copyright (c) 1993-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
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.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
18 #include <BRepBuilderAPI.hxx>
19 #include <BRepPrim_Revolution.hxx>
20 #include <BRepPrimAPI_MakeRevolution.hxx>
21 #include <Geom2d_Curve.hxx>
22 #include <Geom_Curve.hxx>
23 #include <Geom_Plane.hxx>
24 #include <GeomProjLib.hxx>
26 #include <Standard_DomainError.hxx>
28 //=======================================================================
31 //=======================================================================
32 static Handle(Geom2d_Curve) Project(const Handle(Geom_Curve)& M,
35 Handle(Geom2d_Curve) C;
36 C = GeomProjLib::Curve2d(M,new Geom_Plane(Axis));
40 static Handle(Geom2d_Curve) Project(const Handle(Geom_Curve)& M)
42 return Project(M,gp_Ax2(gp::Origin(),-gp::DY(),gp::DX()));
45 //=======================================================================
46 //function : BRepPrimAPI_MakeRevolution
48 //=======================================================================
50 BRepPrimAPI_MakeRevolution::BRepPrimAPI_MakeRevolution
51 (const Handle(Geom_Curve)& Meridian) :
52 myRevolution(gp::XOY(),
53 Meridian->FirstParameter(),
54 Meridian->LastParameter(),
61 //=======================================================================
62 //function : BRepPrimAPI_MakeRevolution
64 //=======================================================================
66 BRepPrimAPI_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(),
75 myRevolution.Angle(angle);
79 //=======================================================================
80 //function : BRepPrimAPI_MakeRevolution
82 //=======================================================================
84 BRepPrimAPI_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)),
97 //=======================================================================
98 //function : BRepPrimAPI_MakeRevolution
100 //=======================================================================
102 BRepPrimAPI_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)),
113 myRevolution.Angle(angle);
117 //=======================================================================
118 //function : BRepPrimAPI_MakeRevolution
120 //=======================================================================
122 BRepPrimAPI_MakeRevolution::BRepPrimAPI_MakeRevolution
124 const Handle(Geom_Curve)& Meridian) :
126 Meridian->FirstParameter(),
127 Meridian->LastParameter(),
134 //=======================================================================
135 //function : BRepPrimAPI_MakeRevolution
137 //=======================================================================
139 BRepPrimAPI_MakeRevolution::BRepPrimAPI_MakeRevolution
141 const Handle(Geom_Curve)& Meridian,
142 const Standard_Real angle) :
144 Meridian->FirstParameter(),
145 Meridian->LastParameter(),
149 myRevolution.Angle(angle);
153 //=======================================================================
154 //function : BRepPrimAPI_MakeRevolution
156 //=======================================================================
158 BRepPrimAPI_MakeRevolution::BRepPrimAPI_MakeRevolution
160 const Handle(Geom_Curve)& Meridian,
161 const Standard_Real VMin,
162 const Standard_Real VMax) :
172 //=======================================================================
173 //function : BRepPrimAPI_MakeRevolution
175 //=======================================================================
177 BRepPrimAPI_MakeRevolution::BRepPrimAPI_MakeRevolution
179 const Handle(Geom_Curve)& Meridian,
180 const Standard_Real VMin,
181 const Standard_Real VMax,
182 const Standard_Real angle) :
189 myRevolution.Angle(angle);
193 //=======================================================================
196 //=======================================================================
198 Standard_Address BRepPrimAPI_MakeRevolution::OneAxis()
200 return &myRevolution;
204 //=======================================================================
205 //function : Revolution
207 //=======================================================================
209 BRepPrim_Revolution& BRepPrimAPI_MakeRevolution::Revolution()