1 // Copyright (c) 1995-1999 Matra Datavision
2 // Copyright (c) 1999-2012 OPEN CASCADE SAS
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.
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.
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.
20 #include <Standard_ConstructionError.hxx>
22 inline gp_Cylinder::gp_Cylinder ()
23 { radius = RealLast(); }
25 inline gp_Cylinder::gp_Cylinder (const gp_Ax3& A3,
26 const Standard_Real Radius) :
29 { Standard_ConstructionError_Raise_if (Radius < 0.0,""); }
31 inline void gp_Cylinder::SetAxis (const gp_Ax1& A1)
34 inline void gp_Cylinder::SetLocation (const gp_Pnt& Loc)
35 { pos.SetLocation (Loc); }
37 inline void gp_Cylinder::SetPosition (const gp_Ax3& A3)
40 inline void gp_Cylinder::SetRadius (const Standard_Real R)
42 Standard_ConstructionError_Raise_if (R < 0.0,"");
46 inline void gp_Cylinder::UReverse()
49 inline void gp_Cylinder::VReverse()
52 inline Standard_Boolean gp_Cylinder::Direct() const
53 { return pos.Direct(); }
55 inline const gp_Ax1& gp_Cylinder::Axis () const
56 { return pos.Axis(); }
58 inline const gp_Pnt& gp_Cylinder::Location () const
59 { return pos.Location(); }
61 inline const gp_Ax3& gp_Cylinder::Position () const
64 inline Standard_Real gp_Cylinder::Radius () const
67 inline gp_Ax1 gp_Cylinder::XAxis () const
68 {return gp_Ax1(pos.Location(), pos.XDirection());}
70 inline gp_Ax1 gp_Cylinder::YAxis () const
71 {return gp_Ax1(pos.Location(), pos.YDirection());}
73 inline void gp_Cylinder::Rotate (const gp_Ax1& A1,
74 const Standard_Real Ang)
77 inline gp_Cylinder gp_Cylinder::Rotated (const gp_Ax1& A1,
78 const Standard_Real Ang) const
80 gp_Cylinder C = *this;
81 C.pos.Rotate (A1, Ang);
85 inline void gp_Cylinder::Scale (const gp_Pnt& P, const Standard_Real S)
89 if (radius < 0) radius = - radius;
92 inline gp_Cylinder gp_Cylinder::Scaled (const gp_Pnt& P,
93 const Standard_Real S) const
95 gp_Cylinder C = *this;
98 if (C.radius < 0) C.radius = - C.radius;
102 inline void gp_Cylinder::Transform (const gp_Trsf& T)
105 radius *= T.ScaleFactor();
106 if (radius < 0) radius = - radius;
109 inline gp_Cylinder gp_Cylinder::Transformed (const gp_Trsf& T) const
111 gp_Cylinder C = *this;
113 C.radius *= T.ScaleFactor();
114 if (C.radius < 0) C.radius = - C.radius;
118 inline void gp_Cylinder::Translate (const gp_Vec& V)
119 { pos.Translate (V); }
121 inline gp_Cylinder gp_Cylinder::Translated (const gp_Vec& V) const
123 gp_Cylinder C = *this;
128 inline void gp_Cylinder::Translate (const gp_Pnt& P1,
130 { pos.Translate (P1, P2); }
132 inline gp_Cylinder gp_Cylinder::Translated (const gp_Pnt& P1,
133 const gp_Pnt& P2) const
135 gp_Cylinder C = *this;
136 C.pos.Translate (P1, P2);