Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-07-04 08:31:49

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   DEFINE_STANDARD_ALLOC
0028 
0029   //! Empty constructor
0030   BRepExtrema_SolutionElem()
0031       : myDist(0.0),
0032         myPoint(0.0, 0.0, 0.0),
0033         mySupType(BRepExtrema_IsVertex),
0034         myPar1(0.0),
0035         myPar2(0.0)
0036   {
0037   }
0038 
0039   //! This constructor is used when the solution of a distance is a Vertex.
0040   //! The different initialized fields are:
0041   //! @param theDist    the distance
0042   //! @param thePoint   the solution point
0043   //! @param theSolType the type of solution
0044   //! @param theVertex  and the Vertex
0045   BRepExtrema_SolutionElem(const Standard_Real           theDist,
0046                            const gp_Pnt&                 thePoint,
0047                            const BRepExtrema_SupportType theSolType,
0048                            const TopoDS_Vertex&          theVertex)
0049       : myDist(theDist),
0050         myPoint(thePoint),
0051         mySupType(theSolType),
0052         myVertex(theVertex),
0053         myPar1(0.0),
0054         myPar2(0.0)
0055   {
0056   }
0057 
0058   //! This constructor is used when the  solution of distance is on an Edge.
0059   //! The different initialized fields are:
0060   //! @param theDist    the distance
0061   //! @param thePoint   the solution point
0062   //! @param theSolType the type of solution
0063   //! @param theEdge    the Edge
0064   //! @param theParam   the parameter to locate the solution
0065   BRepExtrema_SolutionElem(const Standard_Real           theDist,
0066                            const gp_Pnt&                 thePoint,
0067                            const BRepExtrema_SupportType theSolType,
0068                            const TopoDS_Edge&            theEdge,
0069                            const Standard_Real           theParam)
0070       : myDist(theDist),
0071         myPoint(thePoint),
0072         mySupType(theSolType),
0073         myEdge(theEdge),
0074         myPar1(theParam),
0075         myPar2(0.0)
0076   {
0077   }
0078 
0079   //! This constructor is used when the  solution of distance is in a Face.
0080   //! The different initialized fields are:
0081   //! @param theDist    the distance
0082   //! @param thePoint   the solution point
0083   //! @param theSolType the type of solution
0084   //! @param theFace    the Face
0085   //! @param theU       U parameter to locate the solution
0086   //! @param theV       V parameter to locate the solution
0087   BRepExtrema_SolutionElem(const Standard_Real           theDist,
0088                            const gp_Pnt&                 thePoint,
0089                            const BRepExtrema_SupportType theSolType,
0090                            const TopoDS_Face&            theFace,
0091                            const Standard_Real           theU,
0092                            const Standard_Real           theV)
0093       : myDist(theDist),
0094         myPoint(thePoint),
0095         mySupType(theSolType),
0096         myFace(theFace),
0097         myPar1(theU),
0098         myPar2(theV)
0099   {
0100   }
0101 
0102   //! Returns the value of the minimum distance.
0103   Standard_Real Dist() const { return myDist; }
0104 
0105   //! Returns the solution point.
0106   const gp_Pnt& Point() const { return myPoint; }
0107 
0108   //! Returns the Support type:
0109   //!   IsVertex => The solution is a vertex.
0110   //!   IsOnEdge => The solution belongs to an Edge.
0111   //!   IsInFace => The solution is inside a Face.
0112   BRepExtrema_SupportType SupportKind() const { return mySupType; }
0113 
0114   //! Returns the vertex if the solution is a Vertex.
0115   const TopoDS_Vertex& Vertex() const { return myVertex; }
0116 
0117   //! Returns the vertex if the solution is an Edge.
0118   const TopoDS_Edge& Edge() const { return myEdge; }
0119 
0120   //! Returns the vertex if the solution is an Face.
0121   const TopoDS_Face& Face() const { return myFace; }
0122 
0123   //! Returns the parameter value if the solution is on Edge.
0124   void EdgeParameter(Standard_Real& theParam) const { theParam = myPar1; }
0125 
0126   //! Returns the parameters U and V if the solution is in a Face.
0127   void FaceParameter(Standard_Real& theU, Standard_Real& theV) const
0128   {
0129     theU = myPar1;
0130     theV = myPar2;
0131   }
0132 
0133 private:
0134   Standard_Real           myDist;
0135   gp_Pnt                  myPoint;
0136   BRepExtrema_SupportType mySupType;
0137   TopoDS_Vertex           myVertex;
0138   TopoDS_Edge             myEdge;
0139   TopoDS_Face             myFace;
0140   Standard_Real           myPar1;
0141   Standard_Real           myPar2;
0142 };
0143 
0144 #endif