Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:03:03

0001 // Created on: 2010-12-03
0002 // Created by: Artem SHAL
0003 // Copyright (c) 2010-2014 OPEN CASCADE SAS
0004 //
0005 // This file is part of Open CASCADE Technology software library.
0006 //
0007 // This library is free software; you can redistribute it and/or modify it under
0008 // the terms of the GNU Lesser General Public License version 2.1 as published
0009 // by the Free Software Foundation, with special exception defined in the file
0010 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0011 // distribution for complete text of the license and disclaimer of any warranty.
0012 //
0013 // Alternatively, this file may be used under the terms of Open CASCADE
0014 // commercial license or contractual agreement.
0015 
0016 #ifndef _Bnd_Sphere_HeaderFile
0017 #define _Bnd_Sphere_HeaderFile
0018 
0019 #include <Standard.hxx>
0020 #include <Standard_DefineAlloc.hxx>
0021 #include <Standard_Handle.hxx>
0022 
0023 #include <gp_XYZ.hxx>
0024 #include <Standard_Real.hxx>
0025 #include <Standard_Boolean.hxx>
0026 
0027 
0028 //! This class represents a bounding sphere of a geometric entity
0029 //! (triangle, segment of line or whatever else).
0030 class Bnd_Sphere 
0031 {
0032 public:
0033 
0034   DEFINE_STANDARD_ALLOC
0035 
0036   
0037   //! Empty constructor
0038   Standard_EXPORT Bnd_Sphere();
0039   
0040   //! Constructor of a definite sphere
0041   Standard_EXPORT Bnd_Sphere(const gp_XYZ& theCntr, const Standard_Real theRad, const Standard_Integer theU, const Standard_Integer theV);
0042   
0043   //! Returns the U parameter on shape
0044     Standard_Integer U() const;
0045   
0046   //! Returns the V parameter on shape
0047     Standard_Integer V() const;
0048   
0049   //! Returns validity status, indicating that this
0050   //! sphere corresponds to a real entity
0051     Standard_Boolean IsValid() const;
0052   
0053     void SetValid (const Standard_Boolean isValid);
0054   
0055   //! Returns center of sphere object
0056     const gp_XYZ& Center() const;
0057   
0058   //! Returns the radius value
0059     Standard_Real Radius() const;
0060   
0061   //! Calculate and return minimal and maximal distance to sphere.
0062   //! NOTE: This function is tightly optimized; any modifications
0063   //! may affect performance!
0064   Standard_EXPORT void Distances (const gp_XYZ& theXYZ, Standard_Real& theMin, Standard_Real& theMax) const;
0065   
0066   //! Calculate and return minimal and maximal distance to sphere.
0067   //! NOTE: This function is tightly optimized; any modifications
0068   //! may affect performance!
0069   Standard_EXPORT void SquareDistances (const gp_XYZ& theXYZ, Standard_Real& theMin, Standard_Real& theMax) const;
0070   
0071   //! Projects a point on entity.
0072   //! Returns true if success
0073   Standard_EXPORT Standard_Boolean Project (const gp_XYZ& theNode, gp_XYZ& theProjNode, Standard_Real& theDist, Standard_Boolean& theInside) const;
0074   
0075   Standard_EXPORT Standard_Real Distance (const gp_XYZ& theNode) const;
0076   
0077   Standard_EXPORT Standard_Real SquareDistance (const gp_XYZ& theNode) const;
0078   
0079   Standard_EXPORT void Add (const Bnd_Sphere& theOther);
0080   
0081   Standard_EXPORT Standard_Boolean IsOut (const Bnd_Sphere& theOther) const;
0082   
0083   Standard_EXPORT Standard_Boolean IsOut (const gp_XYZ& thePnt, Standard_Real& theMaxDist) const;
0084   
0085   Standard_EXPORT Standard_Real SquareExtent() const;
0086 
0087 
0088 
0089 
0090 protected:
0091 
0092 
0093 
0094 
0095 
0096 private:
0097 
0098 
0099 
0100   gp_XYZ myCenter;
0101   Standard_Real myRadius;
0102   Standard_Boolean myIsValid;
0103   Standard_Integer myU;
0104   Standard_Integer myV;
0105 
0106 
0107 };
0108 
0109 
0110 #include <Bnd_Sphere.lxx>
0111 
0112 
0113 
0114 
0115 
0116 #endif // _Bnd_Sphere_HeaderFile