0024157: Parallelization of assembly part of BO
[occt.git] / src / gp / gp_Cylinder.lxx
1 // Copyright (c) 1995-1999 Matra Datavision
2 // Copyright (c) 1999-2012 OPEN CASCADE SAS
3 //
4 // The content of this file is subject to the Open CASCADE Technology Public
5 // License Version 6.5 (the "License"). You may not use the content of this file
6 // except in compliance with the License. Please obtain a copy of the License
7 // at http://www.opencascade.org and read it completely before using this file.
8 //
9 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
10 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
11 //
12 // The Original Code and all software distributed under the License is
13 // distributed on an "AS IS" basis, without warranty of any kind, and the
14 // Initial Developer hereby disclaims all such warranties, including without
15 // limitation, any warranties of merchantability, fitness for a particular
16 // purpose or non-infringement. Please see the License for the specific terms
17 // and conditions governing the rights and limitations under the License.
18
19
20 #include <Standard_ConstructionError.hxx>
21
22 inline gp_Cylinder::gp_Cylinder ()
23 { radius = RealLast(); }
24
25 inline gp_Cylinder::gp_Cylinder (const gp_Ax3& A3,
26                                  const Standard_Real Radius) :
27                                  pos(A3),
28                                  radius (Radius)
29 { Standard_ConstructionError_Raise_if (Radius < 0.0,""); }
30
31 inline void gp_Cylinder::SetAxis (const gp_Ax1& A1)
32 { pos.SetAxis (A1); }
33
34 inline void gp_Cylinder::SetLocation (const gp_Pnt& Loc)
35 { pos.SetLocation (Loc); }
36
37 inline void gp_Cylinder::SetPosition (const gp_Ax3& A3)
38 { pos = A3; }
39
40 inline void gp_Cylinder::SetRadius (const Standard_Real R)
41 {
42   Standard_ConstructionError_Raise_if (R < 0.0,"");
43   radius = R;
44 }
45
46 inline void gp_Cylinder::UReverse()
47 { pos.YReverse(); }
48
49 inline void gp_Cylinder::VReverse()
50 { pos.ZReverse(); }
51
52 inline Standard_Boolean gp_Cylinder::Direct() const
53 { return pos.Direct(); }
54
55 inline const gp_Ax1&  gp_Cylinder::Axis () const
56 { return pos.Axis(); }
57
58 inline const gp_Pnt&  gp_Cylinder::Location () const
59 { return pos.Location(); }
60
61 inline const gp_Ax3&  gp_Cylinder::Position () const
62 { return pos; }
63
64 inline Standard_Real gp_Cylinder::Radius () const
65 { return radius; }
66
67 inline gp_Ax1 gp_Cylinder::XAxis () const
68 {return gp_Ax1(pos.Location(), pos.XDirection());}
69
70 inline gp_Ax1 gp_Cylinder::YAxis () const
71 {return gp_Ax1(pos.Location(), pos.YDirection());}
72
73 inline void gp_Cylinder::Rotate (const gp_Ax1& A1,
74                                  const Standard_Real Ang)
75 {pos.Rotate(A1,Ang);}
76
77 inline gp_Cylinder gp_Cylinder::Rotated (const gp_Ax1& A1,
78                                          const Standard_Real Ang) const
79 {
80   gp_Cylinder C = *this;
81   C.pos.Rotate (A1, Ang);
82   return C;
83 }
84
85 inline void gp_Cylinder::Scale (const gp_Pnt& P, const Standard_Real S)
86 {
87   pos.Scale (P, S);      
88   radius *= S;
89   if (radius < 0) radius = - radius;
90 }
91
92 inline gp_Cylinder gp_Cylinder::Scaled (const gp_Pnt& P,
93                                         const Standard_Real S) const
94 {
95   gp_Cylinder C = *this;
96   C.pos.Scale (P, S);
97   C.radius *= S;
98   if (C.radius < 0) C.radius = - C.radius;
99   return C;
100 }
101
102 inline void gp_Cylinder::Transform (const gp_Trsf& T)
103 {
104   pos.Transform (T);
105   radius *= T.ScaleFactor();
106   if (radius < 0) radius = - radius;
107 }
108
109 inline gp_Cylinder gp_Cylinder::Transformed (const gp_Trsf& T) const
110 {
111   gp_Cylinder C = *this;
112   C.pos.Transform (T);
113   C.radius *= T.ScaleFactor();
114   if (C.radius < 0) C.radius = - C.radius;
115   return C;
116 }
117
118 inline void gp_Cylinder::Translate (const gp_Vec& V)
119 { pos.Translate (V); }
120
121 inline gp_Cylinder gp_Cylinder::Translated (const gp_Vec& V) const
122 {
123   gp_Cylinder C = *this;
124   C.pos.Translate (V);
125   return C;
126 }
127
128 inline void gp_Cylinder::Translate (const gp_Pnt& P1,
129                                     const gp_Pnt& P2)
130 { pos.Translate (P1, P2); }
131
132 inline gp_Cylinder gp_Cylinder::Translated (const gp_Pnt& P1,
133                                             const gp_Pnt& P2) const
134 {
135   gp_Cylinder C = *this;
136   C.pos.Translate (P1, P2);
137   return C;
138 }
139