1 // Created on: 1993-07-21
2 // Created by: Remi LEQUETTE
3 // Copyright (c) 1993-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 _BRepPrimAPI_MakeTorus_HeaderFile
18 #define _BRepPrimAPI_MakeTorus_HeaderFile
19 
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
23 
24 #include <BRepPrim_Torus.hxx>
25 #include <BRepPrimAPI_MakeOneAxis.hxx>
26 #include <Standard_Real.hxx>
27 #include <Standard_Address.hxx>
28 class gp_Ax2;
29 
30 
31 //! Describes functions to build tori or portions of tori.
32 //! A MakeTorus object provides a framework for:
33 //! -   defining the construction of a torus,
34 //! -   implementing the construction algorithm, and
35 //! -   consulting the result.
36 class BRepPrimAPI_MakeTorus  : public BRepPrimAPI_MakeOneAxis
37 {
38 public:
39 
40   DEFINE_STANDARD_ALLOC
41 
42 
43   //! Make a torus.
44   //! @param R1 [in] distance from the center of the pipe to the center of the torus
45   //! @param R2 [in] radius of the pipe
46   Standard_EXPORT BRepPrimAPI_MakeTorus(const Standard_Real R1, const Standard_Real R2);
47 
48   //! Make a section of a torus.
49   //! @param R1    [in] distance from the center of the pipe to the center of the torus
50   //! @param R2    [in] radius of the pipe
51   //! @param angle [in] angle to create a torus pipe segment
52   Standard_EXPORT BRepPrimAPI_MakeTorus(const Standard_Real R1, const Standard_Real R2, const Standard_Real angle);
53 
54   //! Make  a torus with angles on the small circle.
55   //! @param R1     [in] distance from the center of the pipe to the center of the torus
56   //! @param R2     [in] radius of the pipe
57   //! @param angle1 [in] first  angle to create a torus ring segment
58   //! @param angle2 [in] second angle to create a torus ring segment
59   Standard_EXPORT BRepPrimAPI_MakeTorus(const Standard_Real R1, const Standard_Real R2, const Standard_Real angle1, const Standard_Real angle2);
60 
61   //! Make  a torus with angles on the small circle.
62   //! @param R1     [in] distance from the center of the pipe to the center of the torus
63   //! @param R2     [in] radius of the pipe
64   //! @param angle1 [in] first  angle to create a torus ring segment
65   //! @param angle2 [in] second angle to create a torus ring segment
66   //! @param angle  [in] angle to create a torus pipe segment
67   Standard_EXPORT BRepPrimAPI_MakeTorus(const Standard_Real R1, const Standard_Real R2, const Standard_Real angle1, const Standard_Real angle2, const Standard_Real angle);
68 
69   //! Make a torus.
70   //! @param Axes [in] coordinate system for the construction of the sphere
71   //! @param R1   [in] distance from the center of the pipe to the center of the torus
72   //! @param R2   [in] radius of the pipe
73   Standard_EXPORT BRepPrimAPI_MakeTorus(const gp_Ax2& Axes, const Standard_Real R1, const Standard_Real R2);
74 
75   //! Make a section of a torus.
76   //! @param Axes  [in] coordinate system for the construction of the sphere
77   //! @param R1    [in] distance from the center of the pipe to the center of the torus
78   //! @param R2    [in] radius of the pipe
79   //! @param angle [in] angle to create a torus pipe segment
80   Standard_EXPORT BRepPrimAPI_MakeTorus(const gp_Ax2& Axes, const Standard_Real R1, const Standard_Real R2, const Standard_Real angle);
81 
82   //! Make a torus.
83   //! @param Axes   [in] coordinate system for the construction of the sphere
84   //! @param R1     [in] distance from the center of the pipe to the center of the torus
85   //! @param R2     [in] radius of the pipe
86   //! @param angle1 [in] first  angle to create a torus ring segment
87   //! @param angle2 [in] second angle to create a torus ring segment
88   Standard_EXPORT BRepPrimAPI_MakeTorus(const gp_Ax2& Axes, const Standard_Real R1, const Standard_Real R2, const Standard_Real angle1, const Standard_Real angle2);
89 
90   //! Make a section of a torus of radii R1 R2.
91   //! For all algorithms The resulting shape is composed of
92   //! -      a lateral toroidal face,
93   //! -      two conical faces (defined  by the equation v = angle1 and
94   //! v = angle2) if the sphere is truncated in the v parametric
95   //! direction (they may be cylindrical faces in some
96   //! particular conditions), and in case of a portion
97   //! of torus, two planar faces to close the shape.(in the planes
98   //! u = 0 and u = angle).
99   //! Notes:
100   //! -      The u parameter corresponds to a rotation angle around the Z axis.
101   //! -      The circle whose radius is equal to the minor radius,
102   //! located in the plane defined by the X axis and the Z axis,
103   //! centered on the X axis, on its positive side, and positioned
104   //! at a distance from the origin equal to the major radius, is
105   //! the reference circle of the torus. The rotation around an
106   //! axis parallel to the Y axis and passing through the center
107   //! of the reference circle gives the v parameter on the
108   //! reference circle. The X axis gives the origin of the v
109   //! parameter. Near 0, as v increases, the Z coordinate decreases.
110   Standard_EXPORT BRepPrimAPI_MakeTorus(const gp_Ax2& Axes, const Standard_Real R1, const Standard_Real R2, const Standard_Real angle1, const Standard_Real angle2, const Standard_Real angle);
111 
112   //! Returns the algorithm.
113   Standard_EXPORT Standard_Address OneAxis();
114 
115   //! Returns the algorithm.
116   Standard_EXPORT BRepPrim_Torus& Torus();
117 
118 
119 
120 
121 protected:
122 
123 
124 
125 
126 
127 private:
128 
129 
130 
131   BRepPrim_Torus myTorus;
132 
133 
134 };
135 
136 
137 
138 
139 
140 
141 
142 #endif // _BRepPrimAPI_MakeTorus_HeaderFile
143