Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0002 //
0003 // This file is part of Open CASCADE Technology software library.
0004 //
0005 // This library is free software; you can redistribute it and/or modify it under
0006 // the terms of the GNU Lesser General Public License version 2.1 as published
0007 // by the Free Software Foundation, with special exception defined in the file
0008 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0009 // distribution for complete text of the license and disclaimer of any warranty.
0010 //
0011 // Alternatively, this file may be used under the terms of Open CASCADE
0012 // commercial license or contractual agreement.
0013 
0014 #ifndef _BRepExtrema_SolutionElem_HeaderFile
0015 #define _BRepExtrema_SolutionElem_HeaderFile
0016 
0017 #include <gp_Pnt.hxx>
0018 #include <BRepExtrema_SupportType.hxx>
0019 #include <TopoDS_Vertex.hxx>
0020 #include <TopoDS_Edge.hxx>
0021 #include <TopoDS_Face.hxx>
0022 
0023 //! This class is used to store information relative to the minimum distance between two shapes.
0024 class BRepExtrema_SolutionElem
0025 {
0026  public:
0027 
0028   DEFINE_STANDARD_ALLOC
0029 
0030   //! Empty constructor
0031   BRepExtrema_SolutionElem()
0032   : myDist    (0.0),
0033     myPoint   (0.0, 0.0, 0.0),
0034     mySupType (BRepExtrema_IsVertex),
0035     myPar1    (0.0),
0036     myPar2    (0.0)
0037   {
0038   }
0039 
0040   //! This constructor is used when the solution of a distance is a Vertex.
0041   //! The different initialized fields are:
0042   //! @param theDist    the distance
0043   //! @param thePoint   the solution point
0044   //! @param theSolType the type of solution
0045   //! @param theVertex  and the Vertex
0046   BRepExtrema_SolutionElem (const Standard_Real           theDist,
0047                             const gp_Pnt&                 thePoint,
0048                             const BRepExtrema_SupportType theSolType,
0049                             const TopoDS_Vertex&          theVertex)
0050   : myDist    (theDist),
0051     myPoint   (thePoint),
0052     mySupType (theSolType),
0053     myVertex  (theVertex),
0054     myPar1    (0.0),
0055     myPar2    (0.0) {}
0056 
0057   //! This constructor is used when the  solution of distance is on an Edge.
0058   //! The different initialized fields are:
0059   //! @param theDist    the distance
0060   //! @param thePoint   the solution point
0061   //! @param theSolType the type of solution
0062   //! @param theEdge    the Edge
0063   //! @param theParam   the parameter to locate the solution
0064   BRepExtrema_SolutionElem (const Standard_Real           theDist,
0065                             const gp_Pnt&                 thePoint,
0066                             const BRepExtrema_SupportType theSolType,
0067                             const TopoDS_Edge&            theEdge,
0068                             const Standard_Real           theParam)
0069   : myDist    (theDist),
0070     myPoint   (thePoint),
0071     mySupType (theSolType),
0072     myEdge    (theEdge),
0073     myPar1    (theParam),
0074     myPar2    (0.0) {}
0075 
0076   //! This constructor is used when the  solution of distance is in a Face.
0077   //! The different initialized fields are:
0078   //! @param theDist    the distance
0079   //! @param thePoint   the solution point
0080   //! @param theSolType the type of solution
0081   //! @param theFace    the Face
0082   //! @param theU       U parameter to locate the solution
0083   //! @param theV       V parameter to locate the solution
0084   BRepExtrema_SolutionElem (const Standard_Real           theDist,
0085                             const gp_Pnt&                 thePoint,
0086                             const BRepExtrema_SupportType theSolType,
0087                             const TopoDS_Face&            theFace,
0088                             const Standard_Real           theU,
0089                             const Standard_Real           theV)
0090   : myDist    (theDist),
0091     myPoint   (thePoint),
0092     mySupType (theSolType),
0093     myFace    (theFace),
0094     myPar1    (theU),
0095     myPar2    (theV) {}
0096 
0097   //! Returns the value of the minimum distance.
0098   Standard_Real Dist() const
0099   {
0100     return myDist;
0101   }
0102 
0103   //! Returns the solution point.
0104   const gp_Pnt& Point() const
0105   {
0106     return myPoint;
0107   }
0108 
0109   //! Returns the Support type:
0110   //!   IsVertex => The solution is a vertex.
0111   //!   IsOnEdge => The solution belongs to an Edge.
0112   //!   IsInFace => The solution is inside a Face.
0113   BRepExtrema_SupportType SupportKind() const
0114   {
0115     return mySupType;
0116   }
0117 
0118   //! Returns the vertex if the solution is a Vertex.
0119   const TopoDS_Vertex& Vertex() const
0120   {
0121     return myVertex;
0122   }
0123 
0124   //! Returns the vertex if the solution is an Edge.
0125   const TopoDS_Edge& Edge() const
0126   {
0127     return myEdge;
0128   }
0129 
0130   //! Returns the vertex if the solution is an Face.
0131   const TopoDS_Face& Face() const
0132   {
0133     return myFace;
0134   }
0135 
0136   //! Returns the parameter value if the solution is on Edge.
0137   void EdgeParameter (Standard_Real& theParam) const
0138   {
0139     theParam = myPar1;
0140   }
0141 
0142   //! Returns the parameters U and V if the solution is in a Face.
0143   void FaceParameter (Standard_Real& theU,
0144                       Standard_Real& theV) const
0145   {
0146     theU = myPar1;
0147     theV = myPar2;
0148   }
0149 
0150  private:
0151 
0152   Standard_Real myDist;
0153   gp_Pnt myPoint;
0154   BRepExtrema_SupportType mySupType;
0155   TopoDS_Vertex myVertex;
0156   TopoDS_Edge myEdge;
0157   TopoDS_Face myFace;
0158   Standard_Real myPar1;
0159   Standard_Real myPar2;
0160 
0161 };
0162 
0163 #endif