Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/opencascade/Bnd_Sphere.hxx was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

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 //! This class represents a bounding sphere of a geometric entity
0028 //! (triangle, segment of line or whatever else).
0029 class Bnd_Sphere
0030 {
0031 public:
0032   DEFINE_STANDARD_ALLOC
0033 
0034   //! Empty constructor
0035   Standard_EXPORT Bnd_Sphere();
0036 
0037   //! Constructor of a definite sphere
0038   Standard_EXPORT Bnd_Sphere(const gp_XYZ&          theCntr,
0039                              const Standard_Real    theRad,
0040                              const Standard_Integer theU,
0041                              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,
0065                                  Standard_Real& theMin,
0066                                  Standard_Real& theMax) const;
0067 
0068   //! Calculate and return minimal and maximal distance to sphere.
0069   //! NOTE: This function is tightly optimized; any modifications
0070   //! may affect performance!
0071   Standard_EXPORT void SquareDistances(const gp_XYZ&  theXYZ,
0072                                        Standard_Real& theMin,
0073                                        Standard_Real& theMax) const;
0074 
0075   //! Projects a point on entity.
0076   //! Returns true if success
0077   Standard_EXPORT Standard_Boolean Project(const gp_XYZ&     theNode,
0078                                            gp_XYZ&           theProjNode,
0079                                            Standard_Real&    theDist,
0080                                            Standard_Boolean& theInside) const;
0081 
0082   Standard_EXPORT Standard_Real Distance(const gp_XYZ& theNode) const;
0083 
0084   Standard_EXPORT Standard_Real SquareDistance(const gp_XYZ& theNode) const;
0085 
0086   Standard_EXPORT void Add(const Bnd_Sphere& theOther);
0087 
0088   Standard_EXPORT Standard_Boolean IsOut(const Bnd_Sphere& theOther) const;
0089 
0090   Standard_EXPORT Standard_Boolean IsOut(const gp_XYZ& thePnt, Standard_Real& theMaxDist) const;
0091 
0092   Standard_EXPORT Standard_Real SquareExtent() const;
0093 
0094 protected:
0095 private:
0096   gp_XYZ           myCenter;
0097   Standard_Real    myRadius;
0098   Standard_Boolean myIsValid;
0099   Standard_Integer myU;
0100   Standard_Integer myV;
0101 };
0102 
0103 #include <Bnd_Sphere.lxx>
0104 
0105 #endif // _Bnd_Sphere_HeaderFile