0024002: Overall code and build procedure refactoring -- manual
[occt.git] / src / BRepExtrema / BRepExtrema_SolutionElem.hxx
1 // Copyright (c) 1999-2014 OPEN CASCADE SAS
2 //
3 // This file is part of Open CASCADE Technology software library.
4 //
5 // This library is free software; you can redistribute it and/or modify it under
6 // the terms of the GNU Lesser General Public License version 2.1 as published
7 // by the Free Software Foundation, with special exception defined in the file
8 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
9 // distribution for complete text of the license and disclaimer of any warranty.
10 //
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
13
14 #ifndef _BRepExtrema_SolutionElem_HeaderFile
15 #define _BRepExtrema_SolutionElem_HeaderFile
16
17 #include <gp_Pnt.hxx>
18 #include <BRepExtrema_SupportType.hxx>
19 #include <TopoDS_Vertex.hxx>
20 #include <TopoDS_Edge.hxx>
21 #include <TopoDS_Face.hxx>
22
23 //! This class is used to store information relative to the minimum distance between two shapes.
24 class BRepExtrema_SolutionElem
25 {
26  public:
27
28   DEFINE_STANDARD_ALLOC
29
30   //! Empty constructor
31   BRepExtrema_SolutionElem()
32   : myDist    (0.0),
33     myPoint   (0.0, 0.0, 0.0),
34     mySupType (BRepExtrema_IsVertex),
35     myPar1    (0.0),
36     myPar2    (0.0)
37   {
38   }
39
40   //! This constructor is used when the solution of a distance is a Vertex.
41   //! The different initialized fields are:
42   //! @param theDist    the distance
43   //! @param thePoint   the solution point
44   //! @param theSolType the type of solution
45   //! @param theVertex  and the Vertex
46   BRepExtrema_SolutionElem (const Standard_Real           theDist,
47                             const gp_Pnt&                 thePoint,
48                             const BRepExtrema_SupportType theSolType,
49                             const TopoDS_Vertex&          theVertex)
50   : myDist    (theDist),
51     myPoint   (thePoint),
52     mySupType (theSolType),
53     myVertex  (theVertex),
54     myPar1    (0.0),
55     myPar2    (0.0) {}
56
57   //! This constructor is used when the  solution of distance is on an Edge.
58   //! The different initialized fields are:
59   //! @param theDist    the distance
60   //! @param thePoint   the solution point
61   //! @param theSolType the type of solution
62   //! @param theEdge    the Edge
63   //! @param theParam   the parameter to locate the solution
64   BRepExtrema_SolutionElem (const Standard_Real           theDist,
65                             const gp_Pnt&                 thePoint,
66                             const BRepExtrema_SupportType theSolType,
67                             const TopoDS_Edge&            theEdge,
68                             const Standard_Real           theParam)
69   : myDist    (theDist),
70     myPoint   (thePoint),
71     mySupType (theSolType),
72     myEdge    (theEdge),
73     myPar1    (theParam),
74     myPar2    (0.0) {}
75
76   //! This constructor is used when the  solution of distance is in a Face.
77   //! The different initialized fields are:
78   //! @param theDist    the distance
79   //! @param thePoint   the solution point
80   //! @param theSolType the type of solution
81   //! @param theFace    the Face
82   //! @param theU       U parameter to locate the solution
83   //! @param theV       V parameter to locate the solution
84   BRepExtrema_SolutionElem (const Standard_Real           theDist,
85                             const gp_Pnt&                 thePoint,
86                             const BRepExtrema_SupportType theSolType,
87                             const TopoDS_Face&            theFace,
88                             const Standard_Real           theU,
89                             const Standard_Real           theV)
90   : myDist    (theDist),
91     myPoint   (thePoint),
92     mySupType (theSolType),
93     myFace    (theFace),
94     myPar1    (theU),
95     myPar2    (theV) {}
96
97   //! Returns the value of the minimum distance.
98   Standard_Real Dist() const
99   {
100     return myDist;
101   }
102
103   //! Returns the solution point.
104   const gp_Pnt& Point() const
105   {
106     return myPoint;
107   }
108
109   //! Returns the Support type:
110   //!   IsVertex => The solution is a vertex.
111   //!   IsOnEdge => The solution belongs to an Edge.
112   //!   IsInFace => The solution is inside a Face.
113   BRepExtrema_SupportType SupportKind() const
114   {
115     return mySupType;
116   }
117
118   //! Returns the vertex if the solution is a Vertex.
119   const TopoDS_Vertex& Vertex() const
120   {
121     return myVertex;
122   }
123
124   //! Returns the vertex if the solution is an Edge.
125   const TopoDS_Edge& Edge() const
126   {
127     return myEdge;
128   }
129
130   //! Returns the vertex if the solution is an Face.
131   const TopoDS_Face& Face() const
132   {
133     return myFace;
134   }
135
136   //! Returns the parameter value if the solution is on Edge.
137   void EdgeParameter (Standard_Real& theParam) const
138   {
139     theParam = myPar1;
140   }
141
142   //! Returns the parameters U and V if the solution is in a Face.
143   void FaceParameter (Standard_Real& theU,
144                       Standard_Real& theV) const
145   {
146     theU = myPar1;
147     theV = myPar2;
148   }
149
150  private:
151
152   Standard_Real myDist;
153   gp_Pnt myPoint;
154   BRepExtrema_SupportType mySupType;
155   TopoDS_Vertex myVertex;
156   TopoDS_Edge myEdge;
157   TopoDS_Face myFace;
158   Standard_Real myPar1;
159   Standard_Real myPar2;
160
161 };
162
163 #endif