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
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 
18 #include <BRepBuilderAPI.hxx>
19 #include <BRepPrim_Torus.hxx>
20 #include <BRepPrimAPI_MakeTorus.hxx>
21 #include <gp_Ax2.hxx>
22 #include <Standard_DomainError.hxx>
23 
24 //=======================================================================
25 //function : BRepPrimAPI_MakeTorus
26 //purpose  :
27 //=======================================================================
BRepPrimAPI_MakeTorus(const Standard_Real R1,const Standard_Real R2)28 BRepPrimAPI_MakeTorus::BRepPrimAPI_MakeTorus(const Standard_Real R1,
29 				     const Standard_Real R2) :
30        myTorus(R1, R2)
31 {
32 }
33 
34 
35 //=======================================================================
36 //function : BRepPrimAPI_MakeTorus
37 //purpose  :
38 //=======================================================================
39 
BRepPrimAPI_MakeTorus(const Standard_Real R1,const Standard_Real R2,const Standard_Real angle)40 BRepPrimAPI_MakeTorus::BRepPrimAPI_MakeTorus(const Standard_Real R1,
41 				     const Standard_Real R2,
42 				     const Standard_Real angle) :
43        myTorus(R1, R2)
44 {
45   myTorus.Angle(angle);
46 }
47 
48 
49 //=======================================================================
50 //function : BRepPrimAPI_MakeTorus
51 //purpose  :
52 //=======================================================================
53 
BRepPrimAPI_MakeTorus(const Standard_Real R1,const Standard_Real R2,const Standard_Real angle1,const Standard_Real angle2)54 BRepPrimAPI_MakeTorus::BRepPrimAPI_MakeTorus(const Standard_Real R1,
55 				     const Standard_Real R2,
56 				     const Standard_Real angle1,
57 				     const Standard_Real angle2) :
58        myTorus( R1, R2)
59 {
60   myTorus.VMin(angle1);
61   myTorus.VMax(angle2);
62 }
63 
64 
65 //=======================================================================
66 //function : BRepPrimAPI_MakeTorus
67 //purpose  :
68 //=======================================================================
69 
BRepPrimAPI_MakeTorus(const Standard_Real R1,const Standard_Real R2,const Standard_Real angle1,const Standard_Real angle2,const Standard_Real angle)70 BRepPrimAPI_MakeTorus::BRepPrimAPI_MakeTorus(const Standard_Real R1,
71 				     const Standard_Real R2,
72 				     const Standard_Real angle1,
73 				     const Standard_Real angle2,
74 				     const Standard_Real angle) :
75        myTorus( R1, R2)
76 {
77   myTorus.VMin(angle1);
78   myTorus.VMax(angle2);
79   myTorus.Angle(angle);
80 }
81 
82 
83 //=======================================================================
84 //function : BRepPrimAPI_MakeTorus
85 //purpose  :
86 //=======================================================================
87 
BRepPrimAPI_MakeTorus(const gp_Ax2 & Axes,const Standard_Real R1,const Standard_Real R2)88 BRepPrimAPI_MakeTorus::BRepPrimAPI_MakeTorus(const gp_Ax2& Axes,
89 				     const Standard_Real R1,
90 				     const Standard_Real R2) :
91        myTorus(Axes, R1, R2)
92 {
93 }
94 
95 
96 //=======================================================================
97 //function : BRepPrimAPI_MakeTorus
98 //purpose  :
99 //=======================================================================
100 
BRepPrimAPI_MakeTorus(const gp_Ax2 & Axes,const Standard_Real R1,const Standard_Real R2,const Standard_Real angle)101 BRepPrimAPI_MakeTorus::BRepPrimAPI_MakeTorus(const gp_Ax2& Axes,
102 				     const Standard_Real R1,
103 				     const Standard_Real R2,
104 				     const Standard_Real angle) :
105        myTorus(Axes, R1, R2)
106 {
107   myTorus.Angle(angle);
108 }
109 
110 
111 //=======================================================================
112 //function : BRepPrimAPI_MakeTorus
113 //purpose  :
114 //=======================================================================
115 
BRepPrimAPI_MakeTorus(const gp_Ax2 & Axes,const Standard_Real R1,const Standard_Real R2,const Standard_Real angle1,const Standard_Real angle2)116 BRepPrimAPI_MakeTorus::BRepPrimAPI_MakeTorus(const gp_Ax2& Axes,
117 				     const Standard_Real R1,
118 				     const Standard_Real R2,
119 				     const Standard_Real angle1,
120 				     const Standard_Real angle2) :
121        myTorus(Axes, R1, R2)
122 {
123   myTorus.VMin(angle1);
124   myTorus.VMax(angle2);
125 }
126 
127 
128 //=======================================================================
129 //function : BRepPrimAPI_MakeTorus
130 //purpose  :
131 //=======================================================================
132 
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)133 BRepPrimAPI_MakeTorus::BRepPrimAPI_MakeTorus(const gp_Ax2& Axes,
134 				     const Standard_Real R1,
135 				     const Standard_Real R2,
136 				     const Standard_Real angle1,
137 				     const Standard_Real angle2,
138 				     const Standard_Real angle) :
139        myTorus(Axes, R1, R2)
140 {
141   myTorus.VMin(angle1);
142   myTorus.VMax(angle2);
143   myTorus.Angle(angle);
144 }
145 
146 
147 //=======================================================================
148 //function : OneAxis
149 //purpose  :
150 //=======================================================================
151 
OneAxis()152 Standard_Address  BRepPrimAPI_MakeTorus::OneAxis()
153 {
154   return &myTorus;
155 }
156 
157 
158 //=======================================================================
159 //function : Torus
160 //purpose  :
161 //=======================================================================
162 
Torus()163 BRepPrim_Torus&  BRepPrimAPI_MakeTorus::Torus()
164 {
165   return myTorus;
166 }
167 
168 
169