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
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.
17 #include <BRepPrim_Cylinder.ixx>
21 #include <Precision.hxx>
22 #include <Geom_CylindricalSurface.hxx>
23 #include <Geom_Line.hxx>
24 #include <Geom2d_Line.hxx>
26 //=======================================================================
27 //function : BRepPrim_Cylinder
29 //=======================================================================
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),
40 //=======================================================================
41 //function : BRepPrim_Cylinder
43 //=======================================================================
45 BRepPrim_Cylinder::BRepPrim_Cylinder(const Standard_Real Radius) :
46 BRepPrim_Revolution(gp::XOY(),RealFirst(),RealLast()),
52 //=======================================================================
53 //function : BRepPrim_Cylinder
55 //=======================================================================
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()),
66 //=======================================================================
67 //function : BRepPrim_Cylinder
69 //=======================================================================
71 BRepPrim_Cylinder::BRepPrim_Cylinder(const gp_Ax2& Axes,
72 const Standard_Real Radius) :
73 BRepPrim_Revolution(Axes, RealFirst(),RealLast()),
79 //=======================================================================
80 //function : BRepPrim_Cylinder
82 //=======================================================================
84 BRepPrim_Cylinder::BRepPrim_Cylinder(const Standard_Real R,
85 const Standard_Real H) :
86 BRepPrim_Revolution(gp::XOY(), 0, H),
92 //=======================================================================
93 //function : BRepPrim_Cylinder
95 //=======================================================================
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)),
107 //=======================================================================
108 //function : MakeEmptyLateralFace
110 //=======================================================================
112 TopoDS_Face BRepPrim_Cylinder::MakeEmptyLateralFace() const
114 Handle(Geom_CylindricalSurface) C =
115 new Geom_CylindricalSurface(Axes(),myRadius);
117 myBuilder.Builder().MakeFace(F,C,Precision::Confusion());
121 //=======================================================================
122 //function : SetMeridian
124 //=======================================================================
126 void BRepPrim_Cylinder::SetMeridian()
128 gp_Vec V = Axes().XDirection();
129 V.Multiply(myRadius);
130 gp_Ax1 A = Axes().Axis();
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));