0031642: Visualization - crash in Graphic3d_Structure::SetVisual() on redisplaying...
[occt.git] / src / gce / gce_MakeCylinder.hxx
1 // Created on: 1992-08-26
2 // Created by: Remi GILET
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 #ifndef _gce_MakeCylinder_HeaderFile
18 #define _gce_MakeCylinder_HeaderFile
19
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
23
24 #include <gp_Cylinder.hxx>
25 #include <gce_Root.hxx>
26 #include <Standard_Real.hxx>
27 class StdFail_NotDone;
28 class gp_Ax2;
29 class gp_Cylinder;
30 class gp_Pnt;
31 class gp_Ax1;
32 class gp_Circ;
33
34
35 //! This class implements the following algorithms used
36 //! to create a Cylinder from gp.
37 //! * Create a Cylinder coaxial to another and passing
38 //! through a point.
39 //! * Create a Cylinder coaxial to another at a distance
40 //! <Dist>.
41 //! * Create a Cylinder with 3 points.
42 //! * Create a Cylinder by its axis and radius.
43 //! * Create a cylinder by its circular base.
44 class gce_MakeCylinder  : public gce_Root
45 {
46 public:
47
48   DEFINE_STANDARD_ALLOC
49
50   
51   //! <A2> is the local cartesian coordinate system of <me>.
52   //! The status is "NegativeRadius" if R < 0.0
53   Standard_EXPORT gce_MakeCylinder(const gp_Ax2& A2, const Standard_Real Radius);
54   
55   //! Makes a Cylinder from gp <TheCylinder> coaxial to another
56   //! Cylinder <Cylinder> and passing through a Pnt <Point>.
57   Standard_EXPORT gce_MakeCylinder(const gp_Cylinder& Cyl, const gp_Pnt& Point);
58   
59   //! Makes a Cylinder from gp <TheCylinder> coaxial to another
60   //! Cylinder <Cylinder> at the distance <Dist> which can
61   //! be greater or lower than zero.
62   //! The radius of the result is the absolute value of the
63   //! radius of <Cyl> plus <Dist>
64   Standard_EXPORT gce_MakeCylinder(const gp_Cylinder& Cyl, const Standard_Real Dist);
65   
66   //! Makes a Cylinder from gp <TheCylinder> with 3 points
67   //! <P1>,<P2>,<P3>.
68   //! Its axis is <P1P2> and its radius is the distance
69   //! between <P3> and <P1P2>
70   Standard_EXPORT gce_MakeCylinder(const gp_Pnt& P1, const gp_Pnt& P2, const gp_Pnt& P3);
71   
72   //! Makes a Cylinder by its axis <Axis> and radius <Radius>.
73   Standard_EXPORT gce_MakeCylinder(const gp_Ax1& Axis, const Standard_Real Radius);
74   
75   //! Makes a Cylinder by its circular base.
76   //! Warning
77   //! If an error occurs (that is, when IsDone returns
78   //! false), the Status function returns:
79   //! -   gce_NegativeRadius if:
80   //! -   Radius is less than 0.0, or
81   //! -   Dist is negative and has an absolute value
82   //! which is greater than the radius of Cyl; or
83   //! -   gce_ConfusedPoints if points P1 and P2 are coincident.
84   Standard_EXPORT gce_MakeCylinder(const gp_Circ& Circ);
85   
86   //! Returns the constructed cylinder.
87   //! Exceptions StdFail_NotDone if no cylinder is constructed.
88   Standard_EXPORT const gp_Cylinder& Value() const;
89   
90   Standard_EXPORT const gp_Cylinder& Operator() const;
91 Standard_EXPORT operator gp_Cylinder() const;
92
93
94
95
96 protected:
97
98
99
100
101
102 private:
103
104
105
106   gp_Cylinder TheCylinder;
107
108
109 };
110
111
112
113
114
115
116
117 #endif // _gce_MakeCylinder_HeaderFile