0024624: Lost word in license statement in source files
[occt.git] / src / BRepPrim / BRepPrim_Cylinder.cxx
1 // Created on: 1992-11-06
2 // Created by: Remi LEQUETTE
3 // Copyright (c) 1992-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 #include <BRepPrim_Cylinder.ixx>
18
19 #include <gp.hxx>
20 #include <gp_Vec.hxx>
21 #include <Precision.hxx>
22 #include <Geom_CylindricalSurface.hxx>
23 #include <Geom_Line.hxx>
24 #include <Geom2d_Line.hxx>
25
26 //=======================================================================
27 //function : BRepPrim_Cylinder
28 //purpose  : 
29 //=======================================================================
30
31 BRepPrim_Cylinder::BRepPrim_Cylinder(const gp_Ax2& Position, 
32                                      const Standard_Real Radius,
33                                      const Standard_Real Height) : 
34        BRepPrim_Revolution(Position,0,Height),
35        myRadius(Radius)
36 {
37   SetMeridian();
38 }
39
40 //=======================================================================
41 //function : BRepPrim_Cylinder
42 //purpose  : 
43 //=======================================================================
44
45 BRepPrim_Cylinder::BRepPrim_Cylinder(const Standard_Real Radius) :
46        BRepPrim_Revolution(gp::XOY(),RealFirst(),RealLast()),
47        myRadius(Radius)
48 {
49   SetMeridian();
50 }
51
52 //=======================================================================
53 //function : BRepPrim_Cylinder
54 //purpose  : 
55 //=======================================================================
56
57 BRepPrim_Cylinder::BRepPrim_Cylinder(const gp_Pnt& Center, 
58                                      const Standard_Real Radius) :
59        BRepPrim_Revolution(gp_Ax2(Center,gp_Dir(0,0,1),gp_Dir(1,0,0)),
60                            RealFirst(),RealLast()),
61        myRadius(Radius)
62 {
63   SetMeridian();
64 }
65
66 //=======================================================================
67 //function : BRepPrim_Cylinder
68 //purpose  : 
69 //=======================================================================
70
71 BRepPrim_Cylinder::BRepPrim_Cylinder(const gp_Ax2& Axes,
72                                      const Standard_Real Radius) :
73        BRepPrim_Revolution(Axes, RealFirst(),RealLast()),
74        myRadius(Radius)
75 {
76   SetMeridian();
77 }
78
79 //=======================================================================
80 //function : BRepPrim_Cylinder
81 //purpose  : 
82 //=======================================================================
83
84 BRepPrim_Cylinder::BRepPrim_Cylinder(const Standard_Real R,
85                                      const Standard_Real H) :
86        BRepPrim_Revolution(gp::XOY(), 0, H),
87        myRadius(R)
88 {
89   SetMeridian();
90 }
91
92 //=======================================================================
93 //function : BRepPrim_Cylinder
94 //purpose  : 
95 //=======================================================================
96
97 BRepPrim_Cylinder::BRepPrim_Cylinder(const gp_Pnt& Center, 
98                                      const Standard_Real R, 
99                                      const Standard_Real H) :
100        BRepPrim_Revolution(gp_Ax2(Center,gp_Dir(0,0,1),gp_Dir(1,0,0)),
101                            0,H),
102        myRadius(R)
103 {
104   SetMeridian();
105 }
106
107 //=======================================================================
108 //function : MakeEmptyLateralFace
109 //purpose  : 
110 //=======================================================================
111
112 TopoDS_Face  BRepPrim_Cylinder::MakeEmptyLateralFace() const 
113 {
114   Handle(Geom_CylindricalSurface) C =
115     new Geom_CylindricalSurface(Axes(),myRadius);
116   TopoDS_Face F;
117   myBuilder.Builder().MakeFace(F,C,Precision::Confusion());
118   return F;
119 }
120
121 //=======================================================================
122 //function : SetMeridian
123 //purpose  : 
124 //=======================================================================
125
126 void BRepPrim_Cylinder::SetMeridian()
127 {
128   gp_Vec V = Axes().XDirection();
129   V.Multiply(myRadius);
130   gp_Ax1 A = Axes().Axis();
131   A.Translate(V);
132   Handle(Geom_Line) L = new Geom_Line(A);
133   Handle(Geom2d_Line) L2d = new Geom2d_Line(gp_Pnt2d(myRadius,0),gp_Dir2d(0,1));
134   Meridian(L,L2d);
135 }