1 // Created on: 2010-12-03
2 // Created by: Artem SHAL
3 // Copyright (c) 2010-2014 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
16 #ifndef _Bnd_Sphere_HeaderFile
17 #define _Bnd_Sphere_HeaderFile
19 #include <Standard.hxx>
20 #include <Standard_DefineAlloc.hxx>
21 #include <Standard_Handle.hxx>
24 #include <Standard_Real.hxx>
25 #include <Standard_Boolean.hxx>
26 #include <Standard_Integer.hxx>
30 //! This class represents a bounding sphere of a geometric entity
31 //! (triangle, segment of line or whatever else).
40 Standard_EXPORT Bnd_Sphere();
42 //! Constructor of a definite sphere
43 Standard_EXPORT Bnd_Sphere(const gp_XYZ& theCntr, const Standard_Real theRad, const Standard_Integer theU, const Standard_Integer theV);
45 //! Returns the U parameter on shape
46 Standard_Integer U() const;
48 //! Returns the V parameter on shape
49 Standard_Integer V() const;
51 //! Returns validity status, indicating that this
52 //! sphere corresponds to a real entity
53 Standard_Boolean IsValid() const;
55 void SetValid (const Standard_Boolean isValid);
57 //! Returns center of sphere object
58 const gp_XYZ& Center() const;
60 //! Returns the radius value
61 Standard_Real Radius() const;
63 //! Calculate and return minimal and maximal distance to sphere.
64 //! NOTE: This function is tightly optimized; any modifications
65 //! may affect performance!
66 Standard_EXPORT void Distances (const gp_XYZ& theXYZ, Standard_Real& theMin, Standard_Real& theMax) const;
68 //! Calculate and return minimal and maximal distance to sphere.
69 //! NOTE: This function is tightly optimized; any modifications
70 //! may affect performance!
71 Standard_EXPORT void SquareDistances (const gp_XYZ& theXYZ, Standard_Real& theMin, Standard_Real& theMax) const;
73 //! Projects a point on entity.
74 //! Returns true if success
75 Standard_EXPORT Standard_Boolean Project (const gp_XYZ& theNode, gp_XYZ& theProjNode, Standard_Real& theDist, Standard_Boolean& theInside) const;
77 Standard_EXPORT Standard_Real Distance (const gp_XYZ& theNode) const;
79 Standard_EXPORT Standard_Real SquareDistance (const gp_XYZ& theNode) const;
81 Standard_EXPORT void Add (const Bnd_Sphere& theOther);
83 Standard_EXPORT Standard_Boolean IsOut (const Bnd_Sphere& theOther) const;
85 Standard_EXPORT Standard_Boolean IsOut (const gp_XYZ& thePnt, Standard_Real& theMaxDist) const;
87 Standard_EXPORT Standard_Real SquareExtent() const;
103 Standard_Real myRadius;
104 Standard_Boolean myIsValid;
105 Standard_Integer myU;
106 Standard_Integer myV;
112 #include <Bnd_Sphere.lxx>
118 #endif // _Bnd_Sphere_HeaderFile