1 // Copyright (c) 1995-1999 Matra Datavision
2 // Copyright (c) 1999-2014 OPEN CASCADE SAS
4 // This file is part of Open CASCADE Technology software library.
6 // This library is free software; you can redistribute it and/or modify it under
7 // the terms of the GNU Lesser General Public License version 2.1 as published
8 // by the Free Software Foundation, with special exception defined in the file
9 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
10 // distribution for complete text of the license and disclaimer of any warranty.
12 // Alternatively, this file may be used under the terms of Open CASCADE
13 // commercial license or contractual agreement.
15 inline gp_Sphere::gp_Sphere () : radius (RealLast())
18 inline gp_Sphere::gp_Sphere (const gp_Ax3& A3,
19 const Standard_Real Radius) :
23 Standard_ConstructionError_Raise_if (Radius < 0.0, "gp_Sphere() - radius should be >= 0");
26 inline void gp_Sphere::SetLocation (const gp_Pnt& Loc)
27 { pos.SetLocation (Loc); }
29 inline void gp_Sphere::SetPosition (const gp_Ax3& A3)
32 inline void gp_Sphere::SetRadius (const Standard_Real R)
34 Standard_ConstructionError_Raise_if (R < 0.0, "gp_Sphere::SetRadius() - radius should be >= 0");
38 inline Standard_Real gp_Sphere::Area () const
39 { return 4.0 * M_PI * radius * radius; }
41 inline void gp_Sphere::UReverse()
44 inline void gp_Sphere::VReverse()
47 inline Standard_Boolean gp_Sphere::Direct() const
48 { return pos.Direct(); }
50 inline const gp_Pnt& gp_Sphere::Location () const
51 { return pos.Location(); }
53 inline const gp_Ax3& gp_Sphere::Position () const
56 inline Standard_Real gp_Sphere::Radius () const
59 inline Standard_Real gp_Sphere::Volume () const
60 { return (4.0 * M_PI * radius * radius * radius) / 3.0; }
62 inline gp_Ax1 gp_Sphere::XAxis () const
63 { return gp_Ax1(pos.Location(), pos.XDirection()); }
65 inline gp_Ax1 gp_Sphere::YAxis () const
66 { return gp_Ax1(pos.Location(), pos.YDirection()); }
68 inline void gp_Sphere::Rotate (const gp_Ax1& A1,
69 const Standard_Real Ang)
70 { pos.Rotate (A1, Ang); }
72 inline gp_Sphere gp_Sphere::Rotated (const gp_Ax1& A1,
73 const Standard_Real Ang) const
76 C.pos.Rotate (A1, Ang);
80 inline void gp_Sphere::Scale (const gp_Pnt& P,
81 const Standard_Real S)
85 if (radius < 0) radius = - radius;
88 inline gp_Sphere gp_Sphere::Scaled (const gp_Pnt& P,
89 const Standard_Real S) const
94 if (C.radius < 0) C.radius = - C.radius;
98 inline void gp_Sphere::Transform (const gp_Trsf& T)
101 radius *= T.ScaleFactor();
102 if (radius < 0) radius = - radius;
105 inline gp_Sphere gp_Sphere::Transformed (const gp_Trsf& T) const
109 C.radius *= T.ScaleFactor();
110 if (C.radius < 0) C.radius = - C.radius;
114 inline void gp_Sphere::Translate (const gp_Vec& V)
115 { pos.Translate (V); }
117 inline gp_Sphere gp_Sphere::Translated (const gp_Vec& V) const
124 inline void gp_Sphere::Translate (const gp_Pnt& P1,
126 { pos.Translate (P1, P2); }
128 inline gp_Sphere gp_Sphere::Translated (const gp_Pnt& P1,
129 const gp_Pnt& P2) const
132 C.pos.Translate (P1, P2);