42cf5bc1 |
1 | // Created on: 2010-12-03 |
2 | // Created by: Artem SHAL |
3 | // Copyright (c) 2010-2014 OPEN CASCADE SAS |
4 | // |
5 | // This file is part of Open CASCADE Technology software library. |
6 | // |
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. |
12 | // |
13 | // Alternatively, this file may be used under the terms of Open CASCADE |
14 | // commercial license or contractual agreement. |
15 | |
16 | #ifndef _Bnd_Sphere_HeaderFile |
17 | #define _Bnd_Sphere_HeaderFile |
18 | |
19 | #include <Standard.hxx> |
20 | #include <Standard_DefineAlloc.hxx> |
21 | #include <Standard_Handle.hxx> |
22 | |
23 | #include <gp_XYZ.hxx> |
24 | #include <Standard_Real.hxx> |
25 | #include <Standard_Boolean.hxx> |
26 | #include <Standard_Integer.hxx> |
27 | class gp_XYZ; |
28 | |
29 | |
30 | //! This class represents a bounding sphere of a geometric entity |
31 | //! (triangle, segment of line or whatever else). |
32 | class Bnd_Sphere |
33 | { |
34 | public: |
35 | |
36 | DEFINE_STANDARD_ALLOC |
37 | |
38 | |
39 | //! Empty constructor |
40 | Standard_EXPORT Bnd_Sphere(); |
41 | |
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); |
44 | |
45 | //! Returns the U parameter on shape |
46 | Standard_Integer U() const; |
47 | |
48 | //! Returns the V parameter on shape |
49 | Standard_Integer V() const; |
50 | |
51 | //! Returns validity status, indicating that this |
52 | //! sphere corresponds to a real entity |
53 | Standard_Boolean IsValid() const; |
54 | |
55 | void SetValid (const Standard_Boolean isValid); |
56 | |
57 | //! Returns center of sphere object |
58 | const gp_XYZ& Center() const; |
59 | |
60 | //! Returns the radius value |
61 | Standard_Real Radius() const; |
62 | |
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; |
67 | |
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; |
72 | |
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; |
76 | |
77 | Standard_EXPORT Standard_Real Distance (const gp_XYZ& theNode) const; |
78 | |
79 | Standard_EXPORT Standard_Real SquareDistance (const gp_XYZ& theNode) const; |
80 | |
81 | Standard_EXPORT void Add (const Bnd_Sphere& theOther); |
82 | |
83 | Standard_EXPORT Standard_Boolean IsOut (const Bnd_Sphere& theOther) const; |
84 | |
85 | Standard_EXPORT Standard_Boolean IsOut (const gp_XYZ& thePnt, Standard_Real& theMaxDist) const; |
86 | |
87 | Standard_EXPORT Standard_Real SquareExtent() const; |
88 | |
89 | |
90 | |
91 | |
92 | protected: |
93 | |
94 | |
95 | |
96 | |
97 | |
98 | private: |
99 | |
100 | |
101 | |
102 | gp_XYZ myCenter; |
103 | Standard_Real myRadius; |
104 | Standard_Boolean myIsValid; |
105 | Standard_Integer myU; |
106 | Standard_Integer myV; |
107 | |
108 | |
109 | }; |
110 | |
111 | |
112 | #include <Bnd_Sphere.lxx> |
113 | |
114 | |
115 | |
116 | |
117 | |
118 | #endif // _Bnd_Sphere_HeaderFile |